const SIZE = 40; let mimeMap = []; let tagMap = []; let mimeTree; let tagTree; let searchBar = document.getElementById("searchBar"); let pathBar = document.getElementById("pathBar"); let lastDoc = null; let reachedEnd = false; let docCount = 0; let coolingDown = false; let searchBusy = true; let selectedIndices = []; let mode; if (localStorage.getItem("mode") === null) { mode = "grid"; } else { mode = localStorage.getItem("mode") } function showEsError() { $.toast({ heading: "Elasticsearch connection error", text: "sist2 web module encountered an error while connecting " + "to Elasticsearch. See server logs for more information.", stack: false, bgColor: "#a94442", textColor: "#f2dede", position: 'bottom-right', hideAfter: false }); } jQuery["jsonPost"] = function (url, data) { return jQuery.ajax({ url: url, type: "post", data: JSON.stringify(data), contentType: "application/json" }).fail(err => { showEsError(); console.log(err); }); }; window.onload = () => { $("#theme").on("click", () => { if (!document.cookie.includes("sist")) { document.cookie = "sist=dark"; } else { document.cookie = "sist=; Max-Age=-99999999;"; } window.location.reload(); }) }; function toggleFuzzy() { searchDebounced(); } $.jsonPost("i").then(resp => { const urlIndices = (new URLSearchParams(location.search)).get("i"); resp["indices"].forEach(idx => { const opt = $("