Allow bird to land on sticky notes

This commit is contained in:
Idrees Hassan
2025-10-26 23:42:50 -04:00
parent 0d1e63888d
commit d36e90dfc7
4 changed files with 19 additions and 10 deletions

9
dist/birb.js vendored
View File

@@ -1606,7 +1606,7 @@
insertModal(`${birdBirb()} Mode`, message); insertModal(`${birdBirb()} Mode`, message);
}), }),
new Separator(), new Separator(),
new MenuItem("2025.10.26.552", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.26.552"); }, false), new MenuItem("2025.10.26.568", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.26.568"); }, false),
]; ];
const styleElement = document.createElement("style"); const styleElement = document.createElement("style");
@@ -2263,7 +2263,7 @@
if (frozen) { if (frozen) {
return; return;
} }
const elements = document.querySelectorAll("img, video"); const elements = document.querySelectorAll("img, video, .birb-sticky-note");
const inWindow = Array.from(elements).filter((img) => { const inWindow = Array.from(elements).filter((img) => {
const rect = img.getBoundingClientRect(); const rect = img.getBoundingClientRect();
return rect.left >= 0 && rect.top >= MIN_FOCUS_ELEMENT_TOP && rect.right <= window.innerWidth && rect.top <= window.innerHeight; return rect.left >= 0 && rect.top >= MIN_FOCUS_ELEMENT_TOP && rect.right <= window.innerWidth && rect.top <= window.innerHeight;
@@ -2292,7 +2292,10 @@
focusedBounds = { left: 0, right: window.innerWidth, top: getFullWindowHeight() }; focusedBounds = { left: 0, right: window.innerWidth, top: getFullWindowHeight() };
return; return;
} }
const { left, right, top } = focusedElement.getBoundingClientRect(); let { left, right, top } = focusedElement.getBoundingClientRect();
if (focusedElement.classList.contains("birb-sticky-note")) {
top -= 4 * UI_CSS_SCALE;
}
focusedBounds = { left, right, top }; focusedBounds = { left, right, top };
} }

11
dist/birb.user.js vendored
View File

@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Pocket Bird // @name Pocket Bird
// @namespace https://idreesinc.com // @namespace https://idreesinc.com
// @version 2025.10.26.552 // @version 2025.10.26.568
// @description birb // @description birb
// @author Idrees // @author Idrees
// @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/birb.user.js // @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/birb.user.js
@@ -1620,7 +1620,7 @@
insertModal(`${birdBirb()} Mode`, message); insertModal(`${birdBirb()} Mode`, message);
}), }),
new Separator(), new Separator(),
new MenuItem("2025.10.26.552", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.26.552"); }, false), new MenuItem("2025.10.26.568", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.26.568"); }, false),
]; ];
const styleElement = document.createElement("style"); const styleElement = document.createElement("style");
@@ -2277,7 +2277,7 @@
if (frozen) { if (frozen) {
return; return;
} }
const elements = document.querySelectorAll("img, video"); const elements = document.querySelectorAll("img, video, .birb-sticky-note");
const inWindow = Array.from(elements).filter((img) => { const inWindow = Array.from(elements).filter((img) => {
const rect = img.getBoundingClientRect(); const rect = img.getBoundingClientRect();
return rect.left >= 0 && rect.top >= MIN_FOCUS_ELEMENT_TOP && rect.right <= window.innerWidth && rect.top <= window.innerHeight; return rect.left >= 0 && rect.top >= MIN_FOCUS_ELEMENT_TOP && rect.right <= window.innerWidth && rect.top <= window.innerHeight;
@@ -2306,7 +2306,10 @@
focusedBounds = { left: 0, right: window.innerWidth, top: getFullWindowHeight() }; focusedBounds = { left: 0, right: window.innerWidth, top: getFullWindowHeight() };
return; return;
} }
const { left, right, top } = focusedElement.getBoundingClientRect(); let { left, right, top } = focusedElement.getBoundingClientRect();
if (focusedElement.classList.contains("birb-sticky-note")) {
top -= 4 * UI_CSS_SCALE;
}
focusedBounds = { left, right, top }; focusedBounds = { left, right, top };
} }

View File

@@ -2,7 +2,7 @@
"manifest_version": 3, "manifest_version": 3,
"name": "Pocket Bird", "name": "Pocket Bird",
"description": "It's a bird, in your browser. What more could you want?", "description": "It's a bird, in your browser. What more could you want?",
"version": "2025.10.26.552", "version": "2025.10.26.568",
"homepage_url": "https://idreesinc.com", "homepage_url": "https://idreesinc.com",
"content_scripts": [ "content_scripts": [
{ {

View File

@@ -886,7 +886,7 @@ Promise.all([
if (frozen) { if (frozen) {
return; return;
} }
const elements = document.querySelectorAll("img, video"); const elements = document.querySelectorAll("img, video, .birb-sticky-note");
const inWindow = Array.from(elements).filter((img) => { const inWindow = Array.from(elements).filter((img) => {
const rect = img.getBoundingClientRect(); const rect = img.getBoundingClientRect();
return rect.left >= 0 && rect.top >= MIN_FOCUS_ELEMENT_TOP && rect.right <= window.innerWidth && rect.top <= window.innerHeight; return rect.left >= 0 && rect.top >= MIN_FOCUS_ELEMENT_TOP && rect.right <= window.innerWidth && rect.top <= window.innerHeight;
@@ -915,7 +915,10 @@ Promise.all([
focusedBounds = { left: 0, right: window.innerWidth, top: getFullWindowHeight() }; focusedBounds = { left: 0, right: window.innerWidth, top: getFullWindowHeight() };
return; return;
} }
const { left, right, top } = focusedElement.getBoundingClientRect(); let { left, right, top } = focusedElement.getBoundingClientRect();
if (focusedElement.classList.contains("birb-sticky-note")) {
top -= 4 * UI_CSS_SCALE;
}
focusedBounds = { left, right, top }; focusedBounds = { left, right, top };
} }