Version 1.0.0 (2025-10-12): Frisch
This commit is contained in:
parent
2a3d0fbd7b
commit
1fda4c2ed5
223 changed files with 188349 additions and 0 deletions
95
duc/Code39-Generator/index.html
Normal file
95
duc/Code39-Generator/index.html
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd" xml:lang="de-DE">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>
|
||||
Code39-Generator
|
||||
</title>
|
||||
<script type="text/javascript" src="jquery-1.9.1.js"></script>
|
||||
<style type="text/css">
|
||||
body
|
||||
{
|
||||
font-family: Arial;
|
||||
margin: 40px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>Text: <input id="txt" onkeyup="javascript:generate39();" onchange="javascript:generate39();" value="INFORMATIK" /></p>
|
||||
<p>Code39:</p>
|
||||
<p id="error">aa</p>
|
||||
<canvas id="cnv39" width="256" height="100"></canvas>
|
||||
<div style="position: fixed; bottom: 10px; right: 10px; font-size:80%;">
|
||||
<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://tools.info-bw.de/code39/">Code39-Generator</a> von <span property="cc:attributionName"><a href="mailto:rainer.helfrich@zsl-rstue.de">Rainer Helfrich</a></span> lizenziert als <a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">CC BY-SA 4.0<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1" alt=""><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1" alt=""><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1" alt=""></a></p>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
const chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
|
||||
const codes=new Array(
|
||||
"111221211","211211112","112211112","212211111","111221112","211221111","112221111","111211212",
|
||||
"211211211","112211211","211112112","112112112","212112111","111122112","211122111","112122111",
|
||||
"111112212","211112211","112112211","111122211","211111122","112111122","212111121","111121122",
|
||||
"211121121","112121121","111111222","211111221","112111221","111121221","221111112","122111112",
|
||||
"222111111","121121112","221121111","122121111","121111212","221111211","122111211","121121211",
|
||||
"121212111","121211121","121112121","111212121");
|
||||
function generate39()
|
||||
{
|
||||
var input = "*"+document.getElementById("txt").value+"*";
|
||||
const canvas = document.getElementById('cnv39');
|
||||
if (input.length == 2)
|
||||
{
|
||||
document.getElementById("error").textContent = "Leerer Text";
|
||||
canvas.style.display="none";
|
||||
return;
|
||||
}
|
||||
canvas.style.display="";
|
||||
var w = input.length * 13*2 - 2;
|
||||
document.getElementById("error").textContent = "";
|
||||
document.getElementById("cnv39").width = w;
|
||||
var img = new ImageData(w, 100);
|
||||
var x = 0;
|
||||
for (var i = 0; i < input.length; i++)
|
||||
{
|
||||
var idx = chars.indexOf(input[i]);
|
||||
if (idx < 0)
|
||||
{
|
||||
document.getElementById("error").textContent = "Ungültiges Zeichen '"+input[i]+"'.";
|
||||
return;
|
||||
}
|
||||
var code = codes[idx];
|
||||
if (i < input.length-1)
|
||||
code += "1";
|
||||
for (var j = 0; j < code.length; j++)
|
||||
{
|
||||
zeichneFarbe(img, x, w, j % 2 == 0);
|
||||
x++;
|
||||
if (code[j] == '2')
|
||||
{
|
||||
zeichneFarbe(img, x, w, j % 2 == 0);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.putImageData(img, 0, 0);
|
||||
}
|
||||
function zeichneFarbe(imgdata, x, width, bit)
|
||||
{
|
||||
for (var y = 0; y < 100; y++)
|
||||
{
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
imgdata.data[4*(y*width+2*x)+i] = bit ? 0 : 255;
|
||||
}
|
||||
imgdata.data[4*(y*width+2*x)+3] = 255;
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
imgdata.data[4*(y*width+2*x+1)+i] = bit ? 0 : 255;
|
||||
}
|
||||
imgdata.data[4*(y*width+2*x+1)+3] = 255;
|
||||
}
|
||||
}
|
||||
generate39();
|
||||
//]]></script>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue