-
Notifications
You must be signed in to change notification settings - Fork 20
/
design.htm
53 lines (52 loc) · 2.75 KB
/
design.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!doctype html>
<meta charset="utf-8">
<body>
<p>Hello world!</p>
<p id="decoded1">basic text =?zerokit-1ed6ba13a44a74b4cc151f69e23007d636771723f7059ae730213befeccefa20?9XuAhLWwhYpfkevRGlqLFGgwcAzO2fGSbquvf4fy??= test</p>
<form method="post" action="http://echo.opera.com/">
<p id="contianer1"><input id="testinput" name="q" value="=?zerokit-1ed6ba13a44a74b4cc151f69e23007d636771723f7059ae730213befeccefa20?hrWUD//5j1y/pwlEC2xhAhlQtI2ppn6bjH3XInq41Q==??="></p>
<p id="contianer2"><textarea id="testtextarea" name="t" rows="4">=?zerokit-1ed6ba13a44a74b4cc151f69e23007d636771723f7059ae730213befeccefa20?xIQrCKVYnL/5P+JseDNBsCHrAQeT16iQD3nMYIBiRA==??=</textarea></p>
<p>you said: <span id="display"></span></p>
</form>
<p><input type="button" value="remove input" onclick="removeInput()"><input type="button" value="append input" onclick="appendInput()"></p>
<p><div id="test2" style="display:inline-block;padding:2px;width:132px;min-height:4em;background-color:#ffff80;" contenteditable>=?zerokit-1ed6ba13a44a74b4cc151f69e23007d636771723f7059ae730213befeccefa20?vN9B4yqa8UAOXQbcYFb0CSvvKEDJlt5vngAwi3Y=??=<br>...</div></p>
<p>you said: <code id="disp2" style="white-space:pre;"></code></p>
<p id="decoded2">and now the <em>html</em> test: "=?zerokit-1ed6ba13a44a74b4cc151f69e23007d636771723f7059ae730213befeccefa20?GN5UWt36lmy6TxO/tx+k1zo6PT/af0rwd7vjNiMWHg92MEgKeDhnLnjHQCPr8ScdsJMVgQy+RrssLB8HQw==?<a href="/hash/foo">#foo</a>,<a href="/user/bar">@bar</a>?=" good luck</p>
<script>
var contianer1 = document.getElementById('contianer1');
var testinput = document.getElementById('testinput');
var display = document.getElementById('display');
testinput.addEventListener('change', function () {
var v = testinput.value;
console.log('onchange to ' + v);
display.textContent = v;
});
testtextarea.addEventListener('change', function () {
var v = testtextarea.value;
console.log('onchange to ' + v + '(' + v.length + ')');
display.textContent = v;
});
testtextarea.addEventListener('input', function () {
var v = testtextarea.value;
console.log('oninput to ' + v + '(' + v.length + ')');
display.textContent = v;
});
function removeInput() {
contianer1.removeChild(testinput);
}
function appendInput() {
contianer1.appendChild(testinput);
}
var test2 = document.getElementById('test2');
var disp2 = document.getElementById('disp2');
test2.addEventListener('input', function () {
var v = test2.innerHTML;
console.log('contentEditable input to ' + v);
disp2.textContent = v;
});
window.addEventListener('keydown', function (e) {
console.log(e.keyCode);
});
</script>
<p><input type="button" value="check tree 1" onclick="alert(document.getElementById('decoded1').innerHTML)"></p>
<p><input type="button" value="check tree 2" onclick="alert(document.getElementById('decoded2').innerHTML)"></p>