forked from getify/getify.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
75 lines (61 loc) · 1.54 KB
/
Copy pathindex.html
File metadata and controls
75 lines (61 loc) · 1.54 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html>
<head>
<title>syntaxur</title>
<style>
textarea { font-family:monospace; font-size:15px; }
pre { border:1px solid black; padding:10px; }
code { white-space:pre-wrap; font-family:monospace; font-size:15px; }
</style>
</head>
<body>
<h1>syntaxur</h1>
<p>
<textarea id="source" cols="100" rows="15"></textarea>
</p>
<p>
<input id="format" type="button" value="syntaxur">
<input id="reset" type="reset" value="reset">
</p>
<p>
<div id="time"></div>
<pre><code></code></pre>
</p>
<script src="node_modules/literalizer/lib/lit.js"></script>
<script src="syntaxur.js"></script>
<script src="jquery.js"></script>
<script>
$("#format").click(function(evt){
evt.preventDefault();
evt.stopImmediatePropagation();
$("code").empty();
$("#time").text("Clearing out DOM...");
setTimeout(function(){
$("#time").text("Highlighting...");
setTimeout(function(){
var source = $("#source").val(), html, t1;
t1 = Date.now();
html = Syntaxur.highlight(source);
t2 = Date.now();
$("#time").text("Highlighting (not including DOM manipulation) took: " + (t2-t1) + "ms. DOM manipulation...");
setTimeout(function(){
$("code").hide();
t1 = Date.now();
$("code").html(html);
t2 = Date.now();
$("code").show();
$("#time").text($("#time").text() + " took: " + (t2-t1) + "ms)");
},50);
},50);
},500);
});
$("#reset").click(function(evt){
evt.preventDefault();
evt.stopImmediatePropagation();
$("#source").val("");
$("code").empty();
$("#time").empty();
});
</script>
</body>
</html>