Skip to content

Commit 2b6a9d2

Browse files
committed
tool updates
1 parent 1fff1ea commit 2b6a9d2

File tree

3 files changed

+167
-15
lines changed

3 files changed

+167
-15
lines changed

_tools/_list_codes_and_names.html

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>List codes &amp; names</title>
6+
7+
<!-- creates markup for a list of Latin characters -->
8+
9+
<script src="../../uniview/u.js"></script>
10+
<script src="../../uniview/descriptions.js"></script>
11+
<script src="../../app-conversion/conversionfunctions.js"></script>
12+
<script>
13+
14+
15+
16+
17+
18+
function makeCharsetObject () {
19+
// takes a list of characters or character sequences from Ranges and creates
20+
// an object array with each character/sequence as key and info about name & codepoint
21+
22+
// create object in memory
23+
var _charSet = new Object()
24+
25+
var blob = document.getElementById('inputArea').value
26+
27+
blob = convertjEsc2Char( blob, true )
28+
29+
charArray = blob.split('\n')
30+
31+
var out = ''
32+
for (i=0;i<charArray.length;i++) {
33+
if (charArray[i].trim() != '') {
34+
var seq = [...charArray[i]]
35+
36+
cp = ''
37+
for (j=0; j<seq.length; j++) {
38+
if (document.getElementById('ignoreHyphens').checked && seq[j] === '-') continue
39+
if (cp != '') { cp += ' ' }
40+
num = seq[j].codePointAt(0).toString(16).toUpperCase()
41+
while (num.length<4) { num = '0'+num }
42+
cp += 'U+'+num
43+
}
44+
out += cp
45+
46+
out += ': '
47+
48+
console.log(cp, seq)
49+
name = ''
50+
for (j=0; j<seq.length; j++) {
51+
if (document.getElementById('ignoreHyphens').checked && seq[j] === '-') continue
52+
uPointer = seq[j].codePointAt(0)
53+
console.log('upointer',uPointer)
54+
udata = U[uPointer].split(';')
55+
if (name != '') { name += ', ' }
56+
name += udata[1]
57+
}
58+
out += name
59+
60+
uPointer = seq[0].codePointAt(0)
61+
udata = U[uPointer].split(';')
62+
if (udata[2].substr(0,1) == 'M') {
63+
out += '\u200B'
64+
}
65+
}
66+
67+
out += '\n'
68+
}
69+
70+
console.log(out)
71+
//document.getElementById('output').value = out
72+
return out
73+
}
74+
75+
76+
</script>
77+
<style>
78+
p, input, #character, #inputArea { font-size: 200%; }
79+
</style>
80+
</head>
81+
82+
<body>
83+
<p>Make a list of names to paste to google sheets</p>
84+
<p>Copy a column of characters here:</p>
85+
<p><button onClick="document.getElementById('inputArea').value = '';">Clear input</button> &nbsp; <label style="font-size: .5em;"><input type="checkbox" id="ignoreHyphens" checked> Ignore hyphens</label></p>
86+
<p>&nbsp;
87+
<textarea dir="ltr" id="inputArea" style="width: 90%; height: 200px;"></textarea></p>
88+
89+
<p><button type="submit" onClick="document.getElementById('output').value = makeCharsetObject(document.getElementById('inputArea').value); document.getElementById('output').select(); return false;">Create lists!</button></p>
90+
91+
<p>&nbsp;
92+
<textarea id="output" style="width: 90%; height: 600px;"></textarea></p>
93+
94+
</body>
95+
</html>

_tools/_make_set.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Make set</title>
6+
7+
<!-- creates markup for a list of Latin characters -->
8+
9+
<script type="text/javascript" src="../../uniview/u.js"></script>
10+
<script type="text/javascript" src="../../uniview/descriptions.js"></script>
11+
<script type="text/javascript">
12+
13+
14+
15+
function makeCharsetObject () {
16+
// takes a list of characters or character sequences from Google sheet and makes a javascript set
17+
18+
charArray = document.getElementById('inputArea').value.split('\n')
19+
20+
var out = 'var consonants = new Set(['
21+
for (i=0;i<charArray.length;i++) {
22+
if (charArray[i].trim() != '') out += "'"+charArray[i].trim()+"', "
23+
}
24+
25+
out += '])'
26+
27+
return out
28+
}
29+
30+
31+
</script>
32+
<style>
33+
p, input, #character, #inputArea { font-size: 200%; }
34+
</style>
35+
</head>
36+
37+
<body>
38+
<p>Turn a column of characters into a JS set</p>
39+
<p>Copy a column of characters here:</p>
40+
<p><button onClick="document.getElementById('inputArea').value = '';">Clear input</button></p>
41+
<p>&nbsp;
42+
<textarea dir="ltr" id="inputArea" style="width: 90%; height: 200px;"></textarea></p>
43+
44+
<p><button type="submit" onClick="document.getElementById('output').value = makeCharsetObject(document.getElementById('inputArea').value); document.getElementById('output').select(); return false;">Create set!</button></p>
45+
46+
<p>&nbsp;
47+
<textarea id="output" style="width: 90%; height: 600px;"></textarea></p>
48+
49+
</body>
50+
</html>

_tools/hint-maker-code.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
function generateCode () {
22
var lines = document.getElementById('in').value.split("\n")
33
// '56F': ['587','576'],
4-
out = ''
4+
var out = ''
55
for (var l=0;l<lines.length;l++) { // for each line
6-
chars = lines[l].trim().split(' ')
7-
if (lines[l] === '') continue
8-
out += "'"; // print the trigger character
9-
for (i=0;i<chars[0].length;i++) {
10-
out += chars[0].codePointAt(i).toString(16).toUpperCase()
11-
}
12-
out += "': ["
13-
for (c=1;c<chars.length;c++) { // for each remaining character on the line
14-
out += "'"
15-
for (j=0;j<chars[c].length;j++) { // print that character
16-
out += chars[c].codePointAt(j).toString(16).toUpperCase()
6+
line = lines[l].replace(/\s+/g,' ').trim()
7+
if (line === '') continue
8+
chars = line.split(' ')
9+
10+
for (q=0;q<chars.length;q++){
11+
firstItem = chars.shift()
12+
chars.push(firstItem)
13+
14+
out += "'"; // print the trigger character
15+
for (let i=0;i<chars[0].length;i++) {
16+
out += chars[0].codePointAt(i).toString(16).toUpperCase()
17+
}
18+
out += "': ["
19+
for (let c=1;c<chars.length;c++) { // for each remaining character on the line
20+
out += "'"
21+
for (j=0;j<chars[c].length;j++) { // print that character
22+
out += chars[c].codePointAt(j).toString(16).toUpperCase()
23+
}
24+
out += "'"
25+
if (c<chars.length-1) { out += ", " }
1726
}
18-
out += "'"
19-
if (c<chars.length-1) { out += ", " }
27+
out += "],\n"
2028
}
21-
out += "],\n"
2229
}
2330
document.getElementById('out').value = out
2431
}

0 commit comments

Comments
 (0)