From 939103cee29c45ac97327580d3fd8bee582d0c8a Mon Sep 17 00:00:00 2001 From: GDColon Date: Mon, 16 Nov 2020 11:38:03 -0500 Subject: [PATCH] Added editor time because I can --- api/download.js | 2 +- api/level.js | 2 +- assets/css/browser.css | 9 +++++++++ classes/Level.js | 5 +++-- html/api.html | 4 +++- html/demon.html | 2 +- html/home.html | 7 +++++-- html/level.html | 16 +++++++++++++--- misc/credits.json | 12 ++++++------ 9 files changed, 42 insertions(+), 17 deletions(-) diff --git a/api/download.js b/api/download.js index af0156d..bd64bf8 100644 --- a/api/download.js +++ b/api/download.js @@ -23,7 +23,7 @@ module.exports = async (app, req, res, api, ID, analyze) => { } let levelInfo = app.parseResponse(body) - let level = new Level(levelInfo) + let level = new Level(levelInfo, true) request.post(app.endpoint + 'getGJUsers20.php', req.gdParams({ str: level.authorID }), function (err1, res1, b1) { let gdSearchResult = app.parseResponse(b1) diff --git a/api/level.js b/api/level.js index 60e072d..091fa45 100644 --- a/api/level.js +++ b/api/level.js @@ -35,7 +35,7 @@ module.exports = async (app, req, res, api, analyze) => { song = app.parseResponse(song, '~|~') let levelInfo = app.parseResponse(preRes[0]) - let level = new Level(levelInfo, author) + let level = new Level(levelInfo, false, author) if (song[2]) { level.songName = song[2] || "Unknown" diff --git a/assets/css/browser.css b/assets/css/browser.css index 7268bd0..ea300ed 100644 --- a/assets/css/browser.css +++ b/assets/css/browser.css @@ -381,6 +381,11 @@ input::-webkit-inner-spin-button { margin-left: 25%; } +.downloadInfo { + width: 40vh; + display: inline-block; +} + .diffDiv { display: inline-block; width: 10%; @@ -1098,6 +1103,10 @@ input::-webkit-inner-spin-button { color: rgb(85, 204, 55); } +.lightgreen { + color: #4CDA5B +} + .whatIfItWasPurple { color: #FF82FF; } diff --git a/classes/Level.js b/classes/Level.js index 1f38a57..4ff1e23 100644 --- a/classes/Level.js +++ b/classes/Level.js @@ -6,7 +6,7 @@ let length = ['Tiny', 'Short', 'Medium', 'Long', 'XL'] let difficulty = { 0: 'Unrated', 10: 'Easy', 20: 'Normal', 30: 'Hard', 40: 'Harder', 50: 'Insane' } class Level { - constructor(levelInfo, author = []) { + constructor(levelInfo, download, author = []) { if (!levelInfo[2]) return; this.name = levelInfo[2]; this.id = levelInfo[1]; @@ -27,8 +27,9 @@ class Level { this.gameVersion = levelInfo[13] > 17 ? (levelInfo[13] / 10).toFixed(1) : levelInfo[13] == 11 ? "1.8" : levelInfo[13] == 10 ? "1.7" : "Pre-1.7" if (levelInfo[28]) this.uploaded = levelInfo[28] + config.timestampSuffix if (levelInfo[29]) this.updated = levelInfo[29] + config.timestampSuffix - this.version = +levelInfo[5]; + if (download) { this.editorTime = +levelInfo[46] || 0; this.totalEditorTime = +levelInfo[47] || 0 } if (levelInfo[27]) this.password = levelInfo[27]; + this.version = +levelInfo[5]; this.copiedID = levelInfo[30] this.twoPlayer = levelInfo[31] > 0 this.officialSong = levelInfo[12] != 0 ? parseInt(levelInfo[12]) + 1 : 0 diff --git a/html/api.html b/html/api.html index 55648c7..2383d91 100644 --- a/html/api.html +++ b/html/api.html @@ -112,7 +112,7 @@
-

Response (36)

+

Response (38)

*Values that require a download are in red @@ -154,6 +154,8 @@

uploaded: Time since the level was uploaded (sent as "x days/weeks/months" ago, since it's all the API sends)

updated: Time since the level was last updated

password: The password to copy the level. 0 means the level isn't copyable and 1 means it's free to copy

+

editorTime: The amount of seconds spent in the editor

+

totalEditorTime: The amount of seconds spent in the editor, including time from the level it was copied from

ldm: If the level contains a checkbox for Low Detail Mode

extraString: An unknown string which most likely contains info on how the level was verified

data: The actual data of the level, compressed with GZIP

diff --git a/html/demon.html b/html/demon.html index 81c089b..0b7e0b7 100644 --- a/html/demon.html +++ b/html/demon.html @@ -21,7 +21,7 @@ All demons and rankings are managed by their list staff.

- Usernames and icons may differ from what is used in GD + Usernames may differ from what is used in GD

diff --git a/html/home.html b/html/home.html index 0782726..0e5116c 100644 --- a/html/home.html +++ b/html/home.html @@ -89,6 +89,9 @@ function loadCredits() { $('#credits').show() if (page == lastPage) $('#closeCredits').css('height', '52%') else $('#closeCredits').css('height', xButtonPos) + $('.creditsicon:visible').each(function() { // only load icons when necessary + $(this).attr('src', $(this).attr('icon')) + }) } fetch(`./api/credits`).then(res => res.json()).then(res => { @@ -99,7 +102,7 @@ fetch(`./api/credits`).then(res => res.json()).then(res => {

${x.header}


${x.name}

-
+
@@ -121,7 +124,7 @@ fetch(`./api/credits`).then(res => res.json()).then(res => { n = x.split("/") $('#specialthanks').append(`

${n[0]}

-
+
`) }) diff --git a/html/level.html b/html/level.html index 82f5f85..81c39e9 100644 --- a/html/level.html +++ b/html/level.html @@ -18,7 +18,7 @@

Level Info

[[NAME]]
- ID: [[ID]][[ORIGINALINFO]][[LOWDETAIL]][[PASS]][[UPLOAD]][[UPDATE]][[HACKED]] + ID: [[ID]][[ORIGINALINFO]][[LOWDETAIL]][[PASS]][[UPLOAD]][[UPDATE]][[TIME1]][[TIME2]][[EXTRA]]
Version: [[VERSION]]
GD Version: [[GAMEVERSION]] [[OBJECTINFO]][[REQUESTED]] @@ -154,6 +154,12 @@ let messageText = 'Your Geometry Dash password will not be stored anywhere on the site, both locally and server-side. You can view the code used for liking a level here.' $('#message').html(messageText) +function colonize(num) { + let date = new Date(0) + date.setSeconds(+num) + return date.toISOString().split("T")[1].split(".")[0] +} + if (window.location.href.endsWith('?download')) $('#infoDiv').show() let copyMessages = ["ID copied to clipboard", "ID copied x[C]!", "ID copied again!", "ID copied once more!", "ID clipboard to copied!", "ID copied yet again!", "As you wish", "Copy that!", "This one actually works", "You can't play levels, son", "Keep it coming", "Click again, I dare you", "C-C-C-C-COPIED!", @@ -190,7 +196,9 @@ if (!'[[UPLOADED]]'.startsWith('[')) { $('#levelInfo').html($('#levelInfo').html() .replace('[[PASS]]', `
Password: ${'[[PASSWORD]]' == '0' ? "No copy" : '[[PASSWORD]]' == 1 ? "Free copy" : '[[PASSWORD]]'}`) .replace('[[LOWDETAIL]]', `
Low Detail: ${[[LDM]] ? "Yes" : "No"}`) - .replace('[[HACKED]]', `
Extra String: ${'[[EXTRASTRING]]'.length} chars`) + .replace('[[TIME1]]', [[EDITORTIME]] == 0 ? "" : `
Editor Time: ${colonize([[EDITORTIME]])}`) + .replace('[[TIME2]]', [[TOTALEDITORTIME]] == 0 ? "" : `
Editor Time (+copies): ${colonize([[TOTALEDITORTIME]])}`) + .replace('[[EXTRA]]', `
Extra String: ${'[[EXTRASTRING]]'.length} chars`) .replace('[[UPLOAD]]', '[[UPLOADED]]' == "0" ? "" : `
Uploaded: [[UPLOADED]]`) .replace('[[UPDATE]]', '[[UPDATED]]' == "0" ? "" : `
Updated: [[UPDATED]]`))} @@ -198,7 +206,9 @@ else { $('#levelInfo').html($('#levelInfo').html() .replace('[[PASS]]', "") .replace('[[LOWDETAIL]]', "") - .replace('[[HACKED]]', "") + .replace('[[EXTRA]]', "") + .replace('[[TIME1]]', "") + .replace('[[TIME2]]', "") .replace('[[UPLOAD]]', "") .replace('[[UPDATE]]', "") + `
Download additional info` diff --git a/misc/credits.json b/misc/credits.json index 43db2cd..fe2fe2a 100644 --- a/misc/credits.json +++ b/misc/credits.json @@ -61,14 +61,14 @@ ], "specialThanks": [ - "Qufy", "AlFas", - "ViPriN", "Cvolton", - "Ucrash", - "zmxmx", - "101arrowz", "Figment/FigmentBoy", - "Wylie/TheWylieMaster" + "Qufy", + "Ucrash", + "ViPriN", + "Wylie/TheWylieMaster", + "zmxmx", + "101arrowz" ] } \ No newline at end of file