diff options
| -rw-r--r-- | flake.nix | 7 | ||||
| -rw-r--r-- | serve.go | 11 | ||||
| -rw-r--r-- | src/index.html (renamed from index.html) | 0 | ||||
| -rw-r--r-- | src/main.js (renamed from main.js) | 30 | ||||
| -rw-r--r-- | src/style.css (renamed from style.css) | 4 |
5 files changed, 34 insertions, 18 deletions
@@ -21,7 +21,12 @@ pkgs = nixpkgsFor.${system}; in { - default = pkgs.mkShell { buildInputs = with pkgs; [ biome ]; }; + default = pkgs.mkShell { + buildInputs = with pkgs; [ + biome + go + ]; + }; } ); }; diff --git a/serve.go b/serve.go new file mode 100644 index 0000000..f35bb0e --- /dev/null +++ b/serve.go @@ -0,0 +1,11 @@ +package main + +import ( + "net/http" +) + +func main() { + fs := http.FileServer(http.Dir("./src")) + http.Handle("/", fs) + http.ListenAndServe(":8082", nil) +} diff --git a/index.html b/src/index.html index 5573e60..5573e60 100644 --- a/index.html +++ b/src/index.html @@ -404,7 +404,7 @@ async function search(query) { // Bangs const bangMatch = query.match(/^!(\w+)\s*(.*)/); if (bangMatch) { - const bang = "!" + bangMatch[1]; + const bang = `!${bangMatch[1]}`; const q = bangMatch[2]; const src = Object.entries(SOURCES).find(([_, s]) => s.bang === bang); if (src && q) { @@ -446,7 +446,7 @@ async function search(query) { $("stat-results").textContent = state.results.length; $("stat-sources").textContent = enabled.length; - $("stat-time").textContent = elapsed + "MS"; + $("stat-time").textContent = `${elapsed}MS`; $("results-label").textContent = `${state.results.length} RESULTS`; $("results-info").textContent = `${elapsed}MS // ${enabled.length} SOURCES`; @@ -466,7 +466,7 @@ function goHome() { // ═══════════════════════════════════════════════════════════ function showStockWidget(ticker) { const symbol = getSymbol(ticker); - const widgetId = "tv_" + Math.random().toString(36).substr(2, 9); + const widgetId = `tv_${Math.random().toString(36).substr(2, 9)}`; const isLight = document.body.classList.contains("light-mode"); resultsEl.innerHTML = ` @@ -619,7 +619,7 @@ function showLoading() { function showCalcResult(expr) { try { - const result = Function('"use strict";return (' + expr.replace(/\^/g, "**") + ")")(); + const result = Function(`"use strict";return (${expr.replace(/\^/g, "**")})`)(); resultsEl.innerHTML = `<div class="instant-box"><div class="instant-label">CALCULATOR</div><div class="instant-title" style="font-variant-numeric:tabular-nums">${esc(expr)} = ${result}</div></div>`; } catch { toast("INVALID EXPRESSION"); @@ -639,7 +639,7 @@ function setupCalc() { } else if (v === "=") { try { state.calcResult = Function( - '"use strict";return (' + state.calcExpr.replace(/\^/g, "**") + ")", + `"use strict";return (${state.calcExpr.replace(/\^/g, "**")})`, )(); } catch { state.calcResult = "ERR"; @@ -662,7 +662,7 @@ function toolUUID() { return (c === "x" ? r : (r & 0x3) | 0x8).toString(16); }); copy(uuid); - toast("UUID: " + uuid.substring(0, 13) + "..."); + toast(`UUID: ${uuid.substring(0, 13)}...`); } let timerInterval, @@ -722,14 +722,14 @@ window.formatJSON = () => { try { $("json-output").textContent = JSON.stringify(JSON.parse($("json-input").value), null, 2); } catch (e) { - $("json-output").textContent = "INVALID: " + e.message; + $("json-output").textContent = `INVALID: ${e.message}`; } }; window.minifyJSON = () => { try { $("json-output").textContent = JSON.stringify(JSON.parse($("json-input").value)); } catch (e) { - $("json-output").textContent = "INVALID: " + e.message; + $("json-output").textContent = `INVALID: ${e.message}`; } }; @@ -805,7 +805,7 @@ function toolPassword() { let pass = ""; for (let i = 0; i < 20; i++) pass += chars[Math.floor(Math.random() * chars.length)]; copy(pass); - toast("PASSWORD: " + pass.substring(0, 10) + "..."); + toast(`PASSWORD: ${pass.substring(0, 10)}...`); } function toolLoremIpsum() { @@ -938,16 +938,16 @@ function highlight(text, query) { return result; } function fmt(n) { - if (n >= 1000000) return (n / 1000000).toFixed(1) + "M"; - if (n >= 1000) return (n / 1000).toFixed(1) + "K"; + if (n >= 1000000) return `${(n / 1000000).toFixed(1)}M`; + if (n >= 1000) return `${(n / 1000).toFixed(1)}K`; return n?.toString() || "0"; } function timeAgo(ts) { const s = Math.floor((Date.now() - ts) / 1000); if (s < 60) return "NOW"; - if (s < 3600) return Math.floor(s / 60) + "M"; - if (s < 86400) return Math.floor(s / 3600) + "H"; - return Math.floor(s / 86400) + "D"; + if (s < 3600) return `${Math.floor(s / 60)}M`; + if (s < 86400) return `${Math.floor(s / 3600)}H`; + return `${Math.floor(s / 86400)}D`; } function copy(text) { navigator.clipboard.writeText(text); @@ -965,7 +965,7 @@ function searchFor(q) { search(q); } function insertBang(bang) { - searchInput.value = bang + " "; + searchInput.value = `${bang} `; searchInput.focus(); } diff --git a/style.css b/src/style.css index 6f3f24e..c051103 100644 --- a/style.css +++ b/src/style.css @@ -280,8 +280,8 @@ a { } .sidebar-left, .sidebar-right { - border: none !important; - border-bottom: var(--border) !important; + border: none; + border-bottom: var(--border); } } |
