]> littlesong.place Git - littlesongplace.git/commitdiff
Scroll to top when loading new page
authorChris Fulljames <christianfulljames@gmail.com>
Tue, 4 Mar 2025 00:58:06 +0000 (19:58 -0500)
committerChris Fulljames <christianfulljames@gmail.com>
Tue, 4 Mar 2025 00:58:06 +0000 (19:58 -0500)
static/nav.js
todo.txt

index 101e3e5e1bf356b29655f3817458a2327ab8f64d..4926f83aeb119d47bf77878bd288cf1c44f3825a 100644 (file)
@@ -72,9 +72,8 @@ async function handleAjaxResponse(response) {
         // Got an error; redirect to the error page
         window.location.href = response.url;
     }
-    // Update URL in browser window, minus request-type field
+    // Update URL in browser window
     var url = new URL(response.url);
-    url.searchParams.delete("request-type");
 
     // Get page content from response
     var text = await response.text();
@@ -124,6 +123,9 @@ function updatePageState(data) {
     // Trigger event to signal new page has loaded
     var event = new Event("DOMContentLoaded");
     document.dispatchEvent(event);
+
+    // Scroll to top of page
+    window.scrollTo(0, 0);
 }
 
 async function checkForNewActivity() {
index 4b6fc789c2b08ec18558fdb8f15ec1428531c71c..492a1db1986ae8a1c38e3f1736049472175495ef 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -1,4 +1,3 @@
-- Scroll to top of new page
 - Add to playlist in background
 - Pinned profile playlists