summaryrefslogtreecommitdiff
path: root/unicode/test.html
blob: 5100bf94ed68d0b25918f8c45fc6eac41adf3d00 (plain)
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
<link rel="stylesheet" href="../fixedsys-excelsior/fsex300.css" type="text/css" charset="utf-8" />
<style type="text/css">
body{ background:black; }
body{font-size:16pt;}
u { color: #888; }
.fa{color:#fff}.fb{color:#000}.fc{color:#00007F}.fd{color:#009300}.fe{color:red}.ff{color:#7f0000}.fg{color:#9C009C}.fh{color:#FC7F00}.fi{color:#FF0}.fj{color:#00FC00}.fk{color:#009393}.fl{color:#0FF}.fm{color:#0000FC}.fn{color:#F0F}.fo{color:#7F7F7F}.fp{color:#D2D2D2}
</style>

<script src="fixedsys-raw.js"></script>
<script src="unicode-block.js"></script>
<script>
function paginate (a, n){
	var aa = [], ai, i = 0
	while (i < 100) {
		ai = a.slice(i * n, (i+1) * n)
		if (! ai.length) break
		aa.push(ai)
		i++
	}
	return aa.map(function(k){ return "&#" + k.join(";&#") + ";" }).join("<br>")
}
colors = "eijln"
var lastColor = "a"
function choice(a){ return a[(Math.random()*a.length)|0] }
requestAnimationFrame(function(){
	var ranges = unicode_blocks.findGroups(fixedsys_characters)
	console.log(ranges)
	ranges.forEach(function(row){
		var r = document.createElement("div")
		var html = ""
		html = "<u>" + row[2] + ": " + row[0].toString(16) + " .. " + row[1].toString(16) + "</u>"
		html += "<br>"
		html += "<br>" + paginate(row[3], 32)
		html += "<br>"
		html += "<br>"
		r.innerHTML = html
		while (1) {
			var color = choice(colors)
			if (color != lastColor) {
				lastColor = color
				break
			}
		}
		r.className = "f" + lastColor
		document.body.appendChild(r)
	})
})

window.onmouseup = function(){
	var s = window.getSelection().toString()
	console.log(s.charCodeAt(0), s.charCodeAt(s.length-1))
}
</script>