-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
93 lines (79 loc) · 1.86 KB
/
index.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Document</title>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic&subset=latin,cyrillic-ext,cyrillic,latin-ext'>
<link rel="stylesheet" href="src/typesetter.css">
</head>
<body>
<pre id="test_data" style="display: none;">
'
s
s
// function
function hashKey(obj) {
/*
* test comment
*/
var objType = typeof obj,
key;
if (objType == 'object' && obj !== null) {
if (typeof (key = obj.$$hashKey) == 'function') {
// must invoke on object to keep the right this
key = obj.$$hashKey();
} else if (key === undefined) {
key = obj.$$hashKey = nextUid();
}
} else {
key = obj;
}
return objType + ':' + key;
}
function HashMap(array){
forEach(array, this.put, this);
}
HashMap.prototype = {
/**
* Store key value pair
* @param key key to store can be any type
* @param value value to store can be any type
*/
put: function(key, value) {
this[hashKey(key)] = value;
},
/**
* @param key
* @returns {Object} the value for the key
*/
get: function(key) {
return this[hashKey(key)];
},
/**
* Remove the key/value pair
* @param key
*/
remove: function(key) {
var value = this[key = hashKey(key)];
delete this[key];
return value;
}
};
</pre>
<pre id="typesetter"></div>
</body>
<script src="src/typesetter.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function(){
var data = document.querySelector('#test_data').textContent;
var element = document.querySelector('#typesetter');
typesetter(element, {
data: data,
maxErrorsCount: 5, // 0 - without limit
cursorAutoShift: true, // ignore whitespace
skipComments: true, // additional setup for cursorAutoShift
skipEmptyLines: true, // additional setup for cursorAutoShift
});
});
</script>
</html>