Moved credits and icon.js forms to a JSON

This commit is contained in:
GDColon 2019-10-20 23:33:01 -04:00
parent 884cb268ef
commit da06a1a702
8 changed files with 161 additions and 147 deletions

View file

@ -4,36 +4,8 @@ const fs = require('fs');
const path = require('path');
const icons = require('../icons/gameSheet.json');
const colors = require('../misc/colors.json');
const queryMapper = {
ship: {
form: 'ship',
ind: 22
},
ball: {
form: 'player_ball',
ind: 23
},
ufo: {
form: 'bird',
ind: 24
},
wave: {
form: 'dart',
ind: 25
},
robot: {
form: 'robot',
ind: 26
},
spider: {
form: 'spider',
ind: 43
},
cursed: {
form: 'spider',
ind: 43
}
}
const forms = require('../icons/forms.json')
function recolor(img, col) {
return img.scan(0, 0, img.bitmap.width, img.bitmap.height, function (x, y, idx) {
if (img.bitmap.data.slice(idx, idx+3).every(function(val) {return val >= 20 && val <= 255})) { // If it's not "black, i.e. we want to recolor it"
@ -54,6 +26,7 @@ function fromIcons(filename) {
return `./icons/${filename}`;
}
let cache = {};
module.exports = async (app, req, res) => {
let username = req.params.text
@ -83,7 +56,7 @@ module.exports = async (app, req, res) => {
account[response2[i]] = response2[i + 1]
}
let { form, ind } = queryMapper[req.query.form] || {};
let { form, ind } = forms[req.query.form] || {};
form = form || 'player';
ind = ind || 21;

View file

@ -619,6 +619,18 @@ input::-webkit-inner-spin-button {
height: 5.5%;
}
.githubChad {
display: inline-block;
width: 30%;
height: 20%;
margin: 1% 0%;
}
.githubChad h2 {
margin-bottom: 3%;
font-size: 4vh;
}
.analysis {
height: 20%;
width: 90%;

View file

@ -150,7 +150,7 @@ $('.levelSearch').click(function() {
if (url.endsWith('?type=0')) url = url.slice(0, -7)
window.location.href = url
window.location.href = url.replace(/\?type=0&/, "?")
})

View file

@ -16,121 +16,6 @@
<div id="everything">
<div class="popup" id="credits">
<div id="credits1" class="subCredits" style="display: none;">
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>Programming/Website</h1><br>
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./profile/colon">Colon</h2></a>
<img src="./icon/colon" height=30%; style="margin-bottom: 7%"><br>
<a target=_blank href="https://www.youtube.com/channel/UCFDsxSlQXpLLpVScy2NmbcQ"><img src="../assets/youtube.png" width="11%" class="gdButton"></a>
<a target=_blank href="https://twitter.com/TheRealGDColon"><img src="../assets/twitter.png" width="11%" class="sideSpace gdButton"></a>
<a target=_blank href="https://github.com/GDColon"><img src="../assets/github.png" width="11%" class="sideSpace gdButton"></a>
<br>
</div>
<img class="gdButton" id="creditPageUp" src="../assets/arrow-right.png" width="60vh" style="position: absolute; top: 45%; left: 75%" onclick="page += 1; loadCredits()">
</div>
<div id="credits2" class="subCredits" style="display: none;">
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>Accurate Leaderboard</h1><br>
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./profile/SMJSGaming">SMJSGaming</h2></a>
<img src="./icon/SMJSGaming" height=30%; style="margin-bottom: 7%"><br>
<a target=_blank href="https://www.youtube.com/channel/UCwEsWDs9kGN2vvoiNTJKdaQ"><img src="../assets/youtube.png" width="11%" class="gdButton"></a>
<a target=_blank href="https://www.instagram.com/smjs_gaming"><img src="../assets/instagram.png" width="11%" class="sideSpace gdButton"></a>
<a target=_blank href="https://github.com/SMJSGaming"><img src="../assets/github.png" width="11%" class="sideSpace gdButton"></a>
<br>
</div>
<img class="gdButton" id="creditPageUp" src="../assets/arrow-right.png" width="60vh" style="position: absolute; top: 45%; left: 75%" onclick="page += 1; loadCredits()">
<img class="gdButton" id="creditPageUp" src="../assets/arrow-left.png" width="60vh" style="position: absolute; top: 45%; right: 75%" onclick="page -= 1; loadCredits()">
</div>
<div id="credits3" class="subCredits" style="display: none;">
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>Level Analyzing Help</h1><br>
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./profile/alten">Alten</h2></a>
<img src="./icon/alten" height=30%; style="margin-bottom: 7%"><br>
<a target=_blank href="https://youtube.com/channel/UC9M8hLqh2yZIPSDvpyL7o8g"><img src="../assets/youtube.png" width="11%" class="gdButton"></a>
<a target=_blank href="https://twitter.com/gd_alten"><img src="../assets/twitter.png" width="11%" class="sideSpace gdButton"></a>
<a target=_blank href="https://github.com/Altenhh"><img src="../assets/github.png" width="11%" class="sideSpace gdButton"></a>
<br>
</div>
<img class="gdButton" id="creditPageUp" src="../assets/arrow-right.png" width="60vh" style="position: absolute; top: 45%; left: 75%" onclick="page += 1; loadCredits()">
<img class="gdButton" id="creditPageUp" src="../assets/arrow-left.png" width="60vh" style="position: absolute; top: 45%; right: 75%" onclick="page -= 1; loadCredits()">
</div>
<div id="credits4" class="subCredits" style="display: none;">
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>Level Analyzing Help</h1><br>
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./profile/AlFas">AlFas</h2></a>
<img src="./icon/AlFas" height=30%; style="margin-bottom: 7%"><br>
<a target=_blank href="https://youtube.com/user/Alex100077"><img src="../assets/youtube.png" width="11%" class="gdButton"></a>
<a target=_blank href="https://twitter.com/AlFas6237"><img src="../assets/twitter.png" width="11%" class="sideSpace gdButton"></a>
<a target=_blank href="https://github.com/AlFasGD"><img src="../assets/github.png" width="11%" class="sideSpace gdButton"></a>
<br>
</div>
<img class="gdButton" id="creditPageUp" src="../assets/arrow-right.png" width="60vh" style="position: absolute; top: 45%; left: 75%" onclick="page += 1; loadCredits()">
<img class="gdButton" id="creditPageUp" src="../assets/arrow-left.png" width="60vh" style="position: absolute; top: 45%; right: 75%" onclick="page -= 1; loadCredits()">
</div>
<div id="credits5" class="subCredits" style="display: none;">
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>API Help</h1><br>
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./profile/alex1304">Alex1304</h2></a>
<img src="./icon/alex1304" height=30%; style="margin-bottom: 7%"><br>
<a target=_blank href="https://youtube.com/channel/UC0hFAVN-GAbZYuf_Hfk1Iog"><img src="../assets/youtube.png" width="11%" class="gdButton"></a>
<a target=_blank href="https://twitter.com/gd_alex1304"><img src="../assets/twitter.png" width="11%" class="sideSpace gdButton"></a>
<a target=_blank href="https://github.com/Alex1304"><img src="../assets/github.png" width="11%" class="sideSpace gdButton"></a>
<br>
</div>
<img class="gdButton" id="creditPageUp" src="../assets/arrow-right.png" width="60vh" style="position: absolute; top: 45%; left: 75%" onclick="page += 1; loadCredits()">
<img class="gdButton" id="creditPageUp" src="../assets/arrow-left.png" width="60vh" style="position: absolute; top: 45%; right: 75%" onclick="page -= 1; loadCredits()">
</div>
<div id="credits6" class="subCredits" style="display: none;">
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>Web Design Help</h1><br>
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./profile/ucrash">Ucrash</h2></a>
<img src="./icon/Ucrash" height=30%; style="margin-bottom: 7%"><br>
<a target=_blank href="https://www.youtube.com/channel/UCfPgDZBhCodHIFo6OOVcH2A"><img src="../assets/youtube.png" width="11%" class="gdButton"></a>
<a target=_blank href="https://twitter.com/GDUcrash"><img src="../assets/twitter.png" width="11%" class="sideSpace gdButton"></a>
<a target=_blank href="https://github.com/GDUcrash"><img src="../assets/github.png" width="11%" class="sideSpace gdButton"></a>
<br>
</div>
<img class="gdButton" id="creditPageUp" src="../assets/arrow-right.png" width="60vh" style="position: absolute; top: 45%; left: 75%" onclick="page += 1; loadCredits()">
<img class="gdButton" id="creditPageUp" src="../assets/arrow-left.png" width="60vh" style="position: absolute; top: 45%; right: 75%" onclick="page -= 1; loadCredits()">
</div>
<div id="credits7" class="subCredits" style="display: none;">
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>Demon List API</h1><br>
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./profile/stardust1971">stardust1971</h2></a>
<img src="./icon/stardust1971" height=30%; style="margin-bottom: 7%"><br>
<a target=_blank href="https://www.youtube.com/user/stardust19710"><img src="../assets/youtube.png" width="11%" class="gdButton"></a>
<a target=_blank href="https://twitter.com/stadust1971"><img src="../assets/twitter.png" width="11%" class="sideSpace gdButton"></a>
<a target=_blank href="https://pointercrate.com/"><img src="../assets/demonButton.png" width="11%" class="sideSpace gdButton"></a>
<br>
</div>
<img class="gdButton" id="creditPageUp" src="../assets/arrow-right.png" width="60vh" style="position: absolute; top: 45%; left: 75%" onclick="page += 1; loadCredits()">
<img class="gdButton" id="creditPageUp" src="../assets/arrow-left.png" width="60vh" style="position: absolute; top: 45%; right: 75%" onclick="page -= 1; loadCredits()">
</div>
<div id="credits8" class="subCredits" style="display: none;">
<div class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>Everything Else</h1><br>
<h2 style="margin-bottom: 1.5%" class="gdButton"><a href="./profile/robtop">RobTop</h2></a>
<img src="./icon/robtop" height=30%; style="margin-bottom: 7%"><br>
<a target=_blank href="https://www.youtube.com/channel/UCz_yk8mDSAnxJq0ar66L4sw"><img src="../assets/youtube.png" width="11%" class="gdButton"></a>
<a target=_blank href="https://twitter.com/RobTopGames"><img src="../assets/twitter.png" width="11%" class="sideSpace gdButton"></a>
<a target=_blank href="https://www.facebook.com/geometrydash/"><img src="../assets/facebook.png" width="11%" class="sideSpace gdButton"></a>
<br>
</div>
<img class="gdButton" id="creditPageUp" src="../assets/arrow-left.png" width="60vh" style="position: absolute; top: 45%; right: 75%" onclick="page -= 1; loadCredits()">
</div>
<div class="center supercenter" style="width: 80vh; height: 43%; pointer-events: none;">
<img class="closeWindow gdButton" src="../assets/close.png" height="25%" style="position: absolute; top: -24%; left: -7vh; pointer-events: all;" onclick="$('#credits').hide(); page = 1;">
</div>
</div>
<div style="position:absolute; bottom: 0%; left: 0%; width: 100%; pointer-events: none">
@ -197,6 +82,44 @@ function loadCredits() {
$('#credits').show()
}
fetch(`./api/credits`).then(res => res.json()).then(res => {
res.credits.forEach((x, y) => {
$('#credits').append(`<div id="credits${y+1}" class="subCredits" style="display: none;">
<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="./profile/${x.name}">${x.name}</h2></a>
<img src="./icon/${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>
<br>
</div>
<img class="gdButton" src="../assets/arrow-right.png" width="60vh" style="position: absolute; top: 45%; left: 75%" onclick="page += 1; loadCredits()">
<img class="gdButton" src="../assets/arrow-left.png" width="60vh" style="${y == 0 ? "display: none; " : ""}position: absolute; top: 45%; right: 75%" onclick="page -= 1; loadCredits()">
</div>`)
})
$('#credits').append(`<div id="credits${res.credits.length + 1}" class="subCredits" style="display: none;">
<div id="githubbers" class="brownBox center supercenter" style="width: 80vh; height: 43%; padding-top: 1.5%; padding-bottom: 3.5%;">
<h1>GitHub Contributors</h1><br>
</div>
<div class="supercenter" style="top: 71.5%"><h2 class="smaller gdButton"><a href="https://github.com/GDColon/GDBrowser">View on GitHub!</a></h2></div>
<img class="gdButton" src="../assets/arrow-left.png" width="60vh" style="position: absolute; top: 45%; right: 75%" onclick="page -= 1; loadCredits()">
</div>`)
res.contributors.forEach((x, y) => {
$('#githubbers').append(`<div class="githubChad">
<h2 class="gdButton smaller"><a href="./profile/${x[1]}">${x[0]}</h2></a>
<img src="./icon/${x[1]}" height=85%><br>
</div>`)
})
$('#credits').append(`<div class="center supercenter" style="width: 80vh; height: 43%; pointer-events: none;">
<img class="closeWindow gdButton" src="../assets/close.png" height="25%" style="position: absolute; top: -24%; left: -7vh; pointer-events: all;" onclick="$('#credits').hide(); page = 1;"></div>`)
})
$(document).keydown(function(k) {
if ($('#credits').is(':hidden')) return

30
icons/forms.json Normal file
View file

@ -0,0 +1,30 @@
{
"ship": {
"form": "ship",
"ind": 22
},
"ball": {
"form": "player_ball",
"ind": 23
},
"ufo": {
"form": "bird",
"ind": 24
},
"wave": {
"form": "dart",
"ind": 25
},
"robot": {
"form": "robot",
"ind": 26
},
"spider": {
"form": "spider",
"ind": 43
},
"cursed": {
"form": "spider",
"ind": 43
}
}

View file

@ -128,6 +128,10 @@ app.get("/api/mappacks", async function(req, res) {
res.send(require('./misc/mapPacks.json'))
})
app.get("/api/credits", function(req, res) {
res.send(require('./misc/credits.json'))
})
app.get("/iconkit", function(req, res) {
res.sendFile(__dirname + "/html/iconkit.html")
})

72
misc/credits.json Normal file
View file

@ -0,0 +1,72 @@
{
"credits": [
{
"header": "Programming/Website",
"name": "Colon",
"youtube": ["https://youtube.com/channel/UCFDsxSlQXpLLpVScy2NmbcQ", "youtube"],
"twitter": ["https://twitter.com/TheRealGDColon", "twitter"],
"github": ["https://github.com/GDColon", "github"]
},
{
"header": "Level Analyzing Help",
"name": "Alten",
"youtube": ["https://youtube.com/channel/UC9M8hLqh2yZIPSDvpyL7o8g", "youtube"],
"twitter": ["https://twitter.com/gd_alten", "twitter"],
"github": ["https://github.com/Altenhh", "github"]
},
{
"header": "Level Analyzing Help",
"name": "AlFas",
"youtube": ["https://youtube.com/user/Alex100077", "youtube"],
"twitter": ["https://twitter.com/AlFas6237", "twitter"],
"github": ["https://github.com/AlFasGD", "github"]
},
{
"header": "Accurate Leaderboard",
"name": "SMJSGaming",
"youtube": ["https://youtube.com/channel/UCwEsWDs9kGN2vvoiNTJKdaQ", "youtube"],
"twitter": ["https://instagram.com/smjs_gaming", "twitter"],
"github": ["https://github.com/SMJSGaming", "github"]
},
{
"header": "API Help",
"name": "Alex1304",
"youtube": ["https://youtube.com/channel/UC0hFAVN-GAbZYuf_Hfk1Iog", "youtube"],
"twitter": ["https://twitter.com/gd_alex1304", "twitter"],
"github": ["https://github.com/Alex1304", "github"]
},
{
"header": "Web Design Help",
"name": "Ucrash",
"youtube": ["https://youtube.com/channel/UCfPgDZBhCodHIFo6OOVcH2A", "youtube"],
"twitter": ["https://twitter.com/GDUcrash", "twitter"],
"github": ["https://github.com/GDUcrash", "github"]
},
{
"header": "Demon List API",
"name": "stardust1971",
"youtube": ["https://youtube.com/user/stardust19710", "youtube"],
"twitter": ["https://twitter.com/stadust1971", "twitter"],
"github": ["https://pointercrate.com", "demonButton"]
},
{
"header": "Everything Else",
"name": "RobTop",
"youtube": ["https://youtube.com/channel/UCz_yk8mDSAnxJq0ar66L4sw", "youtube"],
"twitter": ["https://twitter.com/RobTopGames", "twitter"],
"github": ["https://www.facebook.com/geometrydash", "facebook"]
}
],
"contributors": [
["101arrowz", "genius991"],
["Qufyy", "qufy"]
]
}