diff --git a/birb.js b/birb.js index 894ed58..a44e937 100644 --- a/birb.js +++ b/birb.js @@ -912,6 +912,13 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI return; } + // Preload font + const MONOCRAFT_SRC = "https://cdn.jsdelivr.net/gh/idreesinc/Monocraft@99b32ab40612ff2533a69d8f14bd8b3d9e604456/dist/Monocraft.otf"; + const fontLink = document.createElement("link"); + fontLink.rel = "stylesheet"; + fontLink.href = `url(${MONOCRAFT_SRC}) format("opentype")`; + document.head.appendChild(fontLink); + load(); styleElement.innerHTML = STYLESHEET; @@ -1301,6 +1308,9 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI onClick(closeButton, func); } document.addEventListener("keydown", (e) => { + if (closeButton && !document.body.contains(closeButton)) { + return; + } if (e.key === "Escape") { func(); } @@ -1450,7 +1460,9 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI } content.innerHTML = ""; for (const item of menuItems) { - content.appendChild(makeMenuItem(item)); + if (!item.isDebug || debugMode) { + content.appendChild(makeMenuItem(item)); + } } updateMenuLocation(menu); } diff --git a/build.js b/build.js index 7b676b5..283cf94 100644 --- a/build.js +++ b/build.js @@ -24,7 +24,7 @@ const userScriptHeader = `// ==UserScript== // @name Browser Bird // @namespace https://idreesinc.com -// @version 2025-08-28-1 +// @version 2025-09-09-01 // @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 2170680..894a7e5 100644 --- a/dist/birb.js +++ b/dist/birb.js @@ -50,12 +50,7 @@ const DEFAULT_SETTINGS = { let userSettings = {}; -const STYLESHEET = `@font-face { - font-family: Monocraft; - src: url("https://cdn.jsdelivr.net/gh/idreesinc/Monocraft@99b32ab40612ff2533a69d8f14bd8b3d9e604456/dist/Monocraft.otf"); -} - -:root { +const STYLESHEET = `:root { --border-size: 2px; --neg-border-size: calc(var(--border-size) * -1); --double-border-size: calc(var(--border-size) * 2); @@ -1232,6 +1227,13 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI return; } + // Preload font + const MONOCRAFT_SRC = "https://cdn.jsdelivr.net/gh/idreesinc/Monocraft@99b32ab40612ff2533a69d8f14bd8b3d9e604456/dist/Monocraft.otf"; + const fontLink = document.createElement("link"); + fontLink.rel = "stylesheet"; + fontLink.href = `url(${MONOCRAFT_SRC}) format("opentype")`; + document.head.appendChild(fontLink); + load(); styleElement.innerHTML = STYLESHEET; @@ -1621,6 +1623,9 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI onClick(closeButton, func); } document.addEventListener("keydown", (e) => { + if (closeButton && !document.body.contains(closeButton)) { + return; + } if (e.key === "Escape") { func(); } @@ -1770,7 +1775,9 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI } content.innerHTML = ""; for (const item of menuItems) { - content.appendChild(makeMenuItem(item)); + if (!item.isDebug || debugMode) { + content.appendChild(makeMenuItem(item)); + } } updateMenuLocation(menu); } diff --git a/dist/birb.user.js b/dist/birb.user.js index 982a264..0f508cc 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-08-28-1 +// @version 2025-09-09-01 // @description birb // @author Idrees // @downloadURL https://github.com/IdreesInc/Browser-Bird/raw/refs/heads/main/dist/birb.user.js @@ -64,12 +64,7 @@ const DEFAULT_SETTINGS = { let userSettings = {}; -const STYLESHEET = `@font-face { - font-family: Monocraft; - src: url("https://cdn.jsdelivr.net/gh/idreesinc/Monocraft@99b32ab40612ff2533a69d8f14bd8b3d9e604456/dist/Monocraft.otf"); -} - -:root { +const STYLESHEET = `:root { --border-size: 2px; --neg-border-size: calc(var(--border-size) * -1); --double-border-size: calc(var(--border-size) * 2); @@ -1246,6 +1241,13 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI return; } + // Preload font + const MONOCRAFT_SRC = "https://cdn.jsdelivr.net/gh/idreesinc/Monocraft@99b32ab40612ff2533a69d8f14bd8b3d9e604456/dist/Monocraft.otf"; + const fontLink = document.createElement("link"); + fontLink.rel = "stylesheet"; + fontLink.href = `url(${MONOCRAFT_SRC}) format("opentype")`; + document.head.appendChild(fontLink); + load(); styleElement.innerHTML = STYLESHEET; @@ -1635,6 +1637,9 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI onClick(closeButton, func); } document.addEventListener("keydown", (e) => { + if (closeButton && !document.body.contains(closeButton)) { + return; + } if (e.key === "Escape") { func(); } @@ -1784,7 +1789,9 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI } content.innerHTML = ""; for (const item of menuItems) { - content.appendChild(makeMenuItem(item)); + if (!item.isDebug || debugMode) { + content.appendChild(makeMenuItem(item)); + } } updateMenuLocation(menu); } diff --git a/stylesheet.css b/stylesheet.css index 4360045..21a9e95 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -1,8 +1,3 @@ -@font-face { - font-family: Monocraft; - src: url("https://cdn.jsdelivr.net/gh/idreesinc/Monocraft@99b32ab40612ff2533a69d8f14bd8b3d9e604456/dist/Monocraft.otf"); -} - :root { --border-size: 2px; --neg-border-size: calc(var(--border-size) * -1);