|
| 1 | +<!doctype html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | +<meta charset="UTF-8"> |
| 5 | +<title>List codes & 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> <label style="font-size: .5em;"><input type="checkbox" id="ignoreHyphens" checked> Ignore hyphens</label></p> |
| 86 | +<p> |
| 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> |
| 92 | +<textarea id="output" style="width: 90%; height: 600px;"></textarea></p> |
| 93 | + |
| 94 | +</body> |
| 95 | +</html> |
0 commit comments