diff --git a/cheat-sheet.js b/cheat-sheet.js index 602d89a23..72a505875 100644 --- a/cheat-sheet.js +++ b/cheat-sheet.js @@ -4,6 +4,23 @@ document.addEventListener('DOMContentLoaded', function () { const elementGlyphCheatSheet = document.getElementById('glyphCheatSheet'); const maxSearchResults = 250; + // Find the value of one query string + function querySt(ji) { + const hu = window.location.search.substring(1); + const gy = hu.split('&'); + for (i = 0; i < gy.length; i++) { + ft = gy[i].split('='); + if (ft[0] == ji) { + return ft[1]; + } + } + } + // Jump to search for provided query key, e.g. https://www.nerdfonts.com/cheat-sheet?q=cpu + const fieldName = querySt('q'); + if (fieldName != null) { + elementGlyphSearch.value = fieldName; + } + // Storage for not-yet-rendered search results. More results will are rendered when scrolled to the bottom. let remainingSearchResults = [];