100th commit! 🎉🎉🎉
Quality of life fixes: - Fixed undefined backgrounds/grounds in analysis - Fixed leaderboards being buggy when switching tabs while the current one is still loading - Fixed still being able to switch pages with arrow keys while typing a comment - Fixed remaining character count for comments not updating in some cases - Documented liking and commenting on the API page - Ucrash changed some of the CSS on the API page - Screw you, you're not my dad and you can't make my type me commit descriptions in present tense - Remove herobrine
This commit is contained in:
parent
357a72eade
commit
39e61951b8
6 changed files with 240 additions and 34 deletions
|
@ -137,15 +137,13 @@ Object.keys(data[0]).forEach(x => {
|
|||
response.settings[name] = val
|
||||
})
|
||||
|
||||
if (response.settings.ground == 0) response.settings.ground = 1
|
||||
if (response.settings.background == 0) response.settings.background = 1
|
||||
if (!response.settings.ground || response.settings.ground > 17) response.settings.ground = 1
|
||||
if (!response.settings.background || response.settings.background > 20) response.settings.background = 1
|
||||
if (!response.settings.font) response.settings.font = 1
|
||||
|
||||
if (response.settings.alternateLine == 2) response.settings.alternateLine = true
|
||||
else response.settings.alternateLine = false
|
||||
|
||||
|
||||
|
||||
delete response.settings['colors']
|
||||
response.text = data.filter(x => x.message).sort(function (a, b) {return parseInt(a.x) - parseInt(b.x)}).map(x => [Buffer.from(x.message, 'base64').toString(), Math.round(x.x / last * 99) + "%"])
|
||||
response.dataLength = rawData.length
|
||||
|
|
|
@ -54,4 +54,4 @@ module.exports = async (app, req, res) => {
|
|||
rateLimit[req.body.username] = Date.now();
|
||||
setTimeout(() => {delete rateLimit[req.body.username]; }, cooldown);
|
||||
})
|
||||
}
|
||||
}
|
|
@ -15,13 +15,14 @@ main {
|
|||
}
|
||||
|
||||
main.alt {
|
||||
background: #467BA2;
|
||||
background: #3979b8;
|
||||
}
|
||||
|
||||
h1{
|
||||
font-size: 48px;
|
||||
font-weight: 100;
|
||||
font-size: 36px;
|
||||
font-weight: 400;
|
||||
margin: 15px 0;
|
||||
text-shadow: 0 2px 5px rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
p {
|
||||
|
@ -96,9 +97,10 @@ quote{
|
|||
width: 25px;
|
||||
height: 25px;
|
||||
margin-bottom: -8px;
|
||||
background-image: url('showmore-ic.svg');
|
||||
background-image: url('../showmore-ic.svg');
|
||||
background-size: cover;
|
||||
transition: transform 0.25s ease;
|
||||
filter: invert(30%)
|
||||
}
|
||||
.reveal:hover::after{
|
||||
transform: rotate(180deg);
|
||||
|
@ -145,6 +147,7 @@ quote{
|
|||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.main-header{
|
||||
|
@ -152,7 +155,7 @@ quote{
|
|||
width: 100%;
|
||||
max-width: 1060px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
justify-content: space-around;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
|
@ -175,6 +178,49 @@ quote{
|
|||
align-items: stretch;
|
||||
}
|
||||
|
||||
.header-category{
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header-category .category-content{
|
||||
display: none;
|
||||
}
|
||||
.header-category .category-name{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #333;
|
||||
padding: 0 25px;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
font-weight: 400;
|
||||
height: 100%;
|
||||
text-decoration: none;
|
||||
font-size: 16px;
|
||||
transition: 0.25s ease all;
|
||||
}
|
||||
.header-category:hover .category-name{
|
||||
background: #efefef;
|
||||
color: #3994db;
|
||||
}
|
||||
.header-category:hover .category-content{
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 0;
|
||||
background: rgb(243, 243, 243);
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
border-radius: 0 0 5px 5px;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,.5);
|
||||
z-index: 0;
|
||||
animation: pop 0.25s;
|
||||
}
|
||||
|
||||
.category-content .header-link{
|
||||
padding: 10px 20px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.header-link{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -185,7 +231,7 @@ quote{
|
|||
font-weight: 400;
|
||||
height: 100%;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.header-link:hover{
|
||||
background: #efefef;
|
||||
|
@ -195,7 +241,7 @@ quote{
|
|||
footer{
|
||||
background: linear-gradient(#333, #222);
|
||||
text-shadow: 0 2px 5px rgba(0,0,0,.5);
|
||||
height: 80px;
|
||||
height: 100px;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
@ -227,12 +273,21 @@ footer a{
|
|||
/*display: none;*/
|
||||
position: fixed;
|
||||
top: 50px;
|
||||
flex-direction: column;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
height: calc(100% - 50px);
|
||||
align-items: center;
|
||||
background: rgb(243, 243, 243);
|
||||
transition: transform 0.25s ease;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.header-links::-webkit-scrollbar{
|
||||
width: 5px;
|
||||
}
|
||||
.header-links::-webkit-scrollbar-thumb{
|
||||
width: 5px;
|
||||
background: #888;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.header-links.hid{
|
||||
transform: translateY(-150vh);
|
||||
|
@ -240,6 +295,11 @@ footer a{
|
|||
.header-link{
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
height: 70px;
|
||||
padding: 0;
|
||||
}
|
||||
.header-category{
|
||||
width: 100%;
|
||||
}
|
||||
.header-drawer{
|
||||
display: flex;
|
||||
|
@ -251,4 +311,42 @@ footer a{
|
|||
transition: transform 0.25s ease;
|
||||
z-index: 999;
|
||||
}
|
||||
.header-category{
|
||||
position: static;
|
||||
}
|
||||
.header-category .category-name{
|
||||
display: none;
|
||||
}
|
||||
.header-category .category-content{
|
||||
display: block;
|
||||
position: static;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.header-category:hover .category-content{
|
||||
display: block;
|
||||
position: static;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
animation: none;
|
||||
}
|
||||
.header-category .header-link{
|
||||
padding: 0;
|
||||
white-space: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pop{
|
||||
0%{
|
||||
transform: translateY(-20px);
|
||||
opacity: 0;
|
||||
}
|
||||
20%{
|
||||
transform: translateY(-5px);
|
||||
opacity: 0.8;
|
||||
}
|
||||
100%{
|
||||
transform: translateY(0px);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
125
html/api.html
125
html/api.html
|
@ -4,7 +4,7 @@
|
|||
<title>GD Level Browser API</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="icon" href="../difficulty/auto.png">
|
||||
<link href="../css/api.css" type="text/css" rel="stylesheet">
|
||||
<link href="../assets/css/api.css" type="text/css" rel="stylesheet">
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,600,700,800&display=swap" rel="stylesheet">
|
||||
|
||||
|
@ -22,14 +22,36 @@
|
|||
</div>
|
||||
<div class="header-links hid">
|
||||
<a class="header-link" href="#intro">Introduction</a>
|
||||
<a class="header-link" href="#level">Levels</a>
|
||||
<a class="header-link" href="#profile">Profiles</a>
|
||||
<a class="header-link" href="#search">Searching</a>
|
||||
<a class="header-link" href="#leaderboard">Leaderboards</a>
|
||||
<a class="header-link" href="#levelleaderboard">Level Leaderboards</a>
|
||||
<a class="header-link" href="#comments">Comments & Posts</a>
|
||||
<a class="header-link" href="#analyze">Level Analysis</a>
|
||||
<a class="header-link" href="#icons">Icons</a>
|
||||
<div class="header-category">
|
||||
<div class="category-name">Levels</div>
|
||||
<div class="category-content">
|
||||
<a class="header-link" href="#level">Levels</a>
|
||||
<a class="header-link" href="#search">Searching</a>
|
||||
<a class="header-link" href="#levelleaderboard">Level Leaderboards</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-category">
|
||||
<div class="category-name">Users</div>
|
||||
<div class="category-content">
|
||||
<a class="header-link" href="#profile">Profiles</a>
|
||||
<a class="header-link" href="#leaderboard">Leaderboards</a>
|
||||
<a class="header-link" href="#comments">Comments & Posts</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-category">
|
||||
<div class="category-name">Account</div>
|
||||
<div class="category-content">
|
||||
<a class="header-link" href="#commenting">Commenting</a>
|
||||
<a class="header-link" href="#liking">Liking</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-category">
|
||||
<div class="category-name">Misc</div>
|
||||
<div class="category-content">
|
||||
<a class="header-link" href="#analyze">Level Analysis</a>
|
||||
<a class="header-link" href="#icons">Icons</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -56,6 +78,8 @@
|
|||
<p><a href="#levelleaderboard"><u>Level Leaderboards</u></a> <i>/api/leaderboardLevel/levelID</i></p>
|
||||
<p><a href="#comments"><u>Comments & Posts</u></a> <i>/api/comments/level-or-user-ID</i></p>
|
||||
<p><a href="#analyze"><u>Level Analysis</u></a> <i>/api/analyze/levelID</i></p>
|
||||
<p><a href="#commenting"><u>Commenting</u></a> <i>/api/postComment (POST)</i></p>
|
||||
<p><a href="#liking"><u>Liking</u></a> <i>/api/like (POST)</i></p>
|
||||
<p><a href="#icons"><u>Icons</u></a> <i>/icon/username</i></p>
|
||||
</quote>
|
||||
<br>
|
||||
|
@ -432,6 +456,7 @@
|
|||
</div>
|
||||
<div class="seperator"></div>
|
||||
</main>
|
||||
|
||||
<main class="alt">
|
||||
<div id="analyze" class="anchor"></div>
|
||||
<div class="main-block">
|
||||
|
@ -472,6 +497,88 @@
|
|||
|
||||
</main>
|
||||
|
||||
<main class="grey">
|
||||
<div id="commenting" class="anchor"></div>
|
||||
<div class="main-block">
|
||||
<h1>Commenting</h1>
|
||||
<p>POST: /api/postComment</p>
|
||||
|
||||
<p>Leaves a comment on a level. This one is a POST request!</p>
|
||||
<p>*Commenting has a rate limit of 10 seconds</p>
|
||||
|
||||
<br>
|
||||
<p class="reveal" onclick="$('#params-commenting').slideToggle(100)"><b>Parameters (6)</b></p>
|
||||
<div class="subdiv" id="params-commenting">
|
||||
<p>comment: The content of the comment</p>
|
||||
<p>username: Your username</p>
|
||||
<p>accountID: Your account ID</p>
|
||||
<p>password: Your password (as plain text)</p>
|
||||
<p>levelID: The ID of the level to comment on</p>
|
||||
<p>percent: The percent shown on the comment (optional)</p>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<p class="reveal" onclick="$('#request-commenting').slideToggle(100)"><b>Example</b></p>
|
||||
<div class="subdiv" id="request-commenting">
|
||||
<p><b>Example Requests</b></p>
|
||||
<p>POST /api/postComment<br>
|
||||
?comment=This is a nifty comment!<br>
|
||||
&username=colon<br>
|
||||
&accountID=106255<br>
|
||||
&password=KitsuneColon333<br>
|
||||
&levelID=21448270<br>
|
||||
&percent=69
|
||||
<br>
|
||||
<p>If a status of 200 is returned, then the comment was successfully posted. Otherwise, a 400 will return with an error message.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="seperator"></div>
|
||||
</main>
|
||||
|
||||
|
||||
<main class="alt">
|
||||
<div id="liking" class="anchor"></div>
|
||||
<div class="main-block">
|
||||
<h1>Liking</h1>
|
||||
<p>POST: /api/like</p>
|
||||
|
||||
<p>Likes/dislikes level, comment, or post. This one is a POST request!</p>
|
||||
|
||||
<br>
|
||||
<p class="reveal" onclick="$('#params-liking').slideToggle(100)"><b>Parameters (6)</b></p>
|
||||
<div class="subdiv" id="params-liking">
|
||||
<p>ID: The ID of the item to like. This should be a level ID, comment ID, or profile post ID</p>
|
||||
<p>like: Whether to like or dislike the level. 1=like, 0=dislike</p>
|
||||
<p>type: The type of item you're liking. 1=level, 2=comment, 3=profile post</p>
|
||||
<p>extraID: An extra ID. This should be the level ID for comments, the account ID for profile posts, or "0" for levels</p>
|
||||
<p>accountID: Your account ID</p>
|
||||
<p>password: Your password (as plain text)</p>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<p class="reveal" onclick="$('#request-liking').slideToggle(100)"><b>Example</b></p>
|
||||
<div class="subdiv" id="request-liking">
|
||||
<p><b>Example Requests</b></p>
|
||||
<p>Drop a like on RobTop's popular "can you handle the kappa" comment:</p>
|
||||
<p>POST /api/like<br>
|
||||
?id=42602304 (ID of the comment)<br>
|
||||
&like=1 (thumbs up)<br>
|
||||
&type=2 (liking a comment)<br>
|
||||
&extraID=7485599 (ID of Kappaclysm)<br>
|
||||
&accountID=106255<br>
|
||||
&password=KitsuneColon333<br>
|
||||
<br>
|
||||
<p>A status of 200 will return if everything goes well, otherwise a 400 will return with an error message.<br>
|
||||
Liking a comment multiple times on the same account will return a 200, but not actually increase the in-game like counter.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="seperator"></div>
|
||||
</main>
|
||||
|
||||
<main>
|
||||
<div id="icons" class="anchor"></div>
|
||||
<div class="main-block">
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
</div>
|
||||
|
||||
<div id="leaveComment" style="position:absolute;bottom: 0%;right: 0%;width: 14%;text-align: right;transform: translate(30%, 40%);">
|
||||
<img class="gdButton" src="../assets/comment.png" width="60%" onclick="$('#postComment').show()">
|
||||
<img class="gdButton" src="../assets/comment.png" width="60%" onclick="$('#content').trigger('input'); $('#postComment').show();">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -241,9 +241,9 @@ fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID
|
|||
</div>
|
||||
</div>
|
||||
<p class="commentDate compactDate">${x.date}</p>
|
||||
<div class="commentLikes" commentID="${x.ID}" ${x.levelID ? `levelID="${x.levelID}"` : ""}">
|
||||
<div class="commentLikes">
|
||||
${history ? `<h3 style="margin-right: 0.5vh; pointer-events: all;" class="gold inline"><a href="../${x.levelID}">(${x.levelID})</a></h3>` : ""}
|
||||
<div class="inline gdButton likeComment">
|
||||
<div class="inline gdButton likeComment" commentID="${x.ID}"${x.levelID ? `levelID="${x.levelID}"` : ""}>
|
||||
<img class="inline" ${x.likes < 0 ? "style='transform: translateY(15%); margin-right: 0.4%'" : ""} src="../assets/${x.likes < 0 ? "dis" : ""}like.png" height=27%>
|
||||
</div>
|
||||
<h3 class="inline">${x.likes}</h3>
|
||||
|
@ -387,7 +387,7 @@ $('#submitVote').click(function() {
|
|||
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... :(")
|
||||
|
@ -425,7 +425,7 @@ localStorage.setItem('commentPreset', JSON.stringify({
|
|||
})
|
||||
|
||||
$(document).keydown(function(k) {
|
||||
if (loadingComments) return;
|
||||
if (loadingComments || $('.popup').is(":visible")) return;
|
||||
|
||||
if (k.which == 37 && $('#pageDown').is(":visible")) { //left
|
||||
$('#pageDown').trigger('click')
|
||||
|
|
|
@ -92,13 +92,16 @@ function infoText(text) {
|
|||
infoText(accurateText)
|
||||
|
||||
|
||||
function leaderboard() {
|
||||
function leaderboard(val) {
|
||||
|
||||
$('#searchBox').html(`<div style="height: 4.5%"></div>`)
|
||||
$('#loading').show()
|
||||
|
||||
fetch(`../api/leaderboard?count=250&${type}`).then(res => res.json()).then(res => {
|
||||
fetch(`../api/leaderboard?count=250&${val}`).then(res => res.json()).then(res => {
|
||||
|
||||
if (val != type) return;
|
||||
|
||||
$('#searchBox').html(`<div style="height: 4.5%"></div>`)
|
||||
$('.ranking').remove()
|
||||
|
||||
res.forEach((x, y) => {
|
||||
|
@ -135,12 +138,12 @@ function leaderboard() {
|
|||
}
|
||||
|
||||
let type = "accurate"
|
||||
leaderboard()
|
||||
leaderboard(type)
|
||||
|
||||
$('#topTabOff').click(function() {
|
||||
if (type == "top") return;
|
||||
type = "top"
|
||||
leaderboard()
|
||||
leaderboard(type)
|
||||
$('.leaderboardTab').hide();
|
||||
$('#topTabOn').show()
|
||||
$('#accurateTabOff').show()
|
||||
|
@ -151,7 +154,7 @@ function leaderboard() {
|
|||
$('#accurateTabOff').click(function() {
|
||||
if (type == "accurate") return;
|
||||
type = "accurate"
|
||||
leaderboard()
|
||||
leaderboard(type)
|
||||
$('.leaderboardTab').hide();
|
||||
$('#topTabOff').show()
|
||||
$('#accurateTabOn').show()
|
||||
|
@ -162,7 +165,7 @@ function leaderboard() {
|
|||
$('#creatorTabOff').click(function() {
|
||||
if (type == "creator") return;
|
||||
type = "creator"
|
||||
leaderboard()
|
||||
leaderboard(type)
|
||||
$('.leaderboardTab').hide();
|
||||
$('#topTabOff').show()
|
||||
$('#accurateTabOff').show()
|
||||
|
|
Loading…
Reference in a new issue