From a94cc92c520c636c172400e827e3318ed6278533 Mon Sep 17 00:00:00 2001 From: Idrees Hassan Date: Tue, 16 Sep 2025 17:10:08 -0400 Subject: [PATCH] Add extension manifest --- birb.js | 6 ++++-- build.js | 14 +++++++++++++- dist/birb.js | 6 ++++-- dist/birb.user.js | 8 +++++--- manifest.json | 29 +++++++++++++++++++++++++++++ package.json | 2 +- 6 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 manifest.json diff --git a/birb.js b/birb.js index 4a416e9..c204cc6 100644 --- a/birb.js +++ b/birb.js @@ -704,7 +704,9 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI } function isTestEnvironment() { - return window.location.hostname === "127.0.0.1"; + return window.location.hostname === "127.0.0.1" + || window.location.hostname === "localhost" + || window.location.hostname.startsWith("192.168."); } function load() { @@ -958,7 +960,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI lastActionTimestamp = Date.now(); // Can't keep up with scrolling on mobile devices so fly down instead if (isMobile()) { - focusOnGround(); + // focusOnGround(); } }); diff --git a/build.js b/build.js index e255782..57688c4 100644 --- a/build.js +++ b/build.js @@ -20,11 +20,23 @@ const spriteSheets = [ const STYLESHEET_PATH = "./stylesheet.css"; const STYLESHEET_KEY = "___STYLESHEET___"; +let version = "0.0.0"; +// Try to read version from manifest.json +try { + const manifest = JSON.parse(readFileSync('manifest.json', 'utf8')); + if (manifest.version) { + version = manifest.version; + } +} catch (e) { + console.error("Could not read version from manifest.json"); + throw e; +} + const userScriptHeader = `// ==UserScript== // @name Browser Bird // @namespace https://idreesinc.com -// @version 2025-09-15-01 +// @version ${version} // @description birb // @author Idrees // @downloadURL https://github.com/IdreesInc/Browser-Bird/raw/refs/heads/main/dist/birb.user.js diff --git a/dist/birb.js b/dist/birb.js index 9c192d2..0023209 100644 --- a/dist/birb.js +++ b/dist/birb.js @@ -1043,7 +1043,9 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI } function isTestEnvironment() { - return window.location.hostname === "127.0.0.1"; + return window.location.hostname === "127.0.0.1" + || window.location.hostname === "localhost" + || window.location.hostname.startsWith("192.168."); } function load() { @@ -1297,7 +1299,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI lastActionTimestamp = Date.now(); // Can't keep up with scrolling on mobile devices so fly down instead if (isMobile()) { - focusOnGround(); + // focusOnGround(); } }); diff --git a/dist/birb.user.js b/dist/birb.user.js index 37cd231..96e37a8 100644 --- a/dist/birb.user.js +++ b/dist/birb.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Browser Bird // @namespace https://idreesinc.com -// @version 2025-09-15-01 +// @version 2025.9.16.1 // @description birb // @author Idrees // @downloadURL https://github.com/IdreesInc/Browser-Bird/raw/refs/heads/main/dist/birb.user.js @@ -1057,7 +1057,9 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI } function isTestEnvironment() { - return window.location.hostname === "127.0.0.1"; + return window.location.hostname === "127.0.0.1" + || window.location.hostname === "localhost" + || window.location.hostname.startsWith("192.168."); } function load() { @@ -1311,7 +1313,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI lastActionTimestamp = Date.now(); // Can't keep up with scrolling on mobile devices so fly down instead if (isMobile()) { - focusOnGround(); + // focusOnGround(); } }); diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..9399648 --- /dev/null +++ b/manifest.json @@ -0,0 +1,29 @@ +{ + "manifest_version": 3, + "name": "Browser Bird", + "description": "It's a bird, in your browser. What more could you want?", + "version": "2025.9.16.1", + "homepage_url": "https://idreesinc.com", + "content_scripts": [ + { + "matches": [""], + "js": ["birb.js"] + } + ], + "permissions": [ + "storage", + "activeTab" + ], + "web_accessible_resources": [ + { + "resources": ["images/*"], + "matches": [""] + } + ], + "browser_specific_settings": { + "gecko": { + "id": "birb@idreesinc.com" + } + } +} + \ No newline at end of file diff --git a/package.json b/package.json index 4b4f18e..2e7ed7a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "type": "module", "scripts": { "build": "node build.js", - "dev": "nodemon --watch birb.js --watch stylesheet.css --watch build.js --exec \"npm run build\"" + "dev": "nodemon --watch birb.js --watch stylesheet.css --watch build.js --watch manifest.json --exec \"npm run build\"" }, "devDependencies": { "nodemon": "^3.1.10"