diff options
author | Tom Smeding <tom@tomsmeding.com> | 2021-06-01 12:50:24 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2021-06-01 12:50:24 +0200 |
commit | e2e858c4f24346278238c8a138fdd137c7367dc6 (patch) | |
tree | 1d567d368c69f504654a14b384e10fc377380d13 /modules | |
parent | d8d7bcf494a6c1c5619ca552bd7105243b659f65 (diff) |
unicode: We're finding codepoints, not characters
Diffstat (limited to 'modules')
-rw-r--r-- | modules/unicode/index.html | 17 | ||||
-rw-r--r-- | modules/unicode/unicode.js | 6 |
2 files changed, 11 insertions, 12 deletions
diff --git a/modules/unicode/index.html b/modules/unicode/index.html index 1832fe8..7b385ef 100644 --- a/modules/unicode/index.html +++ b/modules/unicode/index.html @@ -63,12 +63,12 @@ function handleResponse(json, input) { document.getElementById("index_input").innerHTML = input; elem = document.getElementById("index"); elem.innerHTML = ""; - elem.appendChild(makeCharacterDiv(json["index"])); + elem.appendChild(makeCodepointDiv(json["index"])); } else if (!index_container.classList.contains("invisible")) { index_container.classList.add("invisible"); } - var keys = ["chars", "search"]; + var keys = ["codepoints", "search"]; for (var i = 0; i < keys.length; i++) { document.getElementById(keys[i] + "_num").innerHTML = "(" + json[keys[i]].length + ")"; @@ -76,19 +76,18 @@ function handleResponse(json, input) { elem = document.getElementById(keys[i]); elem.innerHTML = ""; for (var j = 0; j < json[keys[i]].length; j++) { - elem.appendChild(makeCharacterDiv(json[keys[i]][j])); + elem.appendChild(makeCodepointDiv(json[keys[i]][j])); } } } -function makeCharacterDiv(row) { +function makeCodepointDiv(row) { var div = document.createElement("div"); - div.classList.add("character"); - populateCharacter(div, row); + populateCodepoint(div, row); return div; } -function populateCharacter(div, row) { +function populateCodepoint(div, row) { var span = document.createElement("span"); span.setAttribute("style", "display: inline-block; width: 7em; font-weight: bold;"); span.appendChild(document.createTextNode("U+" + row[0])); @@ -128,8 +127,8 @@ window.addEventListener("load", function() { <div id="index" class="table"></div> </div> - <h3>Characters <span id="chars_num"></span></h3> - <div id="chars" class="table"></div> + <h3>Codepoints <span id="codepoints_num"></span></h3> + <div id="codepoints" class="table"></div> <h3>Found in descriptions <span id="search_num"></span></h3> <div id="search" class="table"></div> diff --git a/modules/unicode/unicode.js b/modules/unicode/unicode.js index 4a7f75a..113ea83 100644 --- a/modules/unicode/unicode.js +++ b/modules/unicode/unicode.js @@ -113,15 +113,15 @@ module.exports = function (app, io, moddir) { }); app.get("/unicode/lookup/:query", (req, res) => { - const chars = []; + const codepoints = []; for (let codepoint of req.params.query) { codepoint = codepoint.codePointAt(0); - chars.push(lookupCode(codepoint)); + codepoints.push(lookupCode(codepoint)); } res.json({ index: recogniseIndex(req.params.query) || undefined, - chars: chars, + codepoints: codepoints, search: searchDescription(req.params.query), }); }); |