mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-24 19:59:36 +00:00
Format document
This commit is contained in:
19
birb.js
19
birb.js
@@ -58,7 +58,7 @@ class Layer {
|
|||||||
* @param {string[][]} pixels
|
* @param {string[][]} pixels
|
||||||
* @param {string} [tag]
|
* @param {string} [tag]
|
||||||
*/
|
*/
|
||||||
constructor(pixels, tag="default") {
|
constructor(pixels, tag = "default") {
|
||||||
this.pixels = pixels;
|
this.pixels = pixels;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ class Frame {
|
|||||||
* @param {string} [tag]
|
* @param {string} [tag]
|
||||||
* @returns {string[][]}
|
* @returns {string[][]}
|
||||||
*/
|
*/
|
||||||
getPixels(tag="default") {
|
getPixels(tag = "default") {
|
||||||
return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"];
|
return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ class BirdType {
|
|||||||
* @param {Record<string, string>} colors
|
* @param {Record<string, string>} colors
|
||||||
* @param {string[]} [tags]
|
* @param {string[]} [tags]
|
||||||
*/
|
*/
|
||||||
constructor(name, description, colors, tags=[]) {
|
constructor(name, description, colors, tags = []) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
const defaultColors = {
|
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)])
|
Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false), loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)]).then(([birbPixels, decorationPixels, featherPixels]) => {
|
||||||
.then(([birbPixels, decorationPixels, featherPixels]) => {
|
|
||||||
const SPRITE_SHEET = birbPixels;
|
const SPRITE_SHEET = birbPixels;
|
||||||
const DECORATIONS_SPRITE_SHEET = decorationPixels;
|
const DECORATIONS_SPRITE_SHEET = decorationPixels;
|
||||||
const FEATHER_SPRITE_SHEET = featherPixels;
|
const FEATHER_SPRITE_SHEET = featherPixels;
|
||||||
@@ -573,7 +572,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
|||||||
|
|
||||||
class Separator extends MenuItem {
|
class Separator extends MenuItem {
|
||||||
constructor() {
|
constructor() {
|
||||||
super("", () => {});
|
super("", () => { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,7 +584,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
|||||||
* @param {number} [top]
|
* @param {number} [top]
|
||||||
* @param {number} [left]
|
* @param {number} [left]
|
||||||
*/
|
*/
|
||||||
constructor(id, site="", content="", top=0, left=0) {
|
constructor(id, site = "", content = "", top = 0, left = 0) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.site = site;
|
this.site = site;
|
||||||
this.content = content;
|
this.content = content;
|
||||||
@@ -899,13 +898,13 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
|||||||
/** @type {Record<string, string>} */
|
/** @type {Record<string, string>} */
|
||||||
const stickyNoteParams = stickyNoteUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
const stickyNoteParams = stickyNoteUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
||||||
const [key, value] = param.split("=");
|
const [key, value] = param.split("=");
|
||||||
return {...params, [key]: value};
|
return { ...params, [key]: value };
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
/** @type {Record<string, string>} */
|
/** @type {Record<string, string>} */
|
||||||
const currentParams = currentUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
const currentParams = currentUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
||||||
const [key, value] = param.split("=");
|
const [key, value] = param.split("=");
|
||||||
return {...params, [key]: value};
|
return { ...params, [key]: value };
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
debug("Comparing params: ", stickyNoteParams, currentParams);
|
debug("Comparing params: ", stickyNoteParams, currentParams);
|
||||||
@@ -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 {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
|
* @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) {
|
if (!element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
19
dist/birb.js
vendored
19
dist/birb.js
vendored
@@ -390,7 +390,7 @@ class Layer {
|
|||||||
* @param {string[][]} pixels
|
* @param {string[][]} pixels
|
||||||
* @param {string} [tag]
|
* @param {string} [tag]
|
||||||
*/
|
*/
|
||||||
constructor(pixels, tag="default") {
|
constructor(pixels, tag = "default") {
|
||||||
this.pixels = pixels;
|
this.pixels = pixels;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
@@ -441,7 +441,7 @@ class Frame {
|
|||||||
* @param {string} [tag]
|
* @param {string} [tag]
|
||||||
* @returns {string[][]}
|
* @returns {string[][]}
|
||||||
*/
|
*/
|
||||||
getPixels(tag="default") {
|
getPixels(tag = "default") {
|
||||||
return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"];
|
return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,7 +553,7 @@ class BirdType {
|
|||||||
* @param {Record<string, string>} colors
|
* @param {Record<string, string>} colors
|
||||||
* @param {string[]} [tags]
|
* @param {string[]} [tags]
|
||||||
*/
|
*/
|
||||||
constructor(name, description, colors, tags=[]) {
|
constructor(name, description, colors, tags = []) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
const defaultColors = {
|
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)])
|
Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false), loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)]).then(([birbPixels, decorationPixels, featherPixels]) => {
|
||||||
.then(([birbPixels, decorationPixels, featherPixels]) => {
|
|
||||||
const SPRITE_SHEET = birbPixels;
|
const SPRITE_SHEET = birbPixels;
|
||||||
const DECORATIONS_SPRITE_SHEET = decorationPixels;
|
const DECORATIONS_SPRITE_SHEET = decorationPixels;
|
||||||
const FEATHER_SPRITE_SHEET = featherPixels;
|
const FEATHER_SPRITE_SHEET = featherPixels;
|
||||||
@@ -905,7 +904,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
|||||||
|
|
||||||
class Separator extends MenuItem {
|
class Separator extends MenuItem {
|
||||||
constructor() {
|
constructor() {
|
||||||
super("", () => {});
|
super("", () => { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -917,7 +916,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
|||||||
* @param {number} [top]
|
* @param {number} [top]
|
||||||
* @param {number} [left]
|
* @param {number} [left]
|
||||||
*/
|
*/
|
||||||
constructor(id, site="", content="", top=0, left=0) {
|
constructor(id, site = "", content = "", top = 0, left = 0) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.site = site;
|
this.site = site;
|
||||||
this.content = content;
|
this.content = content;
|
||||||
@@ -1231,13 +1230,13 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
|||||||
/** @type {Record<string, string>} */
|
/** @type {Record<string, string>} */
|
||||||
const stickyNoteParams = stickyNoteUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
const stickyNoteParams = stickyNoteUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
||||||
const [key, value] = param.split("=");
|
const [key, value] = param.split("=");
|
||||||
return {...params, [key]: value};
|
return { ...params, [key]: value };
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
/** @type {Record<string, string>} */
|
/** @type {Record<string, string>} */
|
||||||
const currentParams = currentUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
const currentParams = currentUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
||||||
const [key, value] = param.split("=");
|
const [key, value] = param.split("=");
|
||||||
return {...params, [key]: value};
|
return { ...params, [key]: value };
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
debug("Comparing params: ", stickyNoteParams, currentParams);
|
debug("Comparing params: ", stickyNoteParams, currentParams);
|
||||||
@@ -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 {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
|
* @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) {
|
if (!element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
19
dist/birb.user.js
vendored
19
dist/birb.user.js
vendored
@@ -404,7 +404,7 @@ class Layer {
|
|||||||
* @param {string[][]} pixels
|
* @param {string[][]} pixels
|
||||||
* @param {string} [tag]
|
* @param {string} [tag]
|
||||||
*/
|
*/
|
||||||
constructor(pixels, tag="default") {
|
constructor(pixels, tag = "default") {
|
||||||
this.pixels = pixels;
|
this.pixels = pixels;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
@@ -455,7 +455,7 @@ class Frame {
|
|||||||
* @param {string} [tag]
|
* @param {string} [tag]
|
||||||
* @returns {string[][]}
|
* @returns {string[][]}
|
||||||
*/
|
*/
|
||||||
getPixels(tag="default") {
|
getPixels(tag = "default") {
|
||||||
return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"];
|
return this.#pixelsByTag[tag] ?? this.#pixelsByTag["default"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@ class BirdType {
|
|||||||
* @param {Record<string, string>} colors
|
* @param {Record<string, string>} colors
|
||||||
* @param {string[]} [tags]
|
* @param {string[]} [tags]
|
||||||
*/
|
*/
|
||||||
constructor(name, description, colors, tags=[]) {
|
constructor(name, description, colors, tags = []) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
const defaultColors = {
|
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)])
|
Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATIONS_SPRITE_SHEET, false), loadSpriteSheetPixels(FEATHER_SPRITE_SHEET)]).then(([birbPixels, decorationPixels, featherPixels]) => {
|
||||||
.then(([birbPixels, decorationPixels, featherPixels]) => {
|
|
||||||
const SPRITE_SHEET = birbPixels;
|
const SPRITE_SHEET = birbPixels;
|
||||||
const DECORATIONS_SPRITE_SHEET = decorationPixels;
|
const DECORATIONS_SPRITE_SHEET = decorationPixels;
|
||||||
const FEATHER_SPRITE_SHEET = featherPixels;
|
const FEATHER_SPRITE_SHEET = featherPixels;
|
||||||
@@ -919,7 +918,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
|||||||
|
|
||||||
class Separator extends MenuItem {
|
class Separator extends MenuItem {
|
||||||
constructor() {
|
constructor() {
|
||||||
super("", () => {});
|
super("", () => { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -931,7 +930,7 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
|||||||
* @param {number} [top]
|
* @param {number} [top]
|
||||||
* @param {number} [left]
|
* @param {number} [left]
|
||||||
*/
|
*/
|
||||||
constructor(id, site="", content="", top=0, left=0) {
|
constructor(id, site = "", content = "", top = 0, left = 0) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.site = site;
|
this.site = site;
|
||||||
this.content = content;
|
this.content = content;
|
||||||
@@ -1245,13 +1244,13 @@ Promise.all([loadSpriteSheetPixels(SPRITE_SHEET), loadSpriteSheetPixels(DECORATI
|
|||||||
/** @type {Record<string, string>} */
|
/** @type {Record<string, string>} */
|
||||||
const stickyNoteParams = stickyNoteUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
const stickyNoteParams = stickyNoteUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
||||||
const [key, value] = param.split("=");
|
const [key, value] = param.split("=");
|
||||||
return {...params, [key]: value};
|
return { ...params, [key]: value };
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
/** @type {Record<string, string>} */
|
/** @type {Record<string, string>} */
|
||||||
const currentParams = currentUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
const currentParams = currentUrl.split("?")[1]?.split("&").reduce((params, param) => {
|
||||||
const [key, value] = param.split("=");
|
const [key, value] = param.split("=");
|
||||||
return {...params, [key]: value};
|
return { ...params, [key]: value };
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
debug("Comparing params: ", stickyNoteParams, currentParams);
|
debug("Comparing params: ", stickyNoteParams, currentParams);
|
||||||
@@ -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 {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
|
* @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) {
|
if (!element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user