add page change log
This commit is contained in:
parent
5ba33056b6
commit
53c751526c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user