mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-26 04:07:24 +00:00
Add toggle to enable/disable sound
This commit is contained in:
BIN
dist/extension.zip
vendored
BIN
dist/extension.zip
vendored
Binary file not shown.
20
dist/extension/birb.js
vendored
20
dist/extension/birb.js
vendored
@@ -1209,7 +1209,7 @@
|
|||||||
|
|
||||||
class MenuItem {
|
class MenuItem {
|
||||||
/**
|
/**
|
||||||
* @param {string} text
|
* @param {string|(() => string)} text
|
||||||
* @param {() => void} action
|
* @param {() => void} action
|
||||||
* @param {boolean} [removeMenu]
|
* @param {boolean} [removeMenu]
|
||||||
*/
|
*/
|
||||||
@@ -1258,7 +1258,7 @@
|
|||||||
if (item instanceof Separator) {
|
if (item instanceof Separator) {
|
||||||
return makeElement("birb-window-separator");
|
return makeElement("birb-window-separator");
|
||||||
}
|
}
|
||||||
let menuItem = makeElement("birb-menu-item", item.text);
|
let menuItem = makeElement("birb-menu-item", typeof item.text === "function" ? item.text() : item.text);
|
||||||
onClick(menuItem, () => {
|
onClick(menuItem, () => {
|
||||||
if (item.removeMenu) {
|
if (item.removeMenu) {
|
||||||
removeMenuCallback();
|
removeMenuCallback();
|
||||||
@@ -1365,7 +1365,8 @@
|
|||||||
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
||||||
*/
|
*/
|
||||||
const DEFAULT_SETTINGS = {
|
const DEFAULT_SETTINGS = {
|
||||||
birbMode: false
|
birbMode: false,
|
||||||
|
soundEnabled: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rendering constants
|
// Rendering constants
|
||||||
@@ -1578,6 +1579,7 @@
|
|||||||
|
|
||||||
.birb-menu-item {
|
.birb-menu-item {
|
||||||
width: calc(100% - var(--birb-double-border-size));
|
width: calc(100% - var(--birb-double-border-size));
|
||||||
|
white-space: nowrap;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
@@ -1850,7 +1852,11 @@
|
|||||||
const settingsItems = [
|
const settingsItems = [
|
||||||
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem("Toggle Birb Mode", () => {
|
new MenuItem(() => `${userSettings.soundEnabled ? "Disable" : "Enable"} Sound`, () => {
|
||||||
|
userSettings.soundEnabled = !userSettings.soundEnabled;
|
||||||
|
save();
|
||||||
|
}),
|
||||||
|
new MenuItem(() => `Toggle ${birdBirb(true)} Mode`, () => {
|
||||||
userSettings.birbMode = !userSettings.birbMode;
|
userSettings.birbMode = !userSettings.birbMode;
|
||||||
save();
|
save();
|
||||||
const message = makeElement("birb-message-content");
|
const message = makeElement("birb-message-content");
|
||||||
@@ -1969,8 +1975,8 @@
|
|||||||
/**
|
/**
|
||||||
* Bird or birb, you decide
|
* Bird or birb, you decide
|
||||||
*/
|
*/
|
||||||
function birdBirb() {
|
function birdBirb(invert = false) {
|
||||||
return settings().birbMode ? "Birb" : "Bird";
|
return settings().birbMode !== invert ? "Birb" : "Bird";
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
@@ -2559,7 +2565,9 @@
|
|||||||
|
|
||||||
function pet() {
|
function pet() {
|
||||||
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||||
|
if (settings().soundEnabled) {
|
||||||
birdsong.chirp();
|
birdsong.chirp();
|
||||||
|
}
|
||||||
birb.setAnimation(Animations.HEART);
|
birb.setAnimation(Animations.HEART);
|
||||||
lastPetTimestamp = Date.now();
|
lastPetTimestamp = Date.now();
|
||||||
}
|
}
|
||||||
|
|||||||
20
dist/obsidian/main.js
vendored
20
dist/obsidian/main.js
vendored
@@ -1252,7 +1252,7 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
|
|
||||||
class MenuItem {
|
class MenuItem {
|
||||||
/**
|
/**
|
||||||
* @param {string} text
|
* @param {string|(() => string)} text
|
||||||
* @param {() => void} action
|
* @param {() => void} action
|
||||||
* @param {boolean} [removeMenu]
|
* @param {boolean} [removeMenu]
|
||||||
*/
|
*/
|
||||||
@@ -1301,7 +1301,7 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
if (item instanceof Separator) {
|
if (item instanceof Separator) {
|
||||||
return makeElement("birb-window-separator");
|
return makeElement("birb-window-separator");
|
||||||
}
|
}
|
||||||
let menuItem = makeElement("birb-menu-item", item.text);
|
let menuItem = makeElement("birb-menu-item", typeof item.text === "function" ? item.text() : item.text);
|
||||||
onClick(menuItem, () => {
|
onClick(menuItem, () => {
|
||||||
if (item.removeMenu) {
|
if (item.removeMenu) {
|
||||||
removeMenuCallback();
|
removeMenuCallback();
|
||||||
@@ -1408,7 +1408,8 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
||||||
*/
|
*/
|
||||||
const DEFAULT_SETTINGS = {
|
const DEFAULT_SETTINGS = {
|
||||||
birbMode: false
|
birbMode: false,
|
||||||
|
soundEnabled: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rendering constants
|
// Rendering constants
|
||||||
@@ -1621,6 +1622,7 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
|
|
||||||
.birb-menu-item {
|
.birb-menu-item {
|
||||||
width: calc(100% - var(--birb-double-border-size));
|
width: calc(100% - var(--birb-double-border-size));
|
||||||
|
white-space: nowrap;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
@@ -1893,7 +1895,11 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
const settingsItems = [
|
const settingsItems = [
|
||||||
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem("Toggle Birb Mode", () => {
|
new MenuItem(() => `${userSettings.soundEnabled ? "Disable" : "Enable"} Sound`, () => {
|
||||||
|
userSettings.soundEnabled = !userSettings.soundEnabled;
|
||||||
|
save();
|
||||||
|
}),
|
||||||
|
new MenuItem(() => `Toggle ${birdBirb(true)} Mode`, () => {
|
||||||
userSettings.birbMode = !userSettings.birbMode;
|
userSettings.birbMode = !userSettings.birbMode;
|
||||||
save();
|
save();
|
||||||
const message = makeElement("birb-message-content");
|
const message = makeElement("birb-message-content");
|
||||||
@@ -2012,8 +2018,8 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
/**
|
/**
|
||||||
* Bird or birb, you decide
|
* Bird or birb, you decide
|
||||||
*/
|
*/
|
||||||
function birdBirb() {
|
function birdBirb(invert = false) {
|
||||||
return settings().birbMode ? "Birb" : "Bird";
|
return settings().birbMode !== invert ? "Birb" : "Bird";
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
@@ -2602,7 +2608,9 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
|
|
||||||
function pet() {
|
function pet() {
|
||||||
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||||
|
if (settings().soundEnabled) {
|
||||||
birdsong.chirp();
|
birdsong.chirp();
|
||||||
|
}
|
||||||
birb.setAnimation(Animations.HEART);
|
birb.setAnimation(Animations.HEART);
|
||||||
lastPetTimestamp = Date.now();
|
lastPetTimestamp = Date.now();
|
||||||
}
|
}
|
||||||
|
|||||||
20
dist/userscript/birb.user.js
vendored
20
dist/userscript/birb.user.js
vendored
@@ -1214,7 +1214,7 @@
|
|||||||
|
|
||||||
class MenuItem {
|
class MenuItem {
|
||||||
/**
|
/**
|
||||||
* @param {string} text
|
* @param {string|(() => string)} text
|
||||||
* @param {() => void} action
|
* @param {() => void} action
|
||||||
* @param {boolean} [removeMenu]
|
* @param {boolean} [removeMenu]
|
||||||
*/
|
*/
|
||||||
@@ -1263,7 +1263,7 @@
|
|||||||
if (item instanceof Separator) {
|
if (item instanceof Separator) {
|
||||||
return makeElement("birb-window-separator");
|
return makeElement("birb-window-separator");
|
||||||
}
|
}
|
||||||
let menuItem = makeElement("birb-menu-item", item.text);
|
let menuItem = makeElement("birb-menu-item", typeof item.text === "function" ? item.text() : item.text);
|
||||||
onClick(menuItem, () => {
|
onClick(menuItem, () => {
|
||||||
if (item.removeMenu) {
|
if (item.removeMenu) {
|
||||||
removeMenuCallback();
|
removeMenuCallback();
|
||||||
@@ -1370,7 +1370,8 @@
|
|||||||
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
||||||
*/
|
*/
|
||||||
const DEFAULT_SETTINGS = {
|
const DEFAULT_SETTINGS = {
|
||||||
birbMode: false
|
birbMode: false,
|
||||||
|
soundEnabled: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rendering constants
|
// Rendering constants
|
||||||
@@ -1583,6 +1584,7 @@
|
|||||||
|
|
||||||
.birb-menu-item {
|
.birb-menu-item {
|
||||||
width: calc(100% - var(--birb-double-border-size));
|
width: calc(100% - var(--birb-double-border-size));
|
||||||
|
white-space: nowrap;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
@@ -1855,7 +1857,11 @@
|
|||||||
const settingsItems = [
|
const settingsItems = [
|
||||||
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem("Toggle Birb Mode", () => {
|
new MenuItem(() => `${userSettings.soundEnabled ? "Disable" : "Enable"} Sound`, () => {
|
||||||
|
userSettings.soundEnabled = !userSettings.soundEnabled;
|
||||||
|
save();
|
||||||
|
}),
|
||||||
|
new MenuItem(() => `Toggle ${birdBirb(true)} Mode`, () => {
|
||||||
userSettings.birbMode = !userSettings.birbMode;
|
userSettings.birbMode = !userSettings.birbMode;
|
||||||
save();
|
save();
|
||||||
const message = makeElement("birb-message-content");
|
const message = makeElement("birb-message-content");
|
||||||
@@ -1974,8 +1980,8 @@
|
|||||||
/**
|
/**
|
||||||
* Bird or birb, you decide
|
* Bird or birb, you decide
|
||||||
*/
|
*/
|
||||||
function birdBirb() {
|
function birdBirb(invert = false) {
|
||||||
return settings().birbMode ? "Birb" : "Bird";
|
return settings().birbMode !== invert ? "Birb" : "Bird";
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
@@ -2564,7 +2570,9 @@
|
|||||||
|
|
||||||
function pet() {
|
function pet() {
|
||||||
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||||
|
if (settings().soundEnabled) {
|
||||||
birdsong.chirp();
|
birdsong.chirp();
|
||||||
|
}
|
||||||
birb.setAnimation(Animations.HEART);
|
birb.setAnimation(Animations.HEART);
|
||||||
lastPetTimestamp = Date.now();
|
lastPetTimestamp = Date.now();
|
||||||
}
|
}
|
||||||
|
|||||||
20
dist/web/birb.embed.js
vendored
20
dist/web/birb.embed.js
vendored
@@ -1194,7 +1194,7 @@
|
|||||||
|
|
||||||
class MenuItem {
|
class MenuItem {
|
||||||
/**
|
/**
|
||||||
* @param {string} text
|
* @param {string|(() => string)} text
|
||||||
* @param {() => void} action
|
* @param {() => void} action
|
||||||
* @param {boolean} [removeMenu]
|
* @param {boolean} [removeMenu]
|
||||||
*/
|
*/
|
||||||
@@ -1243,7 +1243,7 @@
|
|||||||
if (item instanceof Separator) {
|
if (item instanceof Separator) {
|
||||||
return makeElement("birb-window-separator");
|
return makeElement("birb-window-separator");
|
||||||
}
|
}
|
||||||
let menuItem = makeElement("birb-menu-item", item.text);
|
let menuItem = makeElement("birb-menu-item", typeof item.text === "function" ? item.text() : item.text);
|
||||||
onClick(menuItem, () => {
|
onClick(menuItem, () => {
|
||||||
if (item.removeMenu) {
|
if (item.removeMenu) {
|
||||||
removeMenuCallback();
|
removeMenuCallback();
|
||||||
@@ -1350,7 +1350,8 @@
|
|||||||
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
||||||
*/
|
*/
|
||||||
const DEFAULT_SETTINGS = {
|
const DEFAULT_SETTINGS = {
|
||||||
birbMode: false
|
birbMode: false,
|
||||||
|
soundEnabled: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rendering constants
|
// Rendering constants
|
||||||
@@ -1563,6 +1564,7 @@
|
|||||||
|
|
||||||
.birb-menu-item {
|
.birb-menu-item {
|
||||||
width: calc(100% - var(--birb-double-border-size));
|
width: calc(100% - var(--birb-double-border-size));
|
||||||
|
white-space: nowrap;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
@@ -1835,7 +1837,11 @@
|
|||||||
const settingsItems = [
|
const settingsItems = [
|
||||||
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem("Toggle Birb Mode", () => {
|
new MenuItem(() => `${userSettings.soundEnabled ? "Disable" : "Enable"} Sound`, () => {
|
||||||
|
userSettings.soundEnabled = !userSettings.soundEnabled;
|
||||||
|
save();
|
||||||
|
}),
|
||||||
|
new MenuItem(() => `Toggle ${birdBirb(true)} Mode`, () => {
|
||||||
userSettings.birbMode = !userSettings.birbMode;
|
userSettings.birbMode = !userSettings.birbMode;
|
||||||
save();
|
save();
|
||||||
const message = makeElement("birb-message-content");
|
const message = makeElement("birb-message-content");
|
||||||
@@ -1954,8 +1960,8 @@
|
|||||||
/**
|
/**
|
||||||
* Bird or birb, you decide
|
* Bird or birb, you decide
|
||||||
*/
|
*/
|
||||||
function birdBirb() {
|
function birdBirb(invert = false) {
|
||||||
return settings().birbMode ? "Birb" : "Bird";
|
return settings().birbMode !== invert ? "Birb" : "Bird";
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
@@ -2544,7 +2550,9 @@
|
|||||||
|
|
||||||
function pet() {
|
function pet() {
|
||||||
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||||
|
if (settings().soundEnabled) {
|
||||||
birdsong.chirp();
|
birdsong.chirp();
|
||||||
|
}
|
||||||
birb.setAnimation(Animations.HEART);
|
birb.setAnimation(Animations.HEART);
|
||||||
lastPetTimestamp = Date.now();
|
lastPetTimestamp = Date.now();
|
||||||
}
|
}
|
||||||
|
|||||||
20
dist/web/birb.js
vendored
20
dist/web/birb.js
vendored
@@ -1194,7 +1194,7 @@
|
|||||||
|
|
||||||
class MenuItem {
|
class MenuItem {
|
||||||
/**
|
/**
|
||||||
* @param {string} text
|
* @param {string|(() => string)} text
|
||||||
* @param {() => void} action
|
* @param {() => void} action
|
||||||
* @param {boolean} [removeMenu]
|
* @param {boolean} [removeMenu]
|
||||||
*/
|
*/
|
||||||
@@ -1243,7 +1243,7 @@
|
|||||||
if (item instanceof Separator) {
|
if (item instanceof Separator) {
|
||||||
return makeElement("birb-window-separator");
|
return makeElement("birb-window-separator");
|
||||||
}
|
}
|
||||||
let menuItem = makeElement("birb-menu-item", item.text);
|
let menuItem = makeElement("birb-menu-item", typeof item.text === "function" ? item.text() : item.text);
|
||||||
onClick(menuItem, () => {
|
onClick(menuItem, () => {
|
||||||
if (item.removeMenu) {
|
if (item.removeMenu) {
|
||||||
removeMenuCallback();
|
removeMenuCallback();
|
||||||
@@ -1350,7 +1350,8 @@
|
|||||||
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
||||||
*/
|
*/
|
||||||
const DEFAULT_SETTINGS = {
|
const DEFAULT_SETTINGS = {
|
||||||
birbMode: false
|
birbMode: false,
|
||||||
|
soundEnabled: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rendering constants
|
// Rendering constants
|
||||||
@@ -1563,6 +1564,7 @@
|
|||||||
|
|
||||||
.birb-menu-item {
|
.birb-menu-item {
|
||||||
width: calc(100% - var(--birb-double-border-size));
|
width: calc(100% - var(--birb-double-border-size));
|
||||||
|
white-space: nowrap;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
@@ -1835,7 +1837,11 @@
|
|||||||
const settingsItems = [
|
const settingsItems = [
|
||||||
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem("Toggle Birb Mode", () => {
|
new MenuItem(() => `${userSettings.soundEnabled ? "Disable" : "Enable"} Sound`, () => {
|
||||||
|
userSettings.soundEnabled = !userSettings.soundEnabled;
|
||||||
|
save();
|
||||||
|
}),
|
||||||
|
new MenuItem(() => `Toggle ${birdBirb(true)} Mode`, () => {
|
||||||
userSettings.birbMode = !userSettings.birbMode;
|
userSettings.birbMode = !userSettings.birbMode;
|
||||||
save();
|
save();
|
||||||
const message = makeElement("birb-message-content");
|
const message = makeElement("birb-message-content");
|
||||||
@@ -1954,8 +1960,8 @@
|
|||||||
/**
|
/**
|
||||||
* Bird or birb, you decide
|
* Bird or birb, you decide
|
||||||
*/
|
*/
|
||||||
function birdBirb() {
|
function birdBirb(invert = false) {
|
||||||
return settings().birbMode ? "Birb" : "Bird";
|
return settings().birbMode !== invert ? "Birb" : "Bird";
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
@@ -2544,7 +2550,9 @@
|
|||||||
|
|
||||||
function pet() {
|
function pet() {
|
||||||
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||||
|
if (settings().soundEnabled) {
|
||||||
birdsong.chirp();
|
birdsong.chirp();
|
||||||
|
}
|
||||||
birb.setAnimation(Animations.HEART);
|
birb.setAnimation(Animations.HEART);
|
||||||
lastPetTimestamp = Date.now();
|
lastPetTimestamp = Date.now();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ import {
|
|||||||
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
* @typedef {typeof DEFAULT_SETTINGS} Settings
|
||||||
*/
|
*/
|
||||||
const DEFAULT_SETTINGS = {
|
const DEFAULT_SETTINGS = {
|
||||||
birbMode: false
|
birbMode: false,
|
||||||
|
soundEnabled: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rendering constants
|
// Rendering constants
|
||||||
@@ -177,7 +178,11 @@ function startApplication(birbPixels, featherPixels) {
|
|||||||
const settingsItems = [
|
const settingsItems = [
|
||||||
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
new MenuItem("Go Back", () => switchMenuItems(menuItems, updateMenuLocation), false),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem("Toggle Birb Mode", () => {
|
new MenuItem(() => `${userSettings.soundEnabled ? "Disable" : "Enable"} Sound`, () => {
|
||||||
|
userSettings.soundEnabled = !userSettings.soundEnabled;
|
||||||
|
save();
|
||||||
|
}),
|
||||||
|
new MenuItem(() => `Toggle ${birdBirb(true)} Mode`, () => {
|
||||||
userSettings.birbMode = !userSettings.birbMode;
|
userSettings.birbMode = !userSettings.birbMode;
|
||||||
save();
|
save();
|
||||||
const message = makeElement("birb-message-content");
|
const message = makeElement("birb-message-content");
|
||||||
@@ -296,8 +301,8 @@ function startApplication(birbPixels, featherPixels) {
|
|||||||
/**
|
/**
|
||||||
* Bird or birb, you decide
|
* Bird or birb, you decide
|
||||||
*/
|
*/
|
||||||
function birdBirb() {
|
function birdBirb(invert = false) {
|
||||||
return settings().birbMode ? "Birb" : "Bird";
|
return settings().birbMode !== invert ? "Birb" : "Bird";
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
@@ -900,7 +905,9 @@ function startApplication(birbPixels, featherPixels) {
|
|||||||
|
|
||||||
function pet() {
|
function pet() {
|
||||||
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
if (currentState === States.IDLE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||||
|
if (settings().soundEnabled) {
|
||||||
birdsong.chirp();
|
birdsong.chirp();
|
||||||
|
}
|
||||||
birb.setAnimation(Animations.HEART);
|
birb.setAnimation(Animations.HEART);
|
||||||
lastPetTimestamp = Date.now();
|
lastPetTimestamp = Date.now();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const MENU_EXIT_ID = "birb-menu-exit";
|
|||||||
|
|
||||||
export class MenuItem {
|
export class MenuItem {
|
||||||
/**
|
/**
|
||||||
* @param {string} text
|
* @param {string|(() => string)} text
|
||||||
* @param {() => void} action
|
* @param {() => void} action
|
||||||
* @param {boolean} [removeMenu]
|
* @param {boolean} [removeMenu]
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +61,7 @@ function makeMenuItem(item, removeMenuCallback) {
|
|||||||
if (item instanceof Separator) {
|
if (item instanceof Separator) {
|
||||||
return makeElement("birb-window-separator");
|
return makeElement("birb-window-separator");
|
||||||
}
|
}
|
||||||
let menuItem = makeElement("birb-menu-item", item.text);
|
let menuItem = makeElement("birb-menu-item", typeof item.text === "function" ? item.text() : item.text);
|
||||||
onClick(menuItem, () => {
|
onClick(menuItem, () => {
|
||||||
if (item.removeMenu) {
|
if (item.removeMenu) {
|
||||||
removeMenuCallback();
|
removeMenuCallback();
|
||||||
|
|||||||
@@ -198,6 +198,7 @@
|
|||||||
|
|
||||||
.birb-menu-item {
|
.birb-menu-item {
|
||||||
width: calc(100% - var(--birb-double-border-size));
|
width: calc(100% - var(--birb-double-border-size));
|
||||||
|
white-space: nowrap;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
|
|||||||
Reference in New Issue
Block a user