-
Notifications
You must be signed in to change notification settings - Fork 1
/
markdeep-viewer.html
61 lines (57 loc) · 2.12 KB
/
markdeep-viewer.html
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
54
55
56
57
58
59
60
61
<canvas hidden id='canvas' width='800' height='800'></canvas>
<div id='result'></div>
<div id='png-container'></div>
<script>
var arr=document.currentScript.parentElement.querySelectorAll('.bullet');
for (var i=0;i<arr.length;i++){
arr[i].innerHTML=arr[i].innerHTML
.replace(/^(\s*)(\>\;|\<\;|[\!,\@,\#,\%]*)(\[x\]|\[ \]|\(x\)|\( \)|-) /gm,function(match,p1,p2,p3){
switch(p3){
case '[x]':
return p1+ '+ <label>' + p2 + '</label><input type="checkbox" class="box" checked></input>';
case '[ ]':
return p1+ '+ <label>' + p2 + '</label><input type="checkbox" class="box"></input>';
case '(x)':
return p1+ '+ <label>' + p2 + '</label><input type="checkbox" class="circle" checked></input>';
case '( )':
return p1+ '+ <label>' + p2 + '</label><input type="checkbox" class="circle"></input>';
case '-':
return p1 + '+ -<label>' + p2 + '</label>';
default:
return match;
}
})
;
}
</script>
<style>
.bullet > ul {position:relative;}
.bullet li {position:static;}
.bullet label {
font-family: Menlo;
background:#fff;
position: absolute;
left:0em;
}
.bullet > ul {padding-left:20px;}
.bullet input[type=checkbox] {
width: 1em;
height: 1em;
margin-top: 0em;
margin-bottom: 0em;
border: #666 thin;
border-style:solid;
-webkit-appearance: none;
;}
.bullet input[type=checkbox].circle {border-radius: 100px;}
.bullet input[type=checkbox]:checked {background: #70a0ff;}
.bullet li {list-style-type:none;}
</style>
<script>
window.history.pushState({},"", "/?");
window.markdeepOptions = {mode: 'markdeep'};
window.alreadyProcessedMarkdeep=false;
</script>
<!-- Markdeep: --><style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="https://casual-effects.com/markdeep/0.19/markdeep.js"></script>
<script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>
<div style="opacity:0.2;position:fixed; margin:.3em; bottom:0em; right:0em;"><small>Inspired by <a href="http://www.squarefree.com/">Jesse Ruderman</a> and hosted by <a href="http://tomberek.info/markdeep.html">tomberek</a>.</small></div>