Upload app.js
Browse files- static/app.js +1 -18
static/app.js
CHANGED
|
@@ -109,13 +109,6 @@ function wildcardPatternToRegExp(pattern) {
|
|
| 109 |
return new RegExp(escaped.replace(/\*/g, ".*").replace(/\?/g, "."), "i");
|
| 110 |
}
|
| 111 |
|
| 112 |
-
function matchesExactQuery(text, query) {
|
| 113 |
-
const value = String(text || "");
|
| 114 |
-
const pattern = String(query || "");
|
| 115 |
-
if (pattern.includes("*") || pattern.includes("?")) return wildcardPatternToRegExp(pattern).test(value);
|
| 116 |
-
return value.toLowerCase().includes(pattern.toLowerCase());
|
| 117 |
-
}
|
| 118 |
-
|
| 119 |
function formatSize(bytes) {
|
| 120 |
if (!bytes) return "";
|
| 121 |
if (bytes < 1024) return bytes + " B";
|
|
@@ -199,10 +192,6 @@ function restoreSizeInput(input, unitSelect, bytes) {
|
|
| 199 |
unitSelect.value = unit;
|
| 200 |
}
|
| 201 |
|
| 202 |
-
function buildPath(folder, file) {
|
| 203 |
-
return folder.length ? folder.join("/") + "/" + file : file;
|
| 204 |
-
}
|
| 205 |
-
|
| 206 |
const API = {
|
| 207 |
async getSources() {
|
| 208 |
const resp = await fetch("/api/sources");
|
|
@@ -630,12 +619,6 @@ function syncUrl(replace = true) {
|
|
| 630 |
else history.pushState(historyState, "", nextUrl);
|
| 631 |
}
|
| 632 |
|
| 633 |
-
function urlWithoutPreview(value = window.location.href) {
|
| 634 |
-
const url = new URL(value, window.location.origin);
|
| 635 |
-
url.searchParams.delete("preview");
|
| 636 |
-
return `${url.pathname}${url.searchParams.toString() ? `?${url.searchParams.toString()}` : ""}`;
|
| 637 |
-
}
|
| 638 |
-
|
| 639 |
function searchUrlKey(value = window.location.href) {
|
| 640 |
const url = new URL(value, window.location.origin);
|
| 641 |
for (const key of ["preview", "sidebar", "wide", "filters", "history"]) {
|
|
@@ -1086,7 +1069,7 @@ async function openPreview(docId, keyword, options = {}) {
|
|
| 1086 |
}
|
| 1087 |
const rawText = data.text || "";
|
| 1088 |
const shouldHighlight = keyword && rawText.length < 500000;
|
| 1089 |
-
let text =
|
| 1090 |
if (shouldHighlight) {
|
| 1091 |
text = highlightText(rawText, keyword);
|
| 1092 |
} else if (keyword && rawText.length >= 500000) {
|
|
|
|
| 109 |
return new RegExp(escaped.replace(/\*/g, ".*").replace(/\?/g, "."), "i");
|
| 110 |
}
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
function formatSize(bytes) {
|
| 113 |
if (!bytes) return "";
|
| 114 |
if (bytes < 1024) return bytes + " B";
|
|
|
|
| 192 |
unitSelect.value = unit;
|
| 193 |
}
|
| 194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
const API = {
|
| 196 |
async getSources() {
|
| 197 |
const resp = await fetch("/api/sources");
|
|
|
|
| 619 |
else history.pushState(historyState, "", nextUrl);
|
| 620 |
}
|
| 621 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
function searchUrlKey(value = window.location.href) {
|
| 623 |
const url = new URL(value, window.location.origin);
|
| 624 |
for (const key of ["preview", "sidebar", "wide", "filters", "history"]) {
|
|
|
|
| 1069 |
}
|
| 1070 |
const rawText = data.text || "";
|
| 1071 |
const shouldHighlight = keyword && rawText.length < 500000;
|
| 1072 |
+
let text = "";
|
| 1073 |
if (shouldHighlight) {
|
| 1074 |
text = highlightText(rawText, keyword);
|
| 1075 |
} else if (keyword && rawText.length >= 500000) {
|