From 0b3ad3f76bb04ef18849b568f404e56f23cf73bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Fri, 27 May 2022 01:03:06 -0400
Subject: [PATCH 01/60] Refactoring, formatting, etc...
---
iconkit/icon.js | 151 +++++++++++++++++++++++++++---------------------
1 file changed, 84 insertions(+), 67 deletions(-)
diff --git a/iconkit/icon.js b/iconkit/icon.js
index c2bb1125..5a1416b6 100644
--- a/iconkit/icon.js
+++ b/iconkit/icon.js
@@ -18,7 +18,7 @@ function positionPart(part, partIndex, layer, formName, isGlow) {
let tintInfo = iconData.robotAnimations.info[formName].tints
let foundTint = tintInfo[partIndex]
if (foundTint > 0) {
- let darkenFilter = new PIXI.filters.ColorMatrixFilter();
+ let darkenFilter = new PIXI.filters.ColorMatrixFilter()
darkenFilter.brightness(0)
darkenFilter.alpha = (255 - foundTint) / 255
layer.filters = [darkenFilter]
@@ -26,9 +26,10 @@ function positionPart(part, partIndex, layer, formName, isGlow) {
}
}
-function validNum(val, defaultVal) {
+function sanitizeNum(val, defaultVal) {
let colVal = +val
- return isNaN(colVal) ? defaultVal : colVal
+ //yes, it also checks for NaN
+ return isFinite(colVal) ? colVal : defaultVal
}
function getGlowColor(colors) {
@@ -37,8 +38,8 @@ function getGlowColor(colors) {
return glowCol
}
-function validateIconID(id, form) {
- let realID = Math.min(iconData.iconCounts[form], Math.abs(validNum(id, 1)))
+function sanitizeIconID(id, form) {
+ let realID = Math.min(iconData.iconCounts[form], Math.abs(sanitizeNum(id, 1)))
if (realID == 0 && !["player", "player_ball"].includes(form)) realID = 1
return realID
}
@@ -47,7 +48,7 @@ function parseIconColor(col) {
if (!col) return WHITE
else if (typeof col == "string" && col.length >= 6) return parseInt(col, 16)
let rgb = iconData.colors[col]
- return rgb ? rgbToDecimal(rgb) : WHITE;
+ return rgb ? rgb2Pac(rgb) : WHITE
}
function parseIconForm(form) {
@@ -56,35 +57,41 @@ function parseIconForm(form) {
}
function loadIconLayers(form, id, cb) {
- let texturesToLoad = Object.keys(iconData.gameSheet).filter(x => x.startsWith(`${form}_${padZero(validateIconID(id, form))}_`))
- loader.add(texturesToLoad.filter(x => !loader.resources[x]).map(x => ({ name: x, url: `/iconkit/icons/${x}` })))
+ let texturesToLoad = Object.keys(iconData.gameSheet)
+ .filter(x => x.startsWith(`${form}_${padZero(sanitizeIconID(id, form))}_`))
+ loader.add(texturesToLoad
+ .filter(x => !loader.resources[x])
+ .map(x => ({ name: x, url: `/iconkit/icons/${x}` }))
+ )
loader.load(cb)
}
-function padZero(num) {
- let numStr = num.toString()
- if (num < 10) numStr = "0" + numStr
- return numStr
-}
+function padZero(num) { return num.toString().padStart(2, "0") }
-function rgbToDecimal(rgb) {
- return (rgb.r << 16) + (rgb.g << 8) + rgb.b;
-}
+/*
+name explanation:
+`Number`s are not decimals, because they are not `String`s, and the internal representation is binary.
+This means "rgbToDecimal" is a misleading name.
+Converting independent color components into one number is called "color packing".
+So I thougth it would be funny to rename "rgbToPacked" into "rgb2Pac".
+Alternative names could be "rgbPacker" or "packRGB", IDK
+*/
+function rgb2Pac(rgb) { return (rgb.r << 16) | (rgb.g << 8) | rgb.b }
class Icon {
constructor(data={}, cb) {
this.app = data.app
- this.sprite = new PIXI.Container();
+ this.sprite = new PIXI.Container()
this.form = data.form || "player"
- this.id = validateIconID(data.id, this.form)
+ this.id = sanitizeIconID(data.id, this.form)
this.colors = {
- "1": validNum(data.col1, 0xafafaf), // primary
- "2": validNum(data.col2, WHITE), // secondary
- "g": validNum(data.colG, validNum(+data.colg, null)), // glow
- "w": validNum(data.colW, validNum(+data.colw, WHITE)), // white
- "u": validNum(data.colU, validNum(+data.colu, WHITE)), // ufo
+ "1": sanitizeNum(data.col1, 0xafafaf), // primary
+ "2": sanitizeNum(data.col2, WHITE), // secondary
+ "g": sanitizeNum(data.colG, sanitizeNum(+data.colg, null)), // glow
+ "w": sanitizeNum(data.colW, sanitizeNum(+data.colw, WHITE)), // white
+ "u": sanitizeNum(data.colU, sanitizeNum(+data.colu, WHITE)), // ufo
}
-
+
this.glow = !!data.glow
this.layers = []
this.glowLayers = []
@@ -107,17 +114,17 @@ class Icon {
x.name = iconData.robotAnimations.info[this.form].names[y]
let part = new IconPart(this.form, this.id, this.colors, false, { part: x, skipGlow: true })
positionPart(x, y, part.sprite, this.form)
-
+
let glowPart = new IconPart(this.form, this.id, this.colors, true, { part: x, onlyGlow: true })
positionPart(x, y, glowPart.sprite, this.form, true)
glowPart.sprite.visible = this.glow
this.glowLayers.push(glowPart)
-
+
this.layers.push(part)
this.sprite.addChild(part.sprite)
})
-
- let fullGlow = new PIXI.Container();
+
+ let fullGlow = new PIXI.Container()
this.glowLayers.forEach(x => fullGlow.addChild(x.sprite))
this.sprite.addChildAt(fullGlow, 0)
if (typeof Ease !== "undefined") this.ease = new Ease.Ease()
@@ -134,14 +141,16 @@ class Icon {
getAllLayers() {
let allLayers = [];
- (this.complex ? this.glowLayers : []).concat(this.layers).forEach(x => x.sections.forEach(s => allLayers.push(s)))
+ (this.complex ? this.glowLayers : [])
+ .concat(this.layers)
+ .forEach(x => x.sections.forEach(s => allLayers.push(s)))
return allLayers
}
setColor(colorType, newColor, extra={}) {
let colorStr = String(colorType).toLowerCase()
- if (!colorType || !Object.keys(this.colors).includes(colorStr)) return
- else this.colors[colorStr] = newColor
+ if (!colorType || this.colors[colorStr] === undefined) return
+ this.colors[colorStr] = newColor
let newGlow = getGlowColor(this.colors)
this.getAllLayers().forEach(x => {
if (colorType != "g" && x.colorType == colorStr) x.setColor(newColor)
@@ -153,13 +162,9 @@ class Icon {
}
}
- formName() {
- return formNames[this.form] || this.form
- }
+ formName() { return formNames[this.form] || this.form }
- isGlowing() {
- return this.glowLayers[0].sprite.visible
- }
+ isGlowing() { return this.glowLayers[0].sprite.visible }
setGlow(toggle) {
this.glow = !!toggle
@@ -201,9 +206,9 @@ class Icon {
let bothSections = [section, glowSection]
bothSections.forEach((x, y) => {
- let easing = this.ease.add(x.sprite, movementData, { duration: duration || 1, ease: 'linear' })
+ let easing = this.ease.add(x.sprite, movementData, { duration: duration || 1, ease: "linear" })
let continueAfterEase = animData.frames.length > 1 && y == 0 && index == 0 && animName == this.animationName
- if (continueAfterEase) easing.on('complete', () => {
+ if (continueAfterEase) easing.on("complete", () => {
this.animationFrame++
if (this.animationFrame >= animData.frames.length) {
if (animData.info.loop) this.animationFrame = 0
@@ -217,7 +222,7 @@ class Icon {
autocrop() {
// find actual icon size by reading pixel data (otherwise there's whitespace and shit)
let spriteSize = [Math.round(this.sprite.width), Math.round(this.sprite.height)]
- let pixels = this.app.renderer.plugins.extract.pixels(this.sprite);
+ let pixels = this.app.renderer.plugins.extract.pixels(this.sprite)
let xRange = [spriteSize[0], 0]
let yRange = [spriteSize[1], 0]
@@ -245,7 +250,7 @@ class Icon {
xRange[1] += 4
yRange[1] += 6
}
-
+
let realWidth = xRange[1] - xRange[0]
let realHeight = yRange[1] - yRange[0]
@@ -264,29 +269,29 @@ class Icon {
toDataURL(dataType="image/png") {
this.autocrop()
- this.app.renderer.render(this.app.stage);
- let b64data = this.app.view.toDataURL(dataType);
+ this.app.renderer.render(this.app.stage)
+ let b64data = this.app.view.toDataURL(dataType)
this.revertCrop()
return b64data
}
pngExport() {
let b64data = this.toDataURL()
- let downloader = document.createElement('a');
+ let downloader = document.createElement("a")
downloader.href = b64data
- downloader.setAttribute("download", `${this.formName()}_${this.id}.png`);
- document.body.appendChild(downloader);
- downloader.click();
- document.body.removeChild(downloader);
+ downloader.setAttribute("download", `${this.formName()}_${this.id}.png`)
+ document.body.appendChild(downloader)
+ downloader.click()
+ document.body.removeChild(downloader)
}
copyToClipboard() {
this.autocrop()
- this.app.renderer.render(app.stage);
+ this.app.renderer.render(app.stage)
this.app.view.toBlob(blob => {
- let item = new ClipboardItem({ "image/png": blob });
- navigator.clipboard.write([item]);
- });
+ let item = new ClipboardItem({ "image/png": blob })
+ navigator.clipboard.write([item])
+ })
this.revertCrop()
}
@@ -304,10 +309,10 @@ class Icon {
function addPSDLayer(layer, parent, sprite) {
allLayers.forEach(x => x.sprite.alpha = 0)
layer.sprite.alpha = 255
-
+
let layerChild = { name: layer.colorName, canvas: renderer.plugins.extract.canvas(sprite) }
if (layer.colorType == "g") {
- if (parent.part) layerChild.name = parent.part.name + " glow"
+ if (parent.part) layerChild.name = `${parent.part.name} glow`
else layerChild.blendMode = "linear dodge"
if (!complex && !glowing) layerChild.hidden = true
}
@@ -332,13 +337,13 @@ class Icon {
allLayers.forEach(x => x.sprite.alpha = 255)
let output = agPsd.writePsd(psd)
- let blob = new Blob([output]);
- let downloader = document.createElement('a');
- downloader.href = URL.createObjectURL(blob);
- downloader.setAttribute("download", `${this.formName()}_${this.id}.psd`);
- document.body.appendChild(downloader);
- downloader.click();
- document.body.removeChild(downloader);
+ let blob = new Blob([output])
+ let downloader = document.createElement("a")
+ downloader.href = URL.createObjectURL(blob)
+ downloader.setAttribute("download", `${this.formName()}_${this.id}.psd`)
+ document.body.appendChild(downloader)
+ downloader.click()
+ document.body.removeChild(downloader)
this.setGlow(glowing)
}
}
@@ -349,11 +354,11 @@ class IconPart {
if (colors[1] == 0 && !misc.skipGlow) glow = true // add glow if p1 is black
let iconPath = `${form}_${padZero(id)}`
- let partString = misc.part ? "_" + padZero(misc.part.part) : ""
+ let partString = misc.part ? `_${padZero(misc.part.part)}` : ""
let sections = {}
if (misc.part) this.part = misc.part
- this.sprite = new PIXI.Container();
+ this.sprite = new PIXI.Container()
this.sections = []
if (!misc.skipGlow) {
@@ -376,11 +381,23 @@ class IconPart {
}
}
- let layerOrder = ["glow", "ufo", "col2", "col1", "white"].map(x => sections[x]).filter(x => x)
- layerOrder.forEach(x => {
+ let layerOrder = ["glow", "ufo", "col2", "col1", "white"]
+ for (let x of layerOrder) {
+ x = sections[x]
+ if (!x) continue
this.sections.push(x)
this.sprite.addChild(x.sprite)
- })
+ }/*
+ if the compiler doesn't optimize enough,
+ this would iterate 3 times and make shallow copies of the array each call.
+
+ layerOrder.map(x => sections[x])
+ .filter(x => x)
+ .forEach(x => {
+ this.sections.push(x)
+ this.sprite.addChild(x.sprite)
+ })
+ */
}
}
@@ -399,7 +416,7 @@ class IconLayer {
}
setColor(color) {
- this.color = validNum(color, WHITE)
+ this.color = sanitizeNum(color, WHITE)
this.sprite.tint = this.color
}
}
\ No newline at end of file
From 5886f33bb7e734cedfeb9454900be7fae1d2e2c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Sat, 28 May 2022 22:12:25 -0400
Subject: [PATCH 02/60] Fixed some whitespaces
---
misc/global.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/misc/global.js b/misc/global.js
index fd994f2f..1a68b794 100644
--- a/misc/global.js
+++ b/misc/global.js
@@ -14,7 +14,6 @@ $(window).resize(function () {
$('#everything').hide();
$('#tooSmall').show();
}
-
else {
$('#everything').show();
$('#tooSmall').hide()
@@ -22,7 +21,7 @@ $(window).resize(function () {
});
function saveUrl() {
- if (window.location.href.endsWith('?download')) return;
+ if (window.location.href.endsWith('?download')) return;
sessionStorage.setItem('prevUrl', window.location.href);
}
@@ -153,4 +152,4 @@ $.fn.isInViewport = function () {
let viewportTop = $(window).scrollTop();
let viewportBottom = viewportTop + $(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;
-};
\ No newline at end of file
+};
From 32d0dee7eac19cadd81b1626938cade35f69aadc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Sat, 28 May 2022 22:46:33 -0400
Subject: [PATCH 03/60] Replaced `if` by `||=`
---
index.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/index.js b/index.js
index 865e2c9e..776fda7f 100644
--- a/index.js
+++ b/index.js
@@ -80,8 +80,8 @@ app.use(async function(req, res, next) {
if (req.query.online > 0) req.offline = false
req.gdParams = function(obj={}, substitute=true) {
- Object.keys(app.config.params).forEach(x => { if (!obj[x]) obj[x] = app.config.params[x] })
- Object.keys(req.server.extraParams || {}).forEach(x => { if (!obj[x]) obj[x] = req.server.extraParams[x] })
+ Object.keys(app.config.params).forEach(x => obj[x] ||= app.config.params[x])
+ Object.keys(req.server.extraParams || {}).forEach(x => obj[x] ||= req.server.extraParams[x])
let ip = req.headers['x-real-ip'] || req.headers['x-forwarded-for']
let params = {form: obj, headers: app.config.ipForwarding && ip ? {'x-forwarded-for': ip, 'x-real-ip': ip} : {}}
@@ -379,4 +379,4 @@ app.use(function (err, req, res, next) {
process.on('uncaughtException', (e) => { console.log(e) });
process.on('unhandledRejection', (e, p) => { console.log(e) });
-app.listen(app.config.port, () => console.log(`Site online! (port ${app.config.port})`))
\ No newline at end of file
+app.listen(app.config.port, () => console.log(`Site online! (port ${app.config.port})`))
From 2cd72fa71b3cef0135b883d5222713ff715167ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Sat, 28 May 2022 23:27:36 -0400
Subject: [PATCH 04/60] Update index.js
---
index.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.js b/index.js
index 776fda7f..b436aa96 100644
--- a/index.js
+++ b/index.js
@@ -24,7 +24,7 @@ const RL = rateLimit({
max: app.config.rateLimiting ? 100 : 0, // max requests per 5 minutes
message: rlMessage,
keyGenerator: function(req) { return req.headers['x-real-ip'] || req.headers['x-forwarded-for'] },
- skip: function(req) { return ((req.url.includes("api/level") && !req.query.hasOwnProperty("download")) ? true : false) }
+ skip: function(req) { return (req.url.includes("api/level") && !req.query.hasOwnProperty("download")) }
})
const RL2 = rateLimit({
@@ -173,7 +173,7 @@ app.parseResponse = function (responseBody, splitter=":") {
}
//xss bad
-app.clean = function(text) {if (!text || typeof text != "string") return text; else return text.replace(/&/g, "&").replace(//g, ">").replace(/=/g, "=").replace(/"/g, """).replace(/'/g, "'")}
+app.clean = function(text) {return !text || typeof text != "string" ? text : text.replace(/./gs, c => {"&": "&", "<": "<", ">": ">", "=": "=", '"': """, "'": "'"}[c] || c)}
// ASSETS
From b7eb348d079bb868125412dcb3fbecf97ee6ae47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Sat, 28 May 2022 23:33:10 -0400
Subject: [PATCH 05/60] Forgot parentheses lol
---
index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.js b/index.js
index b436aa96..05f7a595 100644
--- a/index.js
+++ b/index.js
@@ -173,7 +173,7 @@ app.parseResponse = function (responseBody, splitter=":") {
}
//xss bad
-app.clean = function(text) {return !text || typeof text != "string" ? text : text.replace(/./gs, c => {"&": "&", "<": "<", ">": ">", "=": "=", '"': """, "'": "'"}[c] || c)}
+app.clean = function(text) {return !text || typeof text != "string" ? text : text.replace(/./gs, c => ({"&": "&", "<": "<", ">": ">", "=": "=", '"': """, "'": "'"}[c] || c))}
// ASSETS
From f7c5e12dfe4c8e9a5698fe678433a63fb31cc995 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Sat, 28 May 2022 23:41:49 -0400
Subject: [PATCH 06/60] Using `Object.hasOwn` instead of checking `undefined`
---
iconkit/icon.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/iconkit/icon.js b/iconkit/icon.js
index 5a1416b6..f0f66807 100644
--- a/iconkit/icon.js
+++ b/iconkit/icon.js
@@ -127,7 +127,7 @@ class Icon {
let fullGlow = new PIXI.Container()
this.glowLayers.forEach(x => fullGlow.addChild(x.sprite))
this.sprite.addChildAt(fullGlow, 0)
- if (typeof Ease !== "undefined") this.ease = new Ease.Ease()
+ if (typeof Ease != "undefined") this.ease = new Ease.Ease()
this.animationSpeed = Math.abs(Number(data.animationSpeed) || 1)
if (data.animation) this.setAnimation(data.animation, data.animationForm)
}
@@ -149,7 +149,7 @@ class Icon {
setColor(colorType, newColor, extra={}) {
let colorStr = String(colorType).toLowerCase()
- if (!colorType || this.colors[colorStr] === undefined) return
+ if (!colorType || !Object.hasOwn(this.colors, colorStr)) return
this.colors[colorStr] = newColor
let newGlow = getGlowColor(this.colors)
this.getAllLayers().forEach(x => {
@@ -419,4 +419,4 @@ class IconLayer {
this.color = sanitizeNum(color, WHITE)
this.sprite.tint = this.color
}
-}
\ No newline at end of file
+}
From 6eb5accbf41c53f78259c17733d2ba2e01222980 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 13:16:45 -0400
Subject: [PATCH 07/60] patch-1
---
iconkit/icon.js | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/iconkit/icon.js b/iconkit/icon.js
index e099ed64..fa163a9d 100644
--- a/iconkit/icon.js
+++ b/iconkit/icon.js
@@ -7,8 +7,9 @@ const loadedNewIcons = {}
let positionMultiplier = 4
function positionPart(part, partIndex, layer, formName, isNew, isGlow) {
- layer.position.x += (part.pos[0] * positionMultiplier * (isNew ? 0.5 : 1))
- layer.position.y -= (part.pos[1] * positionMultiplier * (isNew ? 0.5 : 1))
+ let truePosMultiplier = positionMultiplier / (isNew ? 2 : 1)
+ layer.position.x += (part.pos[0] * truePosMultiplier)
+ layer.position.y -= (part.pos[1] * truePosMultiplier)
layer.scale.x = part.scale[0]
layer.scale.y = part.scale[1]
if (part.flipped[0]) layer.scale.x *= -1
@@ -22,7 +23,7 @@ function positionPart(part, partIndex, layer, formName, isNew, isGlow) {
if (foundTint > 0) {
let darkenFilter = new PIXI.filters.ColorMatrixFilter()
darkenFilter.brightness(0)
- darkenFilter.alpha = (255 - foundTint) / 255
+ darkenFilter.alpha = (255 - foundTint) / 255 // same as `1 - foundTint / 0xff`
layer.filters = [darkenFilter]
}
}
@@ -124,7 +125,7 @@ function parseNewPlist(data) {
let textureArr = keyData.slice(1, -1).split("},{").map(x => parseWeirdArray(x))
positionData[frameName].pos = textureArr[0]
positionData[frameName].size = textureArr[1]
- }
+ }
}
if (isRotated) positionData[frameName].size.reverse()
@@ -160,9 +161,9 @@ class Icon {
this.colors = {
"1": sanitizeNum(data.col1, 0xafafaf), // primary
"2": sanitizeNum(data.col2, WHITE), // secondary
- "g": sanitizeNum(data.colG, sanitizeNum(+data.colg, null)), // glow
- "w": sanitizeNum(data.colW, sanitizeNum(+data.colw, WHITE)), // white
- "u": sanitizeNum(data.colU, sanitizeNum(+data.colu, WHITE)), // ufo
+ "g": sanitizeNum(data.colG, sanitizeNum(data.colg, null)), // glow
+ "w": sanitizeNum(data.colW, sanitizeNum(data.colw, WHITE)), // white
+ "u": sanitizeNum(data.colU, sanitizeNum(data.colu, WHITE)), // ufo
}
this.glow = !!data.glow
@@ -188,7 +189,7 @@ class Icon {
let part = new IconPart(this.form, this.id, this.colors, false, { part: x, skipGlow: true, new: this.new })
positionPart(x, y, part.sprite, this.form, this.new)
-
+
let glowPart = new IconPart(this.form, this.id, this.colors, true, { part: x, onlyGlow: true, new: this.new })
positionPart(x, y, glowPart.sprite, this.form, this.new, true)
@@ -265,7 +266,7 @@ class Icon {
animData.frames[this.animationFrame].forEach((newPart, index) => {
let section = this.layers[index]
let glowSection = this.glowLayers[index]
- let truePosMultiplier = this.new ? positionMultiplier * 0.5 : positionMultiplier
+ let truePosMultiplier = positionMultiplier / (this.new ? 2 : 1)
if (!section) return
// gd is weird with negative rotations
@@ -371,7 +372,7 @@ class Icon {
}
psdExport() {
- if (typeof agPsd === "undefined") throw new Error("ag-psd not imported!")
+ if (typeof agPsd == "undefined") throw new Error("ag-psd not imported!")
let glowing = this.isGlowing()
this.setGlow(true)
@@ -461,9 +462,8 @@ class IconPart {
if (!x) continue
this.sections.push(x)
this.sprite.addChild(x.sprite)
- }/*
- if the compiler doesn't optimize enough,
- this would iterate 3 times and make shallow copies of the array each call.
+ }
+ /* alternative:
layerOrder.map(x => sections[x])
.filter(x => x)
From cf7313c7d6e92a61dde96a58520b87311f32f508 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 13:35:15 -0400
Subject: [PATCH 08/60] patch-1
---
classes/XOR.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/classes/XOR.js b/classes/XOR.js
index 87287ca0..b798ccb9 100644
--- a/classes/XOR.js
+++ b/classes/XOR.js
@@ -1,5 +1,8 @@
+//converts input base64 into its URL-safe variant
+let toURLsafe = str => str.replace(/./gs, c => ({'/': '_', '+': '-'}[c] || c))
+
module.exports = class XOR {
- xor(str, key) { return String.fromCodePoint(...str.split('').map((char, i) => char.charCodeAt(0) ^ key.toString().charCodeAt(i % key.toString().length))) }
- encrypt(str, key = 37526) { return Buffer.from(this.xor(str, key)).toString('base64').replace(/./gs, c => ({'/': '_', '+': '-'}[c] || c)); }
- decrypt(str, key = 37526) { return this.xor(Buffer.from(str.replace(/./gs, c => ({'/': '_', '+': '-'}[c] || c)), 'base64').toString(), key) }
+ xor(str, key) { return String.fromCodePoint(...str.split('').map((c, i) => c.charCodeAt(0) ^ key.toString().charCodeAt(i % key.toString().length))) }
+ encrypt(str, key = 37526) { return toURLsafe(Buffer.from(this.xor(str, key)).toString('base64')) }
+ decrypt(str, key = 37526) { return this.xor(Buffer.from(toURLsafe(str), 'base64').toString(), key) }
}
From e9f84b69b17a2668aba1e83339758c2c663f657c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 13:51:49 -0400
Subject: [PATCH 09/60] patch-1
---
classes/XOR.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/classes/XOR.js b/classes/XOR.js
index b798ccb9..692f5366 100644
--- a/classes/XOR.js
+++ b/classes/XOR.js
@@ -1,8 +1,8 @@
//converts input base64 into its URL-safe variant
-let toURLsafe = str => str.replace(/./gs, c => ({'/': '_', '+': '-'}[c] || c))
-
+//let toURLsafe = str => str.replace(/./gs, c => ({'/': '_', '+': '-'}[c] || c))
+//https://nodejs.org/docs/latest/api/buffer.html#buffers-and-character-encodings
module.exports = class XOR {
xor(str, key) { return String.fromCodePoint(...str.split('').map((c, i) => c.charCodeAt(0) ^ key.toString().charCodeAt(i % key.toString().length))) }
- encrypt(str, key = 37526) { return toURLsafe(Buffer.from(this.xor(str, key)).toString('base64')) }
- decrypt(str, key = 37526) { return this.xor(Buffer.from(toURLsafe(str), 'base64').toString(), key) }
-}
+ encrypt(str, key = 37526) { return Buffer.from(this.xor(str, key)).toString('base64url') }
+ decrypt(str, key = 37526) { return this.xor(Buffer.from(str, 'base64').toString(), key) }
+}
\ No newline at end of file
From e2f7bcbb4720f1b5ba1f29f2345c55deaadb676d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 14:16:00 -0400
Subject: [PATCH 10/60] p
---
classes/XOR.js | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/classes/XOR.js b/classes/XOR.js
index 692f5366..51bbb4e6 100644
--- a/classes/XOR.js
+++ b/classes/XOR.js
@@ -1,8 +1,16 @@
-//converts input base64 into its URL-safe variant
-//let toURLsafe = str => str.replace(/./gs, c => ({'/': '_', '+': '-'}[c] || c))
//https://nodejs.org/docs/latest/api/buffer.html#buffers-and-character-encodings
+//both only work on "binary strings" and "URI-safe B64"
+let toB64 = str => Buffer.from(str).toString('base64url')
+let fromB64 = str => Buffer.from(str, 'base64').toString()
+
+const defKey = 37526
+
module.exports = class XOR {
- xor(str, key) { return String.fromCodePoint(...str.split('').map((c, i) => c.charCodeAt(0) ^ key.toString().charCodeAt(i % key.toString().length))) }
- encrypt(str, key = 37526) { return Buffer.from(this.xor(str, key)).toString('base64url') }
- decrypt(str, key = 37526) { return this.xor(Buffer.from(str, 'base64').toString(), key) }
+ xor(str, key) {
+ key = key.toString()
+ return String.fromCodePoint(...str.split('')
+ .map((c, i) => c.charCodeAt(0) ^ key.charCodeAt(i % key.length)))
+ }
+ encrypt(str, key = defKey) { return toB64(this.xor(str, key)) }
+ decrypt(str, key = defKey) { return this.xor(fromB64(str), key) }
}
\ No newline at end of file
From 0c6c1a1ac99b474f38f91de2e211103b8c379b14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 14:45:29 -0400
Subject: [PATCH 11/60] Added radian converters
---
iconkit/icon.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/iconkit/icon.js b/iconkit/icon.js
index fa163a9d..e60cd60e 100644
--- a/iconkit/icon.js
+++ b/iconkit/icon.js
@@ -5,6 +5,12 @@ const loader = PIXI.Loader.shared
const loadedNewIcons = {}
+const TAU = Math.PI * 2
+//by default, converts degrees to rads
+const toRadians = (angle, perigon = 360) => TAU / perigon * angle
+//by default, converts rad to deg
+const fromRadians = (rad, perigon = 360) => rad / (TAU / perigon)
+
let positionMultiplier = 4
function positionPart(part, partIndex, layer, formName, isNew, isGlow) {
let truePosMultiplier = positionMultiplier / (isNew ? 2 : 1)
@@ -278,7 +284,7 @@ class Icon {
y: newPart.pos[1] * truePosMultiplier * -1,
scaleX: newPart.scale[0],
scaleY: newPart.scale[1],
- rotation: realRot * (Math.PI / 180) // radians
+ rotation: toRadians(realRot)
}
if (newPart.flipped[0]) movementData.scaleX *= -1
if (newPart.flipped[1]) movementData.scaleY *= -1
From e3e1342adbf13a99bbd144544f2b6edd5e24c48b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 14:57:45 -0400
Subject: [PATCH 12/60] Replaced `perigon` by `scale`
---
iconkit/icon.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/iconkit/icon.js b/iconkit/icon.js
index e60cd60e..6bafb3dd 100644
--- a/iconkit/icon.js
+++ b/iconkit/icon.js
@@ -7,9 +7,10 @@ const loadedNewIcons = {}
const TAU = Math.PI * 2
//by default, converts degrees to rads
-const toRadians = (angle, perigon = 360) => TAU / perigon * angle
+const toRadians = (angle, scale = 360) => TAU / scale * angle
//by default, converts rad to deg
-const fromRadians = (rad, perigon = 360) => rad / (TAU / perigon)
+const fromRadians = (rad, scale = 360) => rad / (TAU / scale)
+//`scale` is the num of subdivisions in a cycle. More info: https://en.wikipedia.org/wiki/Turn_(angle)
let positionMultiplier = 4
function positionPart(part, partIndex, layer, formName, isNew, isGlow) {
From 3d68f0e464385c2b79d031a4b34d0d68cdcff606 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 17:03:49 -0400
Subject: [PATCH 13/60] icon.js and global.js
---
iconkit/icon.js | 9 +++++----
misc/global.js | 45 +++++++++++++++++++++++----------------------
2 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/iconkit/icon.js b/iconkit/icon.js
index 6bafb3dd..472bea1a 100644
--- a/iconkit/icon.js
+++ b/iconkit/icon.js
@@ -6,11 +6,12 @@ const loader = PIXI.Loader.shared
const loadedNewIcons = {}
const TAU = Math.PI * 2
-//by default, converts degrees to rads
+// by default, converts degrees to rads
const toRadians = (angle, scale = 360) => TAU / scale * angle
-//by default, converts rad to deg
+// by default, converts rad to deg
const fromRadians = (rad, scale = 360) => rad / (TAU / scale)
-//`scale` is the num of subdivisions in a cycle. More info: https://en.wikipedia.org/wiki/Turn_(angle)
+// `scale` is the num of subdivisions in a cycle. More info: https://en.wikipedia.org/wiki/Turn_(angle)
+// `scale = 400` corresponds to gradians, `256` to byte radians, and `100` to percentage of a turn
let positionMultiplier = 4
function positionPart(part, partIndex, layer, formName, isNew, isGlow) {
@@ -38,7 +39,7 @@ function positionPart(part, partIndex, layer, formName, isNew, isGlow) {
function sanitizeNum(val, defaultVal) {
let colVal = +val
- //yes, it also checks for NaN
+ // yes, it also checks for NaN
return isFinite(colVal) ? colVal : defaultVal
}
diff --git a/misc/global.js b/misc/global.js
index 4a65a7b2..8e083877 100644
--- a/misc/global.js
+++ b/misc/global.js
@@ -10,26 +10,27 @@ $('body').append(`
$(window).resize(function () {
- if (window.innerHeight > window.innerWidth - 75) {
- $('#everything').hide();
- $('#tooSmall').show();
- }
- else {
- $('#everything').show();
- $('#tooSmall').hide()
- }
+ //these alternatives maybe helpful: https://stackoverflow.com/a/4917796
+ let portrait = window.innerHeight > window.innerWidth - 75
+ $('#everything')[portrait ? 'hide' : 'show']()
+ $('#tooSmall')[portrait ? 'show' : 'hide']()
});
+let isDownloadURL = () => window.location.href.endsWith('?download')
+
function saveUrl() {
- if (window.location.href.endsWith('?download')) return;
- sessionStorage.setItem('prevUrl', window.location.href);
+ if ( !isDownloadURL() ) sessionStorage.setItem('prevUrl', window.location.href);
}
function backButton() {
- if (window.history.length > 1 && document.referrer.startsWith(window.location.origin)){
- if (window.location.href.endsWith('?download') && sessionStorage.getItem('prevUrl') === window.location.href.replace('?download', '')) window.history.go(-2);
- else window.history.back()
- }
+ if (window.history.length > 1 && document.referrer.startsWith(window.location.origin)) {
+ let steps = (
+ isDownloadURL() &&
+ sessionStorage.getItem('prevUrl') === window.location.href.replace('?download', '')
+ ? -2 : -1
+ )
+ window.history.go(steps)
+ }
else window.location.href = "../../../../../"
}
@@ -47,14 +48,14 @@ function Fetch(link) {
})
}
-let allowEsc = true;
-let popupEsc = true;
+let allowEsc = true
+let popupEsc = true
$(document).keydown(function(k) {
if (k.keyCode == 27) { //esc
if (!allowEsc) return
k.preventDefault()
- if (popupEsc && $('.popup').is(":visible")) $('.popup').hide();
+ if (popupEsc && $('.popup').is(":visible")) $('.popup').hide();
else $('#backButton').trigger('click')
}
});
@@ -71,9 +72,9 @@ async function renderIcons() {
if (overrideLoader) return
let iconsToRender = $('gdicon:not([rendered], [dontload])')
if (iconsToRender.length < 1) return
- if (!iconData) iconData = await Fetch("../api/icons")
- if (!iconCanvas) iconCanvas = document.createElement('canvas')
- if (!iconRenderer) iconRenderer = new PIXI.Application({ view: iconCanvas, width: 300, height: 300, backgroundAlpha: 0});
+ iconData ||= await Fetch("../api/icons")
+ iconCanvas ||= document.createElement('canvas')
+ iconRenderer ||= new PIXI.Application({ view: iconCanvas, width: 300, height: 300, backgroundAlpha: 0});
if (loader.loading) return overrideLoader = true
buildIcon(iconsToRender, 0)
}
@@ -120,9 +121,9 @@ function finishIcon(currentIcon, name, data) {
}
// reset scroll
-while ($(this).scrollTop() != 0) {
+while ($(this).scrollTop() != 0)
$(this).scrollTop(0);
-}
+
$(document).ready(function() {
$(window).trigger('resize');
From 6f700502fc3cf9485ad20ca4ac0d0943ab498149 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 17:29:30 -0400
Subject: [PATCH 14/60] Finished `global.js` (I guess)
---
misc/global.js | 46 ++++++++++++++++++++++------------------------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/misc/global.js b/misc/global.js
index 8e083877..2bac94a1 100644
--- a/misc/global.js
+++ b/misc/global.js
@@ -29,8 +29,8 @@ function backButton() {
sessionStorage.getItem('prevUrl') === window.location.href.replace('?download', '')
? -2 : -1
)
- window.history.go(steps)
- }
+ window.history.go(steps)
+ }
else window.location.href = "../../../../../"
}
@@ -52,12 +52,11 @@ let allowEsc = true
let popupEsc = true
$(document).keydown(function(k) {
- if (k.keyCode == 27) { //esc
- if (!allowEsc) return
- k.preventDefault()
- if (popupEsc && $('.popup').is(":visible")) $('.popup').hide();
- else $('#backButton').trigger('click')
- }
+ const ESC = 27
+ if (k.keyCode != ESC || !allowEsc) return;
+ k.preventDefault()
+ if (popupEsc && $('.popup').is(":visible")) $('.popup').hide();
+ else $('#backButton').trigger('click')
});
let iconData = null
@@ -126,32 +125,31 @@ while ($(this).scrollTop() != 0)
$(document).ready(function() {
- $(window).trigger('resize');
-});
+ $(window).trigger('resize')
+})
// Adds all necessary elements into the tab index (all buttons and links that aren't natively focusable)
-const inaccessibleLinkSelector = "*:not(a) > img.gdButton, .leaderboardTab, .gdcheckbox, .diffDiv, .lengthDiv";
+const inaccessibleLinkSelector = "*:not(a) > img.gdButton, .leaderboardTab, .gdcheckbox, .diffDiv, .lengthDiv"
-document.querySelectorAll(inaccessibleLinkSelector).forEach(elem => {
- elem.setAttribute('tabindex', 0);
-})
+document.querySelectorAll(inaccessibleLinkSelector)
+ .forEach(elem => { elem.setAttribute('tabindex', 0) })
document.getElementById('backButton')?.setAttribute('tabindex', 1); // Prioritize back button, first element to be focused
// Event listener to run a .click() function if
window.addEventListener("keydown", e => {
- if(e.key !== 'Enter') return;
+ if(e.key !== 'Enter') return
- const active = document.activeElement;
- const isUnsupportedLink = active.hasAttribute('tabindex'); // Only click on links that aren't already natively supported to prevent double clicking
- if(isUnsupportedLink) active.click();
+ const active = document.activeElement
+ const isUnsupportedLink = active.hasAttribute('tabindex') // Only click on links that aren't already natively supported to prevent double clicking
+ if(isUnsupportedLink) active.click();
})
// stolen from stackoverflow
$.fn.isInViewport = function () {
- let elementTop = $(this).offset().top;
- let elementBottom = elementTop + $(this).outerHeight();
- let viewportTop = $(window).scrollTop();
- let viewportBottom = viewportTop + $(window).height();
- return elementBottom > viewportTop && elementTop < viewportBottom;
-};
+ let elementTop = $(this).offset().top
+ let elementBottom = elementTop + $(this).outerHeight()
+ let viewportTop = $(window).scrollTop()
+ let viewportBottom = viewportTop + $(window).height()
+ return elementBottom > viewportTop && elementTop < viewportBottom
+}
From 51e676fee3d2088ddb85f85b5511854d241683ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 17:52:23 -0400
Subject: [PATCH 15/60] dragscroll.js
---
misc/dragscroll.js | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/misc/dragscroll.js b/misc/dragscroll.js
index 8646f7f9..948fc18d 100644
--- a/misc/dragscroll.js
+++ b/misc/dragscroll.js
@@ -1,7 +1,7 @@
function somethingSelected() {
return typeof window.getSelection == 'function' && window.getSelection().toString() != "";
}
-const remover = / |\n|\t/g;
+const remover = / |\n|\t/g; //should it be /\s/g ?
$('.dragscroll').each(function(_, el) {
let previouslyMouseDown = false;
el.addEventListener('mousemove', function(e) {
@@ -13,13 +13,15 @@ $('.dragscroll').each(function(_, el) {
}
return;
}
- if (somethingSelected())
- return;
+ if (somethingSelected()) return;
if (!previouslyMouseDown) {
- for (let el of e.target.childNodes) {
- if (el.nodeType === Node.TEXT_NODE && el.textContent.replace(remover, '').length)
- return;
- }
+ if ([...e.target.childNodes].some(
+ el => el.nodeType === Node.TEXT_NODE
+ &&
+ el.textContent.replace(remover, '').length
+ )
+ ) return;
+
el.style['user-select'] = 'none';
el.style['-webkit-user-select'] = 'none';
previouslyMouseDown = true;
From 5b3da23417aa2559889bfba336270de47390ac9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Tue, 14 Jun 2022 17:56:06 -0400
Subject: [PATCH 16/60] I added too much indent, fixed now
---
misc/dragscroll.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/misc/dragscroll.js b/misc/dragscroll.js
index 948fc18d..c48589b6 100644
--- a/misc/dragscroll.js
+++ b/misc/dragscroll.js
@@ -16,11 +16,11 @@ $('.dragscroll').each(function(_, el) {
if (somethingSelected()) return;
if (!previouslyMouseDown) {
if ([...e.target.childNodes].some(
- el => el.nodeType === Node.TEXT_NODE
- &&
- el.textContent.replace(remover, '').length
- )
- ) return;
+ el => el.nodeType === Node.TEXT_NODE
+ &&
+ el.textContent.replace(remover, '').length
+ )
+ ) return;
el.style['user-select'] = 'none';
el.style['-webkit-user-select'] = 'none';
From bc155225a4d000a040c71d3e6b5cb90230aca193 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Fern=C3=A1ndez=20Serrata?=
<76864299+Rudxain@users.noreply.github.com>
Date: Wed, 15 Jun 2022 10:40:44 -0400
Subject: [PATCH 17/60] Added `randRange`
---
html/home.html | 18 +++++++++---------
misc/global.js | 1 +
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/html/home.html b/html/home.html
index 99ed630f..6689b67e 100644
--- a/html/home.html
+++ b/html/home.html
@@ -40,14 +40,14 @@
-
+
Note
Level downloading has been blocked by RobTop.
Level analysis, daily levels, and downloading extra info will not work until he chooses to unblock downloads.
These features still work locally and on private servers
-
+
${x.likes}
$(this).css('font-size', (3.5 - (overflow)) + 'vh') } - }); + }) renderIcons() $('#loading').hide() @@ -356,7 +355,7 @@${x.likes}
} $('#topSort').click(function() { - if (mode == "top" || loadingComments) return; + if (mode == "top" || loadingComments) return resetSort() mode = "top"; $('#timeSort').attr('src', "../assets/sort-time.png") @@ -365,7 +364,7 @@${x.likes}
}) $('#timeSort').click(function() { - if (mode == "time" || loadingComments) return; + if (mode == "time" || loadingComments) return resetSort() mode = "time"; $('#timeSort').attr('src', "../assets/sort-time-on.png") @@ -374,16 +373,16 @@${x.likes}
}) $('#compactMode').click(function() { - if (loadingComments) return; + if (loadingComments) return compact = !compact - lastPage = 0; + castPage = 0; page = 0; $('#compactMode').attr('src', `../assets/compact-${compact ? "on" : "off"}.png`) appendComments() }) $('#autoMode').click(function() { - if (loadingComments) return; + if (loadingComments) return auto = !auto mode = "time" page = 0; @@ -407,8 +406,8 @@${x.likes}
$(document).on('click', '.refreshBtn', function () { if (loadingComments) return - lastPage = 0; - page = 0; + lastPage = 0 + page = 0 appendComments(false, true) }) @@ -446,7 +445,7 @@${x.likes}
mode = "time" page = 0 appendComments() - }) + }) .fail(e => {allowEsc = true; $('.postbutton').show();$('#message').text(e.responseText.includes("DOCTYPE") ? "Something went wrong..." : e.responseText)}) }) }) @@ -465,7 +464,7 @@${x.likes}
let commentID = 0 let lvID = 0 -let likeCount, likeImg; +let likeCount, likeImg let likedComments; $(document).on('click', '.likeComment', function(cmnt) { @@ -473,7 +472,7 @@${x.likes}
commentID = $(this).attr('commentID') likedComments = localStorage.likedComments ? JSON.parse(localStorage.likedComments) : [] - if (likedComments.includes(commentID)) return; + if (likedComments.includes(commentID)) return lvID = $(this).attr('levelID') || 0 likeImg = $(this).find('img') @@ -483,7 +482,7 @@${x.likes}
$('#submitVote').click(function() { - if (likedComments.includes(commentID)) return $('#likeMessage').text("You've already liked/disliked this comment!"); + if (likedComments.includes(commentID)) return $('#likeMessage').text("You've already liked/disliked this comment!") let ID = commentID let username = $('#like-username').val() @@ -491,7 +490,7 @@${x.likes}
let extraID = lvID || window.location.pathname.split('/')[2] let accountID = 0 let likeType = like ? "1" : "0" - + if (!ID || !username || !password || loadingComments) return $('#postComment').hide() $('#likeMessage').text(like ? "Liking..." : "Disliking... :(") @@ -515,7 +514,7 @@${x.likes}
allowEsc = true likedComments.push(commentID) localStorage.setItem('likedComments', JSON.stringify(likedComments)) - }) + }) .fail(e => {allowEsc = true; $('.postbutton').show();$('#likeMessage').text(e.responseText.includes("DOCTYPE") ? "Something went wrong..." : e.responseText)}) }) }) @@ -534,12 +533,12 @@${x.likes}
if (k.which == 13) k.preventDefault() //enter } - if (loadingComments || $('.popup').is(":visible")) return; + if (loadingComments || $('.popup').is(":visible")) return if (k.which == 37 && $('#pageDown').is(":visible")) { //left $('#pageDown').trigger('click') } - + if (k.which == 39 && $('#pageUp').is(":visible")) { //right $('#pageUp').trigger('click') } @@ -548,4 +547,3 @@${x.likes}
}; - diff --git a/html/demon.html b/html/demon.html index 9cb842b1..a6110fea 100644 --- a/html/demon.html +++ b/html/demon.html @@ -39,7 +39,7 @@Credits
${y+1}
Filters
let difficulties = [] $('.diffDiv').each(function() {if ($(this).hasClass('selectedFilter')) difficulties.push($(this).attr('diff'))}) demonFilter = demonMode && difficulties[0] > 0 - + if (!difficulties.length) url += "" else if (!demonFilter) url += "&diff=" + undupe(difficulties).join(",") else url += "&diff=-2&demonFilter=" + difficulties[0] @@ -213,13 +213,13 @@Filters
function showDemonDiffs() { $('#difficulties').hide(); - $('#demons').show(); + $('#demons').show() demonMode = true; } function hideDemonDiffs() { $('#difficulties').show(); - $('#demons').hide(); + $('#demons').hide() demonMode = false; } @@ -262,9 +262,9 @@Filters
$(document).keydown(function(k) { let searchFocus = $(':focus-visible').length == 1 && $(':focus-visible').first().attr('id') == "levelName" if ((!$(':focus-visible').length || searchFocus) && k.which == 13) { // enter - if (!$('#customlist').is(':hidden')) k.preventDefault(); + if (!$('#customlist').is(':hidden')) k.preventDefault() else if ($('#filters').is(':hidden')) $('#searchBtn').trigger('click') - } + } }); $('#pageSize').on('input blur', function (event) { @@ -380,7 +380,7 @@Filters
$('#songName').html("1: " + music[1][0]) - $(document).on('click', '.songChange', function () { + $(document).on('click', '.songChange', function () { officialSong += Number($(this).attr('jump')) if (officialSong < 1) officialSong = 1 $('#songName').html(`${officialSong}: ${music[officialSong] ? music[officialSong][0] : officialSong == 69 ? "Nice" : "Unknown"}`) @@ -395,10 +395,10 @@Filters
} $(document).keydown(function(k) { - if (customSong) return; + if (customSong) return if (k.which == 37) $('#songDown').trigger('click') // left if (k.which == 39) $('#songUp').trigger('click') // right - }); + }) if (onePointNine) { $('#userSearch').hide() diff --git a/html/iconkit.html b/html/iconkit.html index 3d76bf7b..bfdf8e59 100644 --- a/html/iconkit.html +++ b/html/iconkit.html @@ -25,7 +25,7 @@Copy Icon
Settings
@@ -33,7 +33,7 @@Settings<
-
No UFO Dome
Unsort Colors
Cursed animations
(Hover over a setting for information)
Speed: