From 3379330f9b2872b8e7ca56f3e70872ec3986a39a Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 20 Jan 2018 12:25:31 +0100 Subject: [PATCH] Add an exact match list on the documentation --- docs/res/core.html | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/docs/res/core.html b/docs/res/core.html index 8c8bc9d8..368a04d5 100644 --- a/docs/res/core.html +++ b/docs/res/core.html @@ -19,6 +19,11 @@ placeholder="Search for requests and types…" />
+
Methods (0)
    @@ -179,6 +184,10 @@ typesCount = document.getElementById("typesCount"); constructorsList = document.getElementById("constructorsList"); constructorsCount = document.getElementById("constructorsCount"); +// Exact match +exactMatch = document.getElementById("exactMatch"); +exactList = document.getElementById("exactList"); + try { requests = [{request_names}]; types = [{type_names}]; @@ -225,7 +234,9 @@ function buildList(countSpan, resultList, foundElements) { result += ''; } - countSpan.innerHTML = "" + foundElements[0].length; + if (countSpan) { + countSpan.innerHTML = "" + foundElements[0].length; + } resultList.innerHTML = result; } @@ -245,6 +256,26 @@ function updateSearch() { buildList(methodsCount, methodsList, foundRequests); buildList(typesCount, typesList, foundTypes); buildList(constructorsCount, constructorsList, foundConstructors); + + // Now look for exact matches + var original = requests.concat(constructors); + var originalu = requestsu.concat(constructorsu); + var destination = []; + var destinationu = []; + + for (var i = 0; i < original.length; ++i) { + if (original[i].toLowerCase().replace("request", "") == query) { + destination.push(original[i]); + destinationu.push(originalu[i]); + } + } + + if (destination.length == 0) { + exactMatch.style.display = "none"; + } else { + exactMatch.style.display = ""; + buildList(null, exactList, [destination, destinationu]); + } } else { contentDiv.style.display = ""; searchDiv.style.display = "none";