diff options
Diffstat (limited to 'modules/unicode/index.html')
-rw-r--r-- | modules/unicode/index.html | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/modules/unicode/index.html b/modules/unicode/index.html index 7b385ef..cb2beaa 100644 --- a/modules/unicode/index.html +++ b/modules/unicode/index.html @@ -18,6 +18,14 @@ body { .invisible { display: none; } +#notfound_container { + margin-top: 15px; +} +code { + background-color: #eee; + padding: 3px; + border-radius: 5px; +} </style> <script> function do_lookup(override) { @@ -68,16 +76,25 @@ function handleResponse(json, input) { index_container.classList.add("invisible"); } - var keys = ["codepoints", "search"]; + setTableRows("codepoints", json.codepoints); + setTableRows("search", json.search); + + if (json.notfound.length > 0) { + document.getElementById("notfound_container").classList.remove("invisible"); + document.getElementById("notfound").innerText = json.notfound; + } else { + document.getElementById("notfound_container").classList.add("invisible"); + document.getElementById("notfound").innerText = ""; + } +} - for (var i = 0; i < keys.length; i++) { - document.getElementById(keys[i] + "_num").innerHTML = "(" + json[keys[i]].length + ")"; +function setTableRows(key, rows) { + document.getElementById(key + "_num").innerHTML = "(" + rows.length + ")"; - elem = document.getElementById(keys[i]); - elem.innerHTML = ""; - for (var j = 0; j < json[keys[i]].length; j++) { - elem.appendChild(makeCodepointDiv(json[keys[i]][j])); - } + var elem = document.getElementById(key); + elem.innerHTML = ""; + for (var j = 0; j < rows.length; j++) { + elem.appendChild(makeCodepointDiv(rows[j])); } } @@ -122,6 +139,10 @@ window.addEventListener("load", function() { <!-- <pre id="json"></pre><br> --> + <div id="notfound_container" class="invisible"> + These were not found, perhaps the server needs to be update its unicode table? <code id="notfound"></code> + </div> + <div id="index_container" class="invisible"> <h3>Codepoint <span id="index_input"></span></h3> <div id="index" class="table"></div> |