From 53c751526cade6439c9b82d91fff22665d2db420 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 25 Apr 2024 20:15:46 +0100 Subject: [PATCH] add page change log --- scoresaber-utils.user.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scoresaber-utils.user.js b/scoresaber-utils.user.js index 288b52d..ca01e50 100644 --- a/scoresaber-utils.user.js +++ b/scoresaber-utils.user.js @@ -7,8 +7,8 @@ // @match https://scoresaber.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=scoresaber.com // @license MIT -// @updateURL https://git.fascinated.cc/Fascinated/ScoreSaberUtils-Backend/raw/branch/master/scoresaber-utils.user.js -// @downloadURL https://git.fascinated.cc/Fascinated/ScoreSaberUtils-Backend/raw/branch/master/scoresaber-utils.user.js +// @updateURL https://git.fascinated.cc/Fascinated/ScoreSaberUtils-Script/raw/branch/master/scoresaber-utils.user.js +// @downloadURL https://git.fascinated.cc/Fascinated/ScoreSaberUtils-Script/raw/branch/master/scoresaber-utils.user.js // @run-at document-end // ==/UserScript== @@ -111,13 +111,15 @@ async function loadPlayerData(path) { // Watch for URL changes let previousUrl = ""; -const observer = new MutationObserver(function (mutations) { +const observer = new MutationObserver(() => { const currentUrl = location.pathname; // Get the current URL without parameters - if (currentUrl !== previousUrl) { - previousUrl = currentUrl; - - loadPlayerData(currentUrl); + if (currentUrl == previousUrl) { + return; } + + console.log("Switching Page:", currentUrl); + previousUrl = currentUrl; + loadPlayerData(currentUrl); }); const config = { subtree: true, childList: true }; observer.observe(document, config);