mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 19:59:38 +00:00
Update rendered sticky notes when URL changes
This commit is contained in:
21
birb.js
21
birb.js
@@ -958,14 +958,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
|
// Render all sticky notes
|
||||||
for (let stickyNote of stickyNotes) {
|
for (let stickyNote of stickyNotes) {
|
||||||
if (isStickyNoteApplicable(stickyNote)) {
|
if (isStickyNoteApplicable(stickyNote)) {
|
||||||
renderStickyNote(stickyNote);
|
renderStickyNote(stickyNote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(update, 1000 / 60);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
|||||||
2
build.js
2
build.js
@@ -24,7 +24,7 @@ const userScriptHeader =
|
|||||||
`// ==UserScript==
|
`// ==UserScript==
|
||||||
// @name Browser Bird
|
// @name Browser Bird
|
||||||
// @namespace https://idreesinc.com
|
// @namespace https://idreesinc.com
|
||||||
// @version 2025-08-28
|
// @version 2025-08-28-1
|
||||||
// @description birb
|
// @description birb
|
||||||
// @author Idrees
|
// @author Idrees
|
||||||
// @downloadURL https://github.com/IdreesInc/Browser-Bird/raw/refs/heads/main/dist/birb.user.js
|
// @downloadURL https://github.com/IdreesInc/Browser-Bird/raw/refs/heads/main/dist/birb.user.js
|
||||||
|
|||||||
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
|
// Render all sticky notes
|
||||||
for (let stickyNote of stickyNotes) {
|
for (let stickyNote of stickyNotes) {
|
||||||
if (isStickyNoteApplicable(stickyNote)) {
|
if (isStickyNoteApplicable(stickyNote)) {
|
||||||
renderStickyNote(stickyNote);
|
renderStickyNote(stickyNote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(update, 1000 / 60);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
|||||||
23
dist/birb.user.js
vendored
23
dist/birb.user.js
vendored
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Browser Bird
|
// @name Browser Bird
|
||||||
// @namespace https://idreesinc.com
|
// @namespace https://idreesinc.com
|
||||||
// @version 2025-08-28
|
// @version 2025-08-28-1
|
||||||
// @description birb
|
// @description birb
|
||||||
// @author Idrees
|
// @author Idrees
|
||||||
// @downloadURL https://github.com/IdreesInc/Browser-Bird/raw/refs/heads/main/dist/birb.user.js
|
// @downloadURL https://github.com/IdreesInc/Browser-Bird/raw/refs/heads/main/dist/birb.user.js
|
||||||
@@ -1292,14 +1292,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
|
// Render all sticky notes
|
||||||
for (let stickyNote of stickyNotes) {
|
for (let stickyNote of stickyNotes) {
|
||||||
if (isStickyNoteApplicable(stickyNote)) {
|
if (isStickyNoteApplicable(stickyNote)) {
|
||||||
renderStickyNote(stickyNote);
|
renderStickyNote(stickyNote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(update, 1000 / 60);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
|||||||
Reference in New Issue
Block a user