vomebook commited on
Commit
2012b45
·
verified ·
1 Parent(s): 3ef444d

Upload 2 files

Browse files
Files changed (2) hide show
  1. static/app.js +21 -0
  2. static/style.css +4 -0
static/app.js CHANGED
@@ -34,6 +34,19 @@ let facetRetryTimer = null;
34
  let progressTimer = null;
35
  let searchRequestSeq = 0;
36
  let searchAbortController = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  function escapeHTML(value) {
39
  return String(value ?? "").replace(/[&<>"']/g, (ch) => ({
@@ -582,6 +595,12 @@ function resetFilters() {
582
  }
583
 
584
  function attachEvents() {
 
 
 
 
 
 
585
  DOM.searchForm.addEventListener("submit", (event) => {
586
  event.preventDefault();
587
  STATE.q = DOM.searchInput.value.trim();
@@ -793,6 +812,8 @@ function cacheDom() {
793
  }
794
 
795
  function init() {
 
 
796
  cacheDom();
797
  STATE.isDark = localStorage.getItem("theme") !== "light";
798
  const savedMobileMode = localStorage.getItem("mobileMode");
 
34
  let progressTimer = null;
35
  let searchRequestSeq = 0;
36
  let searchAbortController = null;
37
+ let firefoxViewportTimer = null;
38
+
39
+ function updateFirefoxHeight() {
40
+ const viewport = window.visualViewport;
41
+ if (!document.body.classList.contains("firefox") || !viewport || Math.abs(viewport.scale - 1) > 0.01) return;
42
+ document.documentElement.style.setProperty("--firefox-height", `${Math.round(viewport.height)}px`);
43
+ }
44
+
45
+ function scheduleFirefoxHeight() {
46
+ clearTimeout(firefoxViewportTimer);
47
+ updateFirefoxHeight();
48
+ firefoxViewportTimer = setTimeout(updateFirefoxHeight, 200);
49
+ }
50
 
51
  function escapeHTML(value) {
52
  return String(value ?? "").replace(/[&<>"']/g, (ch) => ({
 
595
  }
596
 
597
  function attachEvents() {
598
+ if (document.body.classList.contains("firefox")) {
599
+ window.addEventListener("resize", scheduleFirefoxHeight);
600
+ window.addEventListener("orientationchange", scheduleFirefoxHeight);
601
+ window.visualViewport?.addEventListener("resize", scheduleFirefoxHeight);
602
+ window.visualViewport?.addEventListener("scroll", scheduleFirefoxHeight);
603
+ }
604
  DOM.searchForm.addEventListener("submit", (event) => {
605
  event.preventDefault();
606
  STATE.q = DOM.searchInput.value.trim();
 
812
  }
813
 
814
  function init() {
815
+ document.body.classList.toggle("firefox", /Firefox\//.test(navigator.userAgent));
816
+ updateFirefoxHeight();
817
  cacheDom();
818
  STATE.isDark = localStorage.getItem("theme") !== "light";
819
  const savedMobileMode = localStorage.getItem("mobileMode");
static/style.css CHANGED
@@ -103,6 +103,10 @@ body {
103
  -moz-osx-font-smoothing: grayscale;
104
  }
105
 
 
 
 
 
106
  :focus-visible {
107
  outline: 2px solid var(--primary);
108
  outline-offset: 2px;
 
103
  -moz-osx-font-smoothing: grayscale;
104
  }
105
 
106
+ body.firefox {
107
+ height: var(--firefox-height, 100dvh);
108
+ }
109
+
110
  :focus-visible {
111
  outline: 2px solid var(--primary);
112
  outline-offset: 2px;