From d36e90dfc7a9dca391fe543d97635c19c2736a06 Mon Sep 17 00:00:00 2001 From: Idrees Hassan Date: Sun, 26 Oct 2025 23:42:50 -0400 Subject: [PATCH] Allow bird to land on sticky notes --- dist/birb.js | 9 ++++++--- dist/birb.user.js | 11 +++++++---- manifest.json | 2 +- src/application.js | 7 +++++-- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/dist/birb.js b/dist/birb.js index 3c7b178..359d9a5 100644 --- a/dist/birb.js +++ b/dist/birb.js @@ -1606,7 +1606,7 @@ insertModal(`${birdBirb()} Mode`, message); }), 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"); @@ -2263,7 +2263,7 @@ if (frozen) { return; } - const elements = document.querySelectorAll("img, video"); + const elements = document.querySelectorAll("img, video, .birb-sticky-note"); const inWindow = Array.from(elements).filter((img) => { const rect = img.getBoundingClientRect(); 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() }; 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 }; } diff --git a/dist/birb.user.js b/dist/birb.user.js index 920c3ee..1aa8fb0 100644 --- a/dist/birb.user.js +++ b/dist/birb.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Pocket Bird // @namespace https://idreesinc.com -// @version 2025.10.26.552 +// @version 2025.10.26.568 // @description birb // @author Idrees // @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/birb.user.js @@ -1620,7 +1620,7 @@ insertModal(`${birdBirb()} Mode`, message); }), 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"); @@ -2277,7 +2277,7 @@ if (frozen) { return; } - const elements = document.querySelectorAll("img, video"); + const elements = document.querySelectorAll("img, video, .birb-sticky-note"); const inWindow = Array.from(elements).filter((img) => { const rect = img.getBoundingClientRect(); 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() }; 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 }; } diff --git a/manifest.json b/manifest.json index a8609f7..1487ae4 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "Pocket Bird", "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", "content_scripts": [ { diff --git a/src/application.js b/src/application.js index 552b7df..225a5cb 100644 --- a/src/application.js +++ b/src/application.js @@ -886,7 +886,7 @@ Promise.all([ if (frozen) { return; } - const elements = document.querySelectorAll("img, video"); + const elements = document.querySelectorAll("img, video, .birb-sticky-note"); const inWindow = Array.from(elements).filter((img) => { const rect = img.getBoundingClientRect(); 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() }; 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 }; }