diff options
-rw-r--r-- | modules/unicode/index.html | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/modules/unicode/index.html b/modules/unicode/index.html index 23492cd..1065575 100644 --- a/modules/unicode/index.html +++ b/modules/unicode/index.html @@ -17,9 +17,18 @@ body { } </style> <script> -function do_lookup() { - var input = document.getElementById("input").value; - if (input.length == 0) return; +function do_lookup(override) { + var input; + if (override != null) { + if (override.length == 0) return; + input = override; + document.getElementById("input").value = override; + } else { + input = document.getElementById("input").value; + if (input.length == 0) return; + } + + location.hash = input; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { @@ -39,8 +48,6 @@ function do_lookup() { } function handleResponse(json) { - console.log(json); - var elem; /* elem = document.getElementById("json"); @@ -81,6 +88,10 @@ function populateCharacter(div, row) { } window.addEventListener("load", function() { + if (location.hash.length > 0) { + do_lookup(decodeURIComponent(location.hash.slice(1))); + } + document.getElementById("input").focus(); }); </script> |