diff --git a/app/static/css/style.css b/app/static/css/style.css index 58a7b1b..b528de3 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -4,7 +4,7 @@ html, body { - overscroll-behavior-y: contain; + overscroll-behavior-y: none; } html, diff --git a/app/static/js/refresher.js b/app/static/js/refresher.js index 9e03bd5..cedd402 100644 --- a/app/static/js/refresher.js +++ b/app/static/js/refresher.js @@ -2,7 +2,7 @@ "use strict"; -const mainContentsEl = document.getElementById("main-contents"); +const headerEl = document.getElementById("dank-header"); let _startY = 0; async function simulateRefreshAction() { @@ -51,11 +51,14 @@ document.body.addEventListener( const y = e.touches[0].pageY; if ( document.scrollingElement.scrollTop === 0 && - y > _startY + 150 && + y <= + headerEl.getBoundingClientRect().y + + headerEl.getBoundingClientRect().height && + y > _startY + 50 && !document.body.classList.contains("refreshing") ) { await simulateRefreshAction(); - await updateMainContent(window.location.pathname); + await Router.updateMainContent(window.location.pathname); } }, { passive: true }, diff --git a/app/static/js/router.js b/app/static/js/router.js index 537e45f..d220767 100644 --- a/app/static/js/router.js +++ b/app/static/js/router.js @@ -1,5 +1,7 @@ "use strict"; +const mainContentsEl = document.getElementById("main-contents"); + const links = [ { check: (l) => l === "/", element: document.getElementById("/") }, { check: (l) => l === "/about", element: document.getElementById("/about") }, diff --git a/app/static/js/service-worker.js b/app/static/js/service-worker.js index 2186f59..6896b3c 100644 --- a/app/static/js/service-worker.js +++ b/app/static/js/service-worker.js @@ -25,7 +25,7 @@ self.addEventListener("message", (event) => { self.addEventListener("install", async (event) => { event.waitUntil( - caches.open(CACHE).then((cache) => cache.add(offlineFallbackPage)), + caches.open(CACHE_NAME).then((cache) => cache.add(offlineFallbackPage)), ); }); @@ -33,7 +33,7 @@ self.addEventListener("fetch", (event) => { if (event.request.mode === "navigate") { event.respondWith( (async () => { - const cache = await caches.open(CACHE); + const cache = await caches.open(CACHE_NAME); const cachedResp = await cache.match(offlineFallbackPage); return cachedResp; })(), diff --git a/app/views/components/search/search_suggestions.templ b/app/views/components/search/search_suggestions.templ index bd2e4c8..61762a5 100644 --- a/app/views/components/search/search_suggestions.templ +++ b/app/views/components/search/search_suggestions.templ @@ -1,6 +1,7 @@ package search import "fmt" +import "strings" templ SearchSuggestions(suggestions []string, originalQuery string) {