From 4d1254b9d4ba58e024b0c0d5783443c969a81de1 Mon Sep 17 00:00:00 2001 From: Idrees Hassan Date: Sat, 13 Sep 2025 16:57:16 -0400 Subject: [PATCH] Format document --- birb.js | 27 +++++++++++++-------------- dist/birb.js | 27 +++++++++++++-------------- dist/birb.user.js | 27 +++++++++++++-------------- 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/birb.js b/birb.js index 83979dd..805c332 100644 --- a/birb.js +++ b/birb.js @@ -58,7 +58,7 @@ class Layer { * @param {string[][]} pixels * @param {string} [tag] */ - constructor(pixels, tag="default") { + constructor(pixels, tag = "default") { this.pixels = pixels; this.tag = tag; } @@ -109,7 +109,7 @@ class Frame { * @param {string} [tag] * @returns {string[][]} */ - getPixels(tag="default") { + getPixels(tag = "default") { return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"]; } @@ -221,7 +221,7 @@ class BirdType { * @param {Record} colors * @param {string[]} [tags] */ - constructor(name, description, colors, tags=[]) { + constructor(name, description, colors, tags = []) { this.name = name; this.description = description; const defaultColors = { @@ -443,8 +443,7 @@ function loadSpriteSheetPixels(dataUri, templateColors = true) { }); } -Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false), loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)]) -.then(([birbPixels, decorationPixels, featherPixels]) => { +Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false), loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)]).then(([birbPixels, decorationPixels, featherPixels]) => { const SPRITE_SHEET = birbPixels; const DECORATIONS_SPRITE_SHEET = decorationPixels; const FEATHER_SPRITE_SHEET = featherPixels; @@ -540,7 +539,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI const FEATHER_ANIMATIONS = { feather: new Anim([ - featherFrames.feather, + featherFrames.feather, ], [ 1000, ]), @@ -573,7 +572,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI class Separator extends MenuItem { constructor() { - super("", () => {}); + super("", () => { }); } } @@ -585,7 +584,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI * @param {number} [top] * @param {number} [left] */ - constructor(id, site="", content="", top=0, left=0) { + constructor(id, site = "", content = "", top = 0, left = 0) { this.id = id; this.site = site; this.content = content; @@ -593,7 +592,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI this.left = left; } } - + const menuItems = [ new MenuItem(`Pet ${birdBirb()}`, pet), new MenuItem("Field Guide", insertFieldGuide), @@ -634,7 +633,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI new MenuItem("Utilities", () => switchMenuItems(utilityItems), false), new MenuItem("Music Player", () => insertMusicPlayer(), false), ]; - + const gameItems = [ new MenuItem("Go Back", () => switchMenuItems(otherItems), false), new Separator(), @@ -899,13 +898,13 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI /** @type {Record} */ const stickyNoteParams = stickyNoteUrl.split("?")[1]?.split("&").reduce((params, param) => { const [key, value] = param.split("="); - return {...params, [key]: value}; + return { ...params, [key]: value }; }, {}); /** @type {Record} */ const currentParams = currentUrl.split("?")[1]?.split("&").reduce((params, param) => { const [key, value] = param.split("="); - return {...params, [key]: value}; + return { ...params, [key]: value }; }, {}); debug("Comparing params: ", stickyNoteParams, currentParams); @@ -1211,7 +1210,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI feather.style.left = `${Math.sin(3.14 * 2 * (ticks / 120)) * 25}px`; } } - + // insertDecoration(); // insertFieldGuide(); @@ -1558,7 +1557,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI * @param {boolean} [parent] Whether to move the parent element when the child is dragged * @param {(top: number, left: number) => void} [callback] Callback for when element is moved */ - function makeDraggable(element, parent = true, callback = () => {}) { + function makeDraggable(element, parent = true, callback = () => { }) { if (!element) { return; } diff --git a/dist/birb.js b/dist/birb.js index 8429396..9e2fa96 100644 --- a/dist/birb.js +++ b/dist/birb.js @@ -390,7 +390,7 @@ class Layer { * @param {string[][]} pixels * @param {string} [tag] */ - constructor(pixels, tag="default") { + constructor(pixels, tag = "default") { this.pixels = pixels; this.tag = tag; } @@ -441,7 +441,7 @@ class Frame { * @param {string} [tag] * @returns {string[][]} */ - getPixels(tag="default") { + getPixels(tag = "default") { return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"]; } @@ -553,7 +553,7 @@ class BirdType { * @param {Record} colors * @param {string[]} [tags] */ - constructor(name, description, colors, tags=[]) { + constructor(name, description, colors, tags = []) { this.name = name; this.description = description; const defaultColors = { @@ -775,8 +775,7 @@ function loadSpriteSheetPixels(dataUri, templateColors = true) { }); } -Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false), loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)]) -.then(([birbPixels, decorationPixels, featherPixels]) => { +Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false), loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)]).then(([birbPixels, decorationPixels, featherPixels]) => { const SPRITE_SHEET = birbPixels; const DECORATIONS_SPRITE_SHEET = decorationPixels; const FEATHER_SPRITE_SHEET = featherPixels; @@ -872,7 +871,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI const FEATHER_ANIMATIONS = { feather: new Anim([ - featherFrames.feather, + featherFrames.feather, ], [ 1000, ]), @@ -905,7 +904,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI class Separator extends MenuItem { constructor() { - super("", () => {}); + super("", () => { }); } } @@ -917,7 +916,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI * @param {number} [top] * @param {number} [left] */ - constructor(id, site="", content="", top=0, left=0) { + constructor(id, site = "", content = "", top = 0, left = 0) { this.id = id; this.site = site; this.content = content; @@ -925,7 +924,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI this.left = left; } } - + const menuItems = [ new MenuItem(`Pet ${birdBirb()}`, pet), new MenuItem("Field Guide", insertFieldGuide), @@ -966,7 +965,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI new MenuItem("Utilities", () => switchMenuItems(utilityItems), false), new MenuItem("Music Player", () => insertMusicPlayer(), false), ]; - + const gameItems = [ new MenuItem("Go Back", () => switchMenuItems(otherItems), false), new Separator(), @@ -1231,13 +1230,13 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI /** @type {Record} */ const stickyNoteParams = stickyNoteUrl.split("?")[1]?.split("&").reduce((params, param) => { const [key, value] = param.split("="); - return {...params, [key]: value}; + return { ...params, [key]: value }; }, {}); /** @type {Record} */ const currentParams = currentUrl.split("?")[1]?.split("&").reduce((params, param) => { const [key, value] = param.split("="); - return {...params, [key]: value}; + return { ...params, [key]: value }; }, {}); debug("Comparing params: ", stickyNoteParams, currentParams); @@ -1543,7 +1542,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI feather.style.left = `${Math.sin(3.14 * 2 * (ticks / 120)) * 25}px`; } } - + // insertDecoration(); // insertFieldGuide(); @@ -1890,7 +1889,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI * @param {boolean} [parent] Whether to move the parent element when the child is dragged * @param {(top: number, left: number) => void} [callback] Callback for when element is moved */ - function makeDraggable(element, parent = true, callback = () => {}) { + function makeDraggable(element, parent = true, callback = () => { }) { if (!element) { return; } diff --git a/dist/birb.user.js b/dist/birb.user.js index beb0d00..e1fb463 100644 --- a/dist/birb.user.js +++ b/dist/birb.user.js @@ -404,7 +404,7 @@ class Layer { * @param {string[][]} pixels * @param {string} [tag] */ - constructor(pixels, tag="default") { + constructor(pixels, tag = "default") { this.pixels = pixels; this.tag = tag; } @@ -455,7 +455,7 @@ class Frame { * @param {string} [tag] * @returns {string[][]} */ - getPixels(tag="default") { + getPixels(tag = "default") { return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"]; } @@ -567,7 +567,7 @@ class BirdType { * @param {Record} colors * @param {string[]} [tags] */ - constructor(name, description, colors, tags=[]) { + constructor(name, description, colors, tags = []) { this.name = name; this.description = description; const defaultColors = { @@ -789,8 +789,7 @@ function loadSpriteSheetPixels(dataUri, templateColors = true) { }); } -Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false), loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)]) -.then(([birbPixels, decorationPixels, featherPixels]) => { +Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false), loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)]).then(([birbPixels, decorationPixels, featherPixels]) => { const SPRITE_SHEET = birbPixels; const DECORATIONS_SPRITE_SHEET = decorationPixels; const FEATHER_SPRITE_SHEET = featherPixels; @@ -886,7 +885,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI const FEATHER_ANIMATIONS = { feather: new Anim([ - featherFrames.feather, + featherFrames.feather, ], [ 1000, ]), @@ -919,7 +918,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI class Separator extends MenuItem { constructor() { - super("", () => {}); + super("", () => { }); } } @@ -931,7 +930,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI * @param {number} [top] * @param {number} [left] */ - constructor(id, site="", content="", top=0, left=0) { + constructor(id, site = "", content = "", top = 0, left = 0) { this.id = id; this.site = site; this.content = content; @@ -939,7 +938,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI this.left = left; } } - + const menuItems = [ new MenuItem(`Pet ${birdBirb()}`, pet), new MenuItem("Field Guide", insertFieldGuide), @@ -980,7 +979,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI new MenuItem("Utilities", () => switchMenuItems(utilityItems), false), new MenuItem("Music Player", () => insertMusicPlayer(), false), ]; - + const gameItems = [ new MenuItem("Go Back", () => switchMenuItems(otherItems), false), new Separator(), @@ -1245,13 +1244,13 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI /** @type {Record} */ const stickyNoteParams = stickyNoteUrl.split("?")[1]?.split("&").reduce((params, param) => { const [key, value] = param.split("="); - return {...params, [key]: value}; + return { ...params, [key]: value }; }, {}); /** @type {Record} */ const currentParams = currentUrl.split("?")[1]?.split("&").reduce((params, param) => { const [key, value] = param.split("="); - return {...params, [key]: value}; + return { ...params, [key]: value }; }, {}); debug("Comparing params: ", stickyNoteParams, currentParams); @@ -1557,7 +1556,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI feather.style.left = `${Math.sin(3.14 * 2 * (ticks / 120)) * 25}px`; } } - + // insertDecoration(); // insertFieldGuide(); @@ -1904,7 +1903,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI * @param {boolean} [parent] Whether to move the parent element when the child is dragged * @param {(top: number, left: number) => void} [callback] Callback for when element is moved */ - function makeDraggable(element, parent = true, callback = () => {}) { + function makeDraggable(element, parent = true, callback = () => { }) { if (!element) { return; }