Don't let the bird land on sticky things

This commit is contained in:
Idrees Hassan
2025-10-26 21:37:01 -04:00
parent 56a999a235
commit 0d1e63888d
5 changed files with 28 additions and 10 deletions

12
dist/birb.js vendored
View File

@@ -1397,8 +1397,9 @@
} }
.birb-field-guide-description { .birb-field-guide-description {
width: calc(100% - 20px); max-width: calc(100% - 20px);
margin-left: 10px; margin-left: 10px;
margin-right: 10px;
margin-top: 5px; margin-top: 5px;
padding: 8px; padding: 8px;
padding-top: 4px; padding-top: 4px;
@@ -1605,7 +1606,7 @@
insertModal(`${birdBirb()} Mode`, message); insertModal(`${birdBirb()} Mode`, message);
}), }),
new Separator(), new Separator(),
new MenuItem("2025.10.26.538", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.26.538"); }, false), new MenuItem("2025.10.26.552", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.26.552"); }, false),
]; ];
const styleElement = document.createElement("style"); const styleElement = document.createElement("style");
@@ -2273,7 +2274,12 @@
if (largeElements.length === 0) { if (largeElements.length === 0) {
return; return;
} }
const randomElement = largeElements[Math.floor(Math.random() * largeElements.length)]; // Ensure the bird doesn't land on fixed or sticky elements
const nonFixedElements = largeElements.filter((el) => {
const style = window.getComputedStyle(el);
return style.position !== "fixed" && style.position !== "sticky";
});
const randomElement = nonFixedElements[Math.floor(Math.random() * nonFixedElements.length)];
focusedElement = randomElement; focusedElement = randomElement;
log("Focusing on element: ", focusedElement); log("Focusing on element: ", focusedElement);
updateFocusedElementBounds(); updateFocusedElementBounds();

14
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.538 // @version 2025.10.26.552
// @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
@@ -1411,8 +1411,9 @@
} }
.birb-field-guide-description { .birb-field-guide-description {
width: calc(100% - 20px); max-width: calc(100% - 20px);
margin-left: 10px; margin-left: 10px;
margin-right: 10px;
margin-top: 5px; margin-top: 5px;
padding: 8px; padding: 8px;
padding-top: 4px; padding-top: 4px;
@@ -1619,7 +1620,7 @@
insertModal(`${birdBirb()} Mode`, message); insertModal(`${birdBirb()} Mode`, message);
}), }),
new Separator(), new Separator(),
new MenuItem("2025.10.26.538", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.26.538"); }, false), new MenuItem("2025.10.26.552", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.26.552"); }, false),
]; ];
const styleElement = document.createElement("style"); const styleElement = document.createElement("style");
@@ -2287,7 +2288,12 @@
if (largeElements.length === 0) { if (largeElements.length === 0) {
return; return;
} }
const randomElement = largeElements[Math.floor(Math.random() * largeElements.length)]; // Ensure the bird doesn't land on fixed or sticky elements
const nonFixedElements = largeElements.filter((el) => {
const style = window.getComputedStyle(el);
return style.position !== "fixed" && style.position !== "sticky";
});
const randomElement = nonFixedElements[Math.floor(Math.random() * nonFixedElements.length)];
focusedElement = randomElement; focusedElement = randomElement;
log("Focusing on element: ", focusedElement); log("Focusing on element: ", focusedElement);
updateFocusedElementBounds(); updateFocusedElementBounds();

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.538", "version": "2025.10.26.552",
"homepage_url": "https://idreesinc.com", "homepage_url": "https://idreesinc.com",
"content_scripts": [ "content_scripts": [
{ {

View File

@@ -897,7 +897,12 @@ Promise.all([
if (largeElements.length === 0) { if (largeElements.length === 0) {
return; return;
} }
const randomElement = largeElements[Math.floor(Math.random() * largeElements.length)]; // Ensure the bird doesn't land on fixed or sticky elements
const nonFixedElements = largeElements.filter((el) => {
const style = window.getComputedStyle(el);
return style.position !== "fixed" && style.position !== "sticky";
});
const randomElement = nonFixedElements[Math.floor(Math.random() * nonFixedElements.length)];
focusedElement = randomElement; focusedElement = randomElement;
log("Focusing on element: ", focusedElement); log("Focusing on element: ", focusedElement);
updateFocusedElementBounds(); updateFocusedElementBounds();

View File

@@ -288,8 +288,9 @@
} }
.birb-field-guide-description { .birb-field-guide-description {
width: calc(100% - 20px); max-width: calc(100% - 20px);
margin-left: 10px; margin-left: 10px;
margin-right: 10px;
margin-top: 5px; margin-top: 5px;
padding: 8px; padding: 8px;
padding-top: 4px; padding-top: 4px;