Added editor time because I can

This commit is contained in:
GDColon 2020-11-16 11:38:03 -05:00
parent bc5d0b8d81
commit 939103cee2
9 changed files with 42 additions and 17 deletions

View file

@ -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)

View file

@ -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"

View file

@ -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;
}

View file

@ -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

View file

@ -112,7 +112,7 @@
</div>
<br>
<p class="reveal" onclick="$('#response-level').slideToggle(100);"><b>Response (36)</b></p>
<p class="reveal" onclick="$('#response-level').slideToggle(100);"><b>Response (38)</b></p>
<div class="subdiv" id="response-level">
<p class="br">*Values that require a download are in
<span style="color:red">red</span>
@ -154,6 +154,8 @@
<p class="red">uploaded: Time since the level was uploaded (sent as "x days/weeks/months" ago, since it's all the API sends)</p>
<p class="red">updated: Time since the level was last updated</p>
<p class="red">password: The password to copy the level. 0 means the level isn't copyable and 1 means it's free to copy</p>
<p class="red">editorTime: The amount of seconds spent in the editor</p>
<p class="red">totalEditorTime: The amount of seconds spent in the editor, including time from the level it was copied from</p>
<p class="red">ldm: If the level contains a checkbox for Low Detail Mode</p>
<p class="red">extraString: An unknown string which most likely contains info on how the level was verified</p>
<p class="red">data: The actual data of the level, compressed with GZIP</p>

View file

@ -21,7 +21,7 @@
All demons and rankings are managed by their <span style="color: #4CDA5B">list staff</span>.
</p>
<p class="bigger center" style="margin-top: 1vh">
Usernames and icons may <span style="color: yellow">differ</span> from what is used in GD
Usernames may <span style="color: yellow">differ</span> from what is used in GD
</p>
<img src="../assets/ok.png" width=15%; class="gdButton center" onclick="$('.popup').hide()">
</div>

View file

@ -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 => {
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>${x.header}</h1><br>
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./u/${x.ign || x.name}">${x.name}</h2></a>
<img src="./icon/${x.ign || x.name}" height=30%; style="margin-bottom: 7%"><br>
<img class="creditsicon" icon="./icon/${x.ign || x.name}" height=30%; style="margin-bottom: 7%"><br>
<a target=_blank href="${x.youtube[0]}"><img src="../assets/${x.youtube[1]}.png" width="11%" class="gdButton"></a>
<a target=_blank href="${x.twitter[0]}"><img src="../assets/${x.twitter[1]}.png" width="11%" class="sideSpace gdButton"></a>
<a target=_blank href="${x.github[0]}"><img src="../assets/${x.github[1]}.png" width="11%" class="sideSpace gdButton"></a>
@ -121,7 +124,7 @@ fetch(`./api/credits`).then(res => res.json()).then(res => {
n = x.split("/")
$('#specialthanks').append(`<div class="specialThanks">
<h2 class="gdButton smaller"><a href="./u/${n[1] || n[0]}">${n[0]}</h2></a>
<img src="./icon/${n[1] || n[0]}" height=77%><br>
<img class="creditsicon" icon="./icon/${n[1] || n[0]}" height=77%><br>
</div>`)
})

View file

@ -18,7 +18,7 @@
<h2 class="smaller center" style="font-size: 5.5vh">Level Info</h2>
<p class="bigger center" id="levelInfo" style="line-height: 5vh; margin-top: 1.5vh;">
<span class="pre" style="color:lime">[[NAME]]</span><br>
ID: <span style="color:yellow">[[ID]]</span>[[ORIGINALINFO]][[LOWDETAIL]][[PASS]][[UPLOAD]][[UPDATE]][[HACKED]]
ID: <span style="color:yellow">[[ID]]</span>[[ORIGINALINFO]][[LOWDETAIL]][[PASS]][[UPLOAD]][[UPDATE]][[TIME1]][[TIME2]][[EXTRA]]
<br>Version: <span style="color:yellow">[[VERSION]]</span>
<br>GD Version: <span style="color:yellow">[[GAMEVERSION]]</span>
[[OBJECTINFO]][[REQUESTED]]
@ -154,6 +154,12 @@
let messageText = 'Your <span style="color: yellow">Geometry Dash password</span> will <span style="color: lime">not be stored</span> anywhere on the site, both <span style="color:rgb(113, 234, 255)">locally and server-side.</span> You can view the code used for liking a level <a class="menuLink" target="_blank" href="https://github.com/GDColon/GDBrowser/blob/master/api/post/like.js">here</a>.'
$('#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]]', `<br>Password: <span style="color:orange">${'[[PASSWORD]]' == '0' ? "No copy" : '[[PASSWORD]]' == 1 ? "Free copy" : '[[PASSWORD]]'}</span>`)
.replace('[[LOWDETAIL]]', `<br>Low Detail: <span style="color:orange">${[[LDM]] ? "Yes" : "No"}</span>`)
.replace('[[HACKED]]', `<br>Extra String: <span style="color:orange">${'[[EXTRASTRING]]'.length} chars</span>`)
.replace('[[TIME1]]', [[EDITORTIME]] == 0 ? "" : `<br>Editor Time: <span style="color:lightgreen">${colonize([[EDITORTIME]])}</span>`)
.replace('[[TIME2]]', [[TOTALEDITORTIME]] == 0 ? "" : `<br>Editor Time (+copies): <span style="color:lightgreen">${colonize([[TOTALEDITORTIME]])}</span>`)
.replace('[[EXTRA]]', `<br>Extra String: <span style="color:lightgreen">${'[[EXTRASTRING]]'.length} chars</span>`)
.replace('[[UPLOAD]]', '[[UPLOADED]]' == "0" ? "" : `<br>Uploaded: <span style="color:orange">[[UPLOADED]]</span>`)
.replace('[[UPDATE]]', '[[UPDATED]]' == "0" ? "" : `<br>Updated: <span style="color:orange">[[UPDATED]]</span>`))}
@ -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]]', "") +
`<br><a class="youCanClickThis" href="/[[ID]]?download"><span style="color:aqua">Download additional info</span></a>`

View file

@ -61,14 +61,14 @@
],
"specialThanks": [
"Qufy",
"AlFas",
"ViPriN",
"Cvolton",
"Ucrash",
"zmxmx",
"101arrowz",
"Figment/FigmentBoy",
"Wylie/TheWylieMaster"
"Qufy",
"Ucrash",
"ViPriN",
"Wylie/TheWylieMaster",
"zmxmx",
"101arrowz"
]
}