- Registriert
- 15. August 2013
- Beiträge
- 10.107
- Reaktionspunkte
- 13.107
- Punkte
- 1.073
@Mau33 : ich hab den zerleger mal als html variante umgeschrieben. kann man einfach in einem browser öffnen. 07er emm einfügen und ausserhalb des eingabefelds klicken. dann erscheint die ausgabe :
EDIT : überarbeitet.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//DE">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv=“cache-control“ content=“no-cache“>
<meta http-equiv=“pragma“ content=“no-cache“>
<meta http-equiv=“expires“ content=“0″>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0">
<title>Emm Zerleger</title>
</head>
<body style="background-color: orange">
<h3>EMM Zerleger von name007</h3>
EMM Eingabe (827038C1 oder unknown/07er) :<input type="text" id="inpemm" onchange="startzerlegen ()"><br>
<h5>Ausgabe - angezeigte ins7e, BoxId oder Zuordner werden per linksklick in die Zwischenablage kopiert :</h5>
<div id="ausgabe"></div><br>
<button style="display: none" id="loeschen" onclick="document.getElementById ('ausgabe').innerHTML = '' ; this.style='display: none'">Ausgabe löschen</button>
<script>
function markieren (elem) {
if (document.selection && document.selection.createRange) {
var textRange = document.selection.createRange();
textRange.moveToElementText(elem);
textRange.select();
} else if (document.createRange && window.getSelection) {
var range = document.createRange();
range.selectNode(elem);
var selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
}
function toclipcp (ele) {
markieren (ele) ;
document.execCommand("copy");
return false ;
}
function zerlegen (inp,w)
{
if (inp == "")
{
if (w)
return "" ;
return "Fehler. Kein zerlegbares EMM gefunden" ;
}
if ((inp.indexOf ("827038c1") == 0) || (inp.indexOf ("827038C1") == 0))
{
var out = "",rest ;
document.getElementById ("inpemm").value = "" ;
out = inp.substr (0,118)+":<br>ins7e :<div onclick='toclipcp (this)'>"+inp.substr (26,32)+"00010202030002020203</div>" ;
inp = inp.substr (118) ;
rest = zerlegen (inp,1) ;
if (rest != "")
out += "<br><br>"+rest ;
return out ;
}
if ((inp.indexOf ("8270") == 0) && (inp.substr (6).indexOf ("41") == 0) && (inp.substr (16).indexOf ("07") == 0))
{
var c = parseInt (inp.substr (4,2),16),i = c*2,t2 = inp.substr (0,i+6),tmp = t2.substr (38),ser = t2.substr (8,8),subnum,t3,out = t2+":<br><table border=\"1\">\n<tr><th>Subemm Nr. (0-4)</th><th>Boxid</th><th>Zuordner</th></tr>\n",c,emm,xc,ccpy = c,rest ;
i = 0 ;
while (tmp.length > 12)
{
subnum = parseInt (tmp.substr (0,2),16) ;
t3 = tmp.substr (2,8) ;
i++ ;
out += "<tr><td>"+subnum+"</td><td onclick='toclipcp (this)'>"+t3+"</td>" ;
c = parseInt (tmp.substr (10,2),16) ;
xc = parseInt (tmp.substr (14,2),16) ;
emm = "8270"+(xc+10).toString(16)+"41"+ser+"0200"+tmp.substr (10,2)+"90"+tmp.substr (14,2+(xc*2)) ;
out += "<td onclick='toclipcp (this)'>"+emm+"</td></tr>\n" ;
tmp = tmp.substr (12+(c*2))
}
out += "</table>\n" ;
document.getElementById ("inpemm").value = "" ;
inp = inp.substr ((c*2)+6) ;
rest = zerlegen (inp,1) ;
if (rest != "")
out += "<br><br>"+rest ;
return out ;
}
return (zerlegen (inp.substr (1),w)) ;
}
function startzerlegen ()
{
document.getElementById ("ausgabe").innerHTML += zerlegen (document.getElementById ("inpemm").value,0)+"<br>" ;
document.getElementById ("loeschen").style = "" ;
setTimeout (setfocus,1000) ;
}
function setfocus ()
{
document.getElementById ("inpemm").focus () ;
}
setfocus () ;
</script>
</body>
</html>
EDIT : überarbeitet.
Zuletzt bearbeitet: