fix changing pages on the script
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
This commit is contained in:
parent
80331ba972
commit
e7ee0ef4af
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name ScoreSaber Utils
|
// @name ScoreSaber Utils
|
||||||
// @namespace https://ssu.fascinated.cc
|
// @namespace https://ssu.fascinated.cc
|
||||||
// @version 1.0.2
|
// @version 1.0.3
|
||||||
// @description Useful additions to ScoreSaber!
|
// @description Useful additions to ScoreSaber!
|
||||||
// @author Fascinated
|
// @author Fascinated
|
||||||
// @match https://scoresaber.com/*
|
// @match https://scoresaber.com/*
|
||||||
@ -112,10 +112,13 @@ async function loadPlayerData(path) {
|
|||||||
loadPlayerData();
|
loadPlayerData();
|
||||||
|
|
||||||
// Watch for URL changes
|
// Watch for URL changes
|
||||||
document.onreadystatechange = () => {
|
let previousUrl = "";
|
||||||
if (document.readyState === "complete") {
|
const observer = new MutationObserver(function (mutations) {
|
||||||
window.navigation.addEventListener("navigate", (event) => {
|
if (location.href !== previousUrl) {
|
||||||
loadPlayerData(event.destination.url);
|
previousUrl = location.href;
|
||||||
});
|
|
||||||
|
loadPlayerData(location.pathname);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
const config = { subtree: true, childList: true };
|
||||||
|
observer.observe(document, config);
|
||||||
|
Loading…
Reference in New Issue
Block a user