From 29d26068ad98e865272198090375fca57e5cf156 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 12 Jun 2023 23:07:05 +0200 Subject: unicode: Recognise multiple index literals in input --- modules/unicode/index.html | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'modules/unicode/index.html') diff --git a/modules/unicode/index.html b/modules/unicode/index.html index 924f86e..8738b6f 100644 --- a/modules/unicode/index.html +++ b/modules/unicode/index.html @@ -49,7 +49,7 @@ function do_lookup(override) { xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200) { - handleResponse(JSON.parse(xhr.responseText), input); + handleResponse(JSON.parse(xhr.responseText)); } else { alert("Request failed: " + xhr.responseText); } @@ -62,7 +62,7 @@ function do_lookup(override) { xhr.send(); } -function handleResponse(json, input) { +function handleResponse(json) { var elem; /* elem = document.getElementById("json"); @@ -70,12 +70,20 @@ function handleResponse(json, input) { elem.appendChild(document.createTextNode(JSON.stringify(json))); */ var index_container = document.getElementById("index_container"); - if ("index" in json) { + if (json.indices.length > 0) { index_container.classList.remove("invisible"); - document.getElementById("index_input").innerHTML = input; - elem = document.getElementById("index"); - elem.innerHTML = ""; - elem.appendChild(makeCodepointDiv(json["index"])); + setTableRows("indices", json.indices); + if (json.indices.length > 1) { + document.getElementById("indices_concatenated_container").classList.remove("invisible"); + elem = document.getElementById("indices_concatenated"); + elem.innerHTML = ""; + var str = ""; + for (var i = 0; i < json.indices.length; i++) + str += String.fromCodePoint(parseInt(json.indices[i][0], 16)); + elem.appendChild(document.createTextNode(str)); + } else { + document.getElementById("indices_concatenated_container").classList.add("invisible"); + } } else if (!index_container.classList.contains("invisible")) { index_container.classList.add("invisible"); } @@ -141,15 +149,19 @@ window.addEventListener("load", function() {
- +

Codepoints

-- cgit v1.2.3-70-g09d2