diff --git a/css/style.css b/css/style.css index 1f3430e..035a427 100644 --- a/css/style.css +++ b/css/style.css @@ -39,6 +39,9 @@ a { #progress { margin: 16px; } +#progress.hidden { + display: none; +} /* For MD subheaders suitable for lists, menus and grids. */ .subheader { @@ -106,3 +109,18 @@ nav > .divider { .loot-member .loot-contributor__contributions { color: rgba(255, 255, 255, 0.7); } + +/* For masterlist search results. */ +code.loot-search-result { + background: white; + white-space:pre; + display:block; + overflow-x:auto; + font-family: monospace; + font-size: 1rem; + padding: 16px; + border-top: 1px rgba(0, 0, 0, 0.12) solid; +} +code.loot-search-result:first-of-type { + border-top: none; +} diff --git a/js/search.js b/js/search.js index 44cb21a..474cc06 100644 --- a/js/search.js +++ b/js/search.js @@ -55,14 +55,16 @@ function readMasterlist(err, data) { if (index != -1) { console.log("Match: " + JSON.stringify(masterlist["plugins"][index])); var code = document.createElement('code'); + code.className = 'loot-search-result'; code.textContent = ' - ' + jsyaml.safeDump(masterlist["plugins"][index]).replace(new RegExp('\n', 'g'), '\n ').trim(); resultsDiv.appendChild(code); } } } - if (!resultsDiv.firstElementChild.nextElementSibling) { - var elem = document.createElement('p'); + if (resultsDiv.children.length == 0) { + var elem = document.createElement('code'); + elem.className = 'loot-search-result'; elem.textContent = "No matching entries found."; resultsDiv.appendChild(elem); } @@ -102,9 +104,8 @@ function onSearchInit(evt) { github.repos('loot', gameButton.getAttribute('data-selected')).git.refs('heads/' + repoBranch).fetch(fetchTree); /* Clear any previous search results. */ - var progress = document.getElementById('progress'); - while (progress.nextElementSibling) { - progress.parentElement.removeChild(progress.nextElementSibling); + while (resultsDiv.children.length > 0) { + resultsDiv.removeChild(resultsDiv.firstElementChild); } console.log("Loading masterlist..."); diff --git a/search.html b/search.html index cb31ccd..a5ac024 100644 --- a/search.html +++ b/search.html @@ -4,37 +4,6 @@ title: Masterlist Search permalink: /search/ --- - -
Search for a plugin name to find matching entries in the LOOT masterlists. Partial matching is only supported for non-regex entries, so use the full plugin name to find any regex entries for it.