glossary: remove glossary search scripts

This was added in 1a6874fcb4, but later
got disabled, and now no longer is in use.

We can restore these scripts or re-implement if we ever decide
to bring back similar functionality.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-10-07 16:54:02 +02:00
parent f8da9eb085
commit 3f13c2d20b
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 1 additions and 65 deletions

View File

@ -17,8 +17,6 @@ To get a specific entry while writing a page in the docs, enter Liquid text
like so:
{{ site.data.glossary["aufs"] }}
-->
<span id="glossaryMatch"></span>
<span id="topicMatch"></span>
<table>
<thead>
<tr><th>Term</th><th>Definition</th></tr>

View File

@ -1,6 +1,6 @@
var glossary = [
{%- for entry in site.data.glossary -%}
{"term": {{ entry[0] | jsonify }}, "def": {{ entry[1] | markdownify | replace:'href="#','href="/glossary/?term=' | jsonify }}}
{"term": {{ entry[0] | jsonify }}, "def": {{ entry[1] | markdownify | jsonify }}}
{%- unless forloop.last -%},{%- endunless -%}
{%- endfor -%}
]

View File

@ -191,66 +191,4 @@ function queryString()
return vars;
}
function renderTopicsByTagTable(tagToLookup,divID)
{
var matchingPages = new Array();
for (i=0;i<pages.length;i++)
{
thisPage = pages[i];
if (thisPage.keywords)
{
var keywordArray = thisPage.keywords.toString().split(",");
for (n=0;n<keywordArray.length;n++)
{
if (keywordArray[n].trim().toLowerCase()==tagToLookup.toLowerCase())
{
matchingPages.push(i); // log the id of the page w/matching keyword
}
}
}
}
var pagesOutput = new Array();
if (matchingPages.length > 0)
{
pagesOutput.push("<h2>Pages tagged with: " + tagToLookup + "</h2>");
pagesOutput.push("<table><thead><tr><td>Page</td><td>Description</td></tr></thead><tbody>");
for(i=0;i<matchingPages.length;i++) {
thisPage = pages[matchingPages[i]];
pagesOutput.push("<tr><td><a href='" + thisPage.url + "'>" + thisPage.title + "</a></td><td>" + thisPage.description + "</td></tr>");
}
pagesOutput.push("</tbody></table>");
}
$("#" + divID).html(pagesOutput.join(""));
}
var tagToLookup;
function renderTagsPage()
{
if(window.location.pathname.indexOf("/glossary/")>-1 || window.location.pathname.indexOf("/search/")>-1)
{
if (window.location.pathname.indexOf("/glossary/")>-1)
{
// Get ?term=<value>
tagToLookup = decodeURI(queryString().term);
$("#keyword").html(tagToLookup);
}
else
{
// Get ?q=<value>
tagToLookup = decodeURI(queryString().q);
}
// Get the term and definition
for (i=0;i<glossary.length;i++)
{
if (glossary[i].term.toLowerCase()==tagToLookup.toLowerCase())
{
var glossaryOutput = glossary[i].def;
}
}
if (glossaryOutput) {
$("#glossaryMatch").html("<h2>Definition of: " + tagToLookup + "</h2>" + glossaryOutput);
}
renderTopicsByTagTable(tagToLookup,"topicMatch",true);
}
}
$(document).ready(bindSearch);