mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 12:17:22 +00:00
Update rendered sticky notes when URL changes
This commit is contained in:
21
dist/birb.js
vendored
21
dist/birb.js
vendored
@@ -1278,14 +1278,31 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
||||
}
|
||||
});
|
||||
|
||||
drawStickyNotes();
|
||||
|
||||
let lastUrl = (window.location.href ?? "").split("?")[0];
|
||||
setInterval(() => {
|
||||
const currentUrl = (window.location.href ?? "").split("?")[0];
|
||||
if (currentUrl !== lastUrl) {
|
||||
log("URL changed, updating sticky notes");
|
||||
lastUrl = currentUrl;
|
||||
drawStickyNotes();
|
||||
}
|
||||
}, 500);
|
||||
|
||||
setInterval(update, 1000 / 60);
|
||||
}
|
||||
|
||||
function drawStickyNotes() {
|
||||
// Remove all existing sticky notes
|
||||
const existingNotes = document.querySelectorAll(".birb-sticky-note");
|
||||
existingNotes.forEach(note => note.remove());
|
||||
// Render all sticky notes
|
||||
for (let stickyNote of stickyNotes) {
|
||||
if (isStickyNoteApplicable(stickyNote)) {
|
||||
renderStickyNote(stickyNote);
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(update, 1000 / 60);
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
Reference in New Issue
Block a user