don't load again if only page params changed
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled

This commit is contained in:
Lee 2024-04-25 20:12:16 +01:00
parent ddaa1e7c97
commit 0b5f083366

@ -1,7 +1,7 @@
// ==UserScript==
// @name ScoreSaber Utils
// @namespace https://ssu.fascinated.cc
// @version 1.0.4
// @version 1.0.5
// @description Useful additions to ScoreSaber!
// @author Fascinated
// @match https://scoresaber.com/*
@ -112,10 +112,11 @@ async function loadPlayerData(path) {
// Watch for URL changes
let previousUrl = "";
const observer = new MutationObserver(function (mutations) {
if (location.href !== previousUrl) {
previousUrl = location.href;
const currentUrl = location.pathname; // Get the current URL without parameters
if (currentUrl !== previousUrl) {
previousUrl = currentUrl;
loadPlayerData(location.pathname);
loadPlayerData(currentUrl);
}
});
const config = { subtree: true, childList: true };