diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2021-02-19 17:10:51 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2021-02-24 16:46:47 -0500 |
commit | 02ca32ae0a5bc290918d2b2a3288e385b9cc6b11 (patch) | |
tree | 06379785e8a0165a7deb981c2eba362894820634 /src/ext_depends/tinyendian/doc/search.js | |
parent | build from static source-tree pre fetch depends (diff) |
external & build dependences in src tree
- external & build dependences boost licensed
- ext_depends (external depends)
- D-YAML
- tinyendian
- d2sqlite3
- imageformats
- build_depends
- dub2nix
Diffstat (limited to 'src/ext_depends/tinyendian/doc/search.js')
-rw-r--r-- | src/ext_depends/tinyendian/doc/search.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/ext_depends/tinyendian/doc/search.js b/src/ext_depends/tinyendian/doc/search.js new file mode 100644 index 0000000..89a7b15 --- /dev/null +++ b/src/ext_depends/tinyendian/doc/search.js @@ -0,0 +1,59 @@ +"use strict"; +var items = [ +{"tinyendian" : "tinyendian.html"}, +{"tinyendian.UTFEncoding" : "tinyendian/UTFEncoding.html"}, +{"tinyendian.swapByteOrder" : "tinyendian.html#swapByteOrder"}, +{"tinyendian.fixUTFByteOrder" : "tinyendian.html#fixUTFByteOrder"}, +]; +function search(str) { + var re = new RegExp(str.toLowerCase()); + var ret = {}; + for (var i = 0; i < items.length; i++) { + var k = Object.keys(items[i])[0]; + if (re.test(k.toLowerCase())) + ret[k] = items[i][k]; + } + return ret; +} + +function searchSubmit(value, event) { + console.log("searchSubmit"); + var resultTable = document.getElementById("results"); + while (resultTable.firstChild) + resultTable.removeChild(resultTable.firstChild); + if (value === "" || event.keyCode == 27) { + resultTable.style.display = "none"; + return; + } + resultTable.style.display = "block"; + var results = search(value); + var keys = Object.keys(results); + if (keys.length === 0) { + var row = resultTable.insertRow(); + var td = document.createElement("td"); + var node = document.createTextNode("No results"); + td.appendChild(node); + row.appendChild(td); + return; + } + for (var i = 0; i < keys.length; i++) { + var k = keys[i]; + var v = results[keys[i]]; + var link = document.createElement("a"); + link.href = v; + link.textContent = k; + link.attributes.id = "link" + i; + var row = resultTable.insertRow(); + row.appendChild(link); + } +} + +function hideSearchResults(event) { + if (event.keyCode != 27) + return; + var resultTable = document.getElementById("results"); + while (resultTable.firstChild) + resultTable.removeChild(resultTable.firstChild); + resultTable.style.display = "none"; +} + |