1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-19 20:12:52 +02:00

cheat-sheet: Allow direct url to search result

Will be used by the Wiki for example to show the glyph-sets.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2024-04-04 18:28:55 +02:00
parent e86aed2792
commit 4fde75a4b8

View File

@ -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 = [];