f9f2cbf06b
WAY less requests should be made to the servers now: - Account IDs are now cached to save a request - getgjusers is skipped if Account ID is provided - User icons are cached for 5 minutes
260 lines
No EOL
13 KiB
HTML
260 lines
No EOL
13 KiB
HTML
<head>
|
|
<title>Level Search</title>
|
|
<meta charset="utf-8">
|
|
<link href="../css/browser.css" type="text/css" rel="stylesheet">
|
|
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-135255146-3"></script><script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'UA-135255146-3');</script>
|
|
<link rel="icon" href="../assets/coin.png">
|
|
<meta id="meta-title" property="og:title" content="Level Search">
|
|
<meta id="meta-desc" property="og:description" content="Search for Geometry Dash levels, and filter by length, difficulty, song + more!">
|
|
<meta id="meta-image" name="og:image" itemprop="image" content="https://gdbrowser.com/assets/coin.png">
|
|
</head>
|
|
|
|
<body class="levelBG" onbeforeunload="saveUrl()">
|
|
|
|
<div id="everything">
|
|
|
|
<div id="filters" class="popup">
|
|
<div id="filterStuff" class="brownBox bounce center supercenter" style="width: 101vh; height: 50%; padding-top: 0.3%; padding-bottom: 3.5%; padding-left: 1%">
|
|
<img class="gdButton" src="../assets/close.png" width="9%" style="position: absolute; top: -8.5%; left: -5.5vh" onclick="$('#filters').hide()">
|
|
<h1 style="margin-bottom: 4%">Advanced Options</h1><br>
|
|
<div><h1><input type="checkbox" id="box-featured" url="&featured"><label for="box-featured" class="gdcheckbox gdButton"></label>Featured</h1></div>
|
|
<div><h1><input type="checkbox" id="box-epic" url="&epic"><label for="box-epic" class="gdcheckbox gdButton"></label>Epic</h1></div>
|
|
<div style="margin-bottom: 6%"><h1><input type="checkbox" id="box-nostar" url="&noStar"><label for="box-nostar" class="gdcheckbox gdButton"></label>No Star</h1></div>
|
|
<div><h1><input type="checkbox" id="box-original" url="&original"><label for="box-original" class="gdcheckbox gdButton"></label>Original</h1></div>
|
|
<div><h1><input type="checkbox" id="box-2player" url="&twoPlayer"><label for="box-2player" class="gdcheckbox gdButton"></label>2-Player</h1></div>
|
|
<div style="margin-bottom: 9%"><h1><input type="checkbox" id="box-coins" url="&coins"><label for="box-coins" class="gdcheckbox gdButton"></label>Coins</h1></div>
|
|
<h1 class="smallerer lessSpaced">Song</h1>
|
|
<input id="songID" type="text" placeholder="Song ID or Level Name" style="height: 15%; width: 70%; text-align: center;" maxlength="22">
|
|
</div>
|
|
</div>
|
|
|
|
<div id="customlist" class="popup">
|
|
<div class="brownBox bounce center supercenter" style="width: 100vh; height: 56%; padding-top: 0.3%; padding-bottom: 3.5%; padding-left: 1%">
|
|
<img class="gdButton" src="../assets/close.png" width="9%" style="position: absolute; top: -8.5%; left: -5.5vh" onclick="$('#customlist').hide()">
|
|
<h1>Custom List</h1><br>
|
|
<p id="listInfo" style="margin-top: 1%; margin-bottom: 1.5%">Paste a <span style="color: yellow">comma-seperated</span> list of <span style="color: cyan">Level IDs</span> to create a custom list!</p>
|
|
<textarea id="listLevels" placeholder="18025697, 23189196, 27786218, 27728679, 25706351" style="margin-bottom: 2%; font-size: 2.5vh"></textarea>
|
|
|
|
<div class="inline" style="width: 60%">
|
|
<h1 class="smaller lessSpaced">List Name</h1>
|
|
<input id="listName" type="text" placeholder="Custom List" style="font-size: 4vh; height: 13%; width: 90%; text-align: center;" maxlength="32">
|
|
</div>
|
|
<div class="inline" style="width: 39%; margin-bottom: 3%">
|
|
<h1 class="smaller lessSpaced">Page Size</h1>
|
|
<input id="pageSize" type="number" value="10" style="font-size: 4vh; height: 13%; width: 45%; text-align: center;">
|
|
</div>
|
|
|
|
<a id="listLink"><img src="../assets/btn-submit.png" type="submit" height=12.5%; class="disabled gdButton" style="margin-left: 1%" id="createList"></a>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div style="position:absolute; bottom: 0%; left: 0%; width: 100%">
|
|
<img class="cornerPiece" src="../assets/corner.png" width=7%;>
|
|
</div>
|
|
|
|
<div style="position:absolute; bottom: 0%; right: 0%; width: 100%; text-align: right;">
|
|
<img class="cornerPiece" src="../assets/corner.png" width=7%; style="transform: scaleX(-1)">
|
|
</div>
|
|
|
|
<div class="transparentBox center" style="width: 115vh; height: 9%; margin: 1.5% auto 1% auto; padding-bottom: 0.2%">
|
|
<div>
|
|
<input type="text" id="levelName" placeholder="Enter a level, user, or ID" maxlength=20>
|
|
<img search="0" src="../assets/search.png" id="searchBtn" width="20%" class="valign gdButton levelSearch" style="margin-left: 1%; margin-bottom: 2.2%">
|
|
<img id="userSearch" src="../assets/search-user.png" width="9.6%" class="valign gdButton" style="margin-left: 1%; margin-bottom: 2.2%">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="center">
|
|
<h1 class="smaller">Quick Search</h1>
|
|
</div>
|
|
|
|
<div class="transparentBox center" style="width: 115vh; height: 35%; margin: 0.5% auto 1% auto; padding-top: 1.1%">
|
|
<img src="../assets/btn-top.png" height="27%" class="valign gdButton spaced levelSearch" search="mostdownloaded">
|
|
<span style="margin-right: 3%"></span>
|
|
<img src="../assets/btn-liked.png" height="27%" class="valign gdButton spaced levelSearch" search="mostliked">
|
|
<br>
|
|
<img src="../assets/btn-trending.png" height="27%" class="valign gdButton spaced levelSearch" search="trending">
|
|
<img src="../assets/btn-recent.png" height="27%" class="valign gdButton spaced levelSearch" search="recent" style="margin-left: 2%; margin-right: 2%">
|
|
<img src="../assets/btn-magic.png" height="27%" class="valign gdButton spaced levelSearch" search="magic">
|
|
<br>
|
|
<img src="../assets/btn-awarded.png" height="27%" class="valign gdButton levelSearch" search="awarded">
|
|
<img src="../assets/btn-featured.png" height="27%" class="valign gdButton levelSearch" search="featured" style="margin: 0% 2%">
|
|
<img src="../assets/btn-followed.png" height="27%" class="valign gdButton levelSearch" search="followed">
|
|
</div>
|
|
|
|
<div class="center">
|
|
<h1 class="smaller">Filters</h1>
|
|
</div>
|
|
|
|
<div id="difficulties" class="transparentBox center" style="width: 115vh; height: 12%; margin: 0.5% auto 1% auto; padding-top: 1%; padding-bottom: 1%;">
|
|
<div class="diffDiv gdButton" diff="-1"><img src="../difficulty/unrated.png"><h3 class="mini">N/A</h3></div>
|
|
<div class="diffDiv gdButton" diff=1><img src="../difficulty/easy.png"><h3 class="mini">Easy</h3></div>
|
|
<div class="diffDiv gdButton" diff=2><img src="../difficulty/normal.png"><h3 class="mini">Normal</h3></div>
|
|
<div class="diffDiv gdButton" diff=3><img src="../difficulty/hard.png"><h3 class="mini">Hard</h3></div>
|
|
<div class="diffDiv gdButton" diff=4><img src="../difficulty/harder.png"><h3 class="mini">Harder</h3></div>
|
|
<div class="diffDiv gdButton" diff=5><img src="../difficulty/insane.png"><h3 class="mini">Insane</h3></div>
|
|
<div class="diffDiv gdButton" id="demonBtn" diff=-2><img src="../difficulty/demon.png" style="width: 85%"><h3 class="mini">Demon</h3></div>
|
|
<div class="diffDiv gdButton" diff=-3><img src="../difficulty/auto.png"><h3 class="mini">Auto</h3></div>
|
|
</div>
|
|
|
|
<div id="demons" class="transparentBox" style="display: none; width: 115vh; height: 12%; margin: 0.5% auto 1% auto; padding-top: 0.7%; padding-bottom: 1.3%;">
|
|
<div class="diffDiv gdButton demonDiff" diff=1 style="margin-left: 3.5%"><img src="../difficulty/demon-easy.png" style="width: 90%"><h3 class="mini center">Easy</h3></div>
|
|
<div class="diffDiv gdButton demonDiff" diff=2><img src="../difficulty/demon-medium.png" style="width: 90%"><h3 class="mini center smallTextWoo">Medium</h3></div>
|
|
<div class="diffDiv gdButton demonDiff" diff=3><img src="../difficulty/demon-hard.png" style="width: 90%"><h3 class="mini center">Hard</h3></div>
|
|
<div class="diffDiv gdButton demonDiff" diff=4><img src="../difficulty/demon-insane.png" style="width: 95%"><h3 class="mini center smallTextWoo">Insane</h3></div>
|
|
<div class="diffDiv gdButton demonDiff" diff=5><img src="../difficulty/demon-extreme.png" style="width: 100%"><h3 class="mini center smallTextWoo">Extreme</h3></div>
|
|
<div class="diffDiv gdButton goBack" diff=-2 style="margin-left: 2.3%; filter: none"><img src="../difficulty/demon.png" style="width: 85%"><h3 class="mini">Demon</h3></div>
|
|
</div>
|
|
|
|
<div class="transparentBox center" style="width: 115vh; height: 6%; margin: 0.5% auto 1% auto; padding-top: 1%; padding-bottom: 0.5%;">
|
|
<div class="lengthDiv" len=0><h1 class="gdButton smaller">Tiny</h1></div>
|
|
<div class="lengthDiv" len=1><h1 class="gdButton smaller">Short</h1></div>
|
|
<div class="lengthDiv" len=2><h1 class="gdButton smaller">Medium</h1></div>
|
|
<div class="lengthDiv" len=3><h1 class="gdButton smaller">Long</h1></div>
|
|
<div class="lengthDiv" len=4><h1 class="gdButton smaller">XL</h1></div>
|
|
<div class="lengthDiv" id="starCheck"><img src="../assets/star.png" class="gdButton" height="90%"></div>
|
|
</div>
|
|
|
|
<div style="position:absolute; top: 2%; left: 1.5%; width: 10%; height: 25%; pointer-events: none">
|
|
<img class="gdButton yesClick" id="backButton" src="../assets/back.png" height="30%" onclick="backButton()">
|
|
</div>
|
|
|
|
<div style="position:absolute; top: 2%; right: 1.5%; width: 10%; text-align: right">
|
|
<img class="gdButton" style="margin-bottom: 15%" src="../assets/plus.png" width="60%" onclick="$('#filters').show()">
|
|
<img class="gdButton" src="../assets/listbutton.png" width="60%" onclick="$('#customlist').show()">
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
|
<script async type="text/javascript" src="../assets/sizecheck.js"></script>
|
|
<script>
|
|
|
|
let filters = []
|
|
let minusCheck = []
|
|
let demons = []
|
|
let demonMode = false;
|
|
|
|
function undupe(array) {
|
|
if (!Array.isArray(array)) return array
|
|
else return array.filter((x, y) => array.indexOf(x) == y)
|
|
}
|
|
|
|
$('#userSearch').click(function() {
|
|
let query = encodeURIComponent($('#levelName').val()).replace(/%2F/gi, "")
|
|
if (query) window.location.href = "./u/" + query
|
|
})
|
|
|
|
$('.levelSearch').click(function() {
|
|
|
|
let url = "./search/" + (encodeURIComponent($('#levelName').val()) || "*") + "?type=" + $(this).attr('search')
|
|
if ($(this).attr('search') == "featured") return window.location.href = url
|
|
|
|
// === DIFFICULTY === //
|
|
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=" + difficulties.join(",")
|
|
else url += "&diff=-2&demonFilter=" + difficulties[0]
|
|
|
|
// === LENGTH === //
|
|
let lengths = []
|
|
$('.lengthDiv').each(function() {if ($(this).hasClass('selectedFilter') && $(this).attr('len')) lengths.push($(this).attr('len'))})
|
|
if (lengths.length) url += "&length=" + lengths.join(",")
|
|
if ($('#starCheck').hasClass('selectedFilter')) url += "&starred"
|
|
|
|
// === CHECKBOXES === //
|
|
$("input:checked").each(function () {
|
|
url += $(this).attr('url')})
|
|
|
|
// === SONG === //
|
|
|
|
if ($('#songID').val()) {
|
|
|
|
url += "&songID=" + $('#songID').val()
|
|
if (/^\d+$/.test($('#songID').val())) url += "&customSong"
|
|
}
|
|
|
|
if (url.endsWith('?type=0')) url = url.slice(0, -7)
|
|
|
|
window.location.href = url.replace(/\?type=0&/, "?")
|
|
|
|
})
|
|
|
|
$('.diffDiv').click(function() {
|
|
|
|
if ($(this).hasClass('goBack')) {
|
|
demonMode = false;
|
|
$('#difficulties').show();
|
|
$('#demonBtn').removeClass('selectedFilter')
|
|
$('.demonDiff').removeClass('selectedFilter')
|
|
return $('#demons').hide();
|
|
}
|
|
|
|
minusCheck = []
|
|
filters = []
|
|
$(this).toggleClass('selectedFilter')
|
|
|
|
$('.diffDiv').each(function() {
|
|
if ($(this).hasClass('selectedFilter')) filters.push($(this).attr('diff'))})
|
|
|
|
minusCheck = filters.filter(x => x < 0)
|
|
if (minusCheck.length || $(this).hasClass('demonDiff')) {
|
|
filters = minusCheck
|
|
$('.diffDiv').removeClass('selectedFilter')
|
|
$(this).addClass('selectedFilter')
|
|
}
|
|
|
|
if ($(this).attr('diff') == -2) {
|
|
$('#difficulties').hide();
|
|
$('#demons').show();
|
|
demonMode = true;
|
|
}
|
|
})
|
|
|
|
$('.lengthDiv').click(function() {
|
|
$(this).toggleClass('selectedFilter')
|
|
})
|
|
|
|
$(document).keydown(function(k) {
|
|
if (k.which == 13) {
|
|
if (!$('#customlist').is(':hidden')) k.preventDefault();
|
|
else if ($('#filters').is(':hidden')) $('#searchBtn').trigger('click') //enter
|
|
}
|
|
});
|
|
|
|
$('#pageSize').on('input blur', function (event) {
|
|
var x = +$(this).val(); var max = 250; var min = 1
|
|
if (event.type == "input") { if (x > max || x < min) $(this).addClass('red'); else $(this).removeClass('red')}
|
|
else {
|
|
$(this).val(Math.max(Math.min(Math.floor(x), max), min));
|
|
$(this).removeClass('red')
|
|
}
|
|
$('#listLevels').trigger('input')
|
|
})
|
|
|
|
let listMsg = $('#listInfo').html()
|
|
$('#listLevels, #listName').on('input blur', function (event) {
|
|
let levels = $('#listLevels').val().replace(/\n| /g, ",").split(",").map(x => x.replace(/[^0-9]/g, "")).filter(x => +x > 0 && +x < 100000000000)
|
|
levels = undupe(levels)
|
|
|
|
if (levels.length > 1 && levels.length <= 100) {
|
|
$('#listInfo').html(`A list of <span style='color: yellow'>${levels.length}</span> levels will be created.`)
|
|
$('#listLink').attr('href', `../search/${levels.join(",")}?list&count=${+$('#pageSize').val()}${$('#listName').val().length ? `&header=${encodeURIComponent($('#listName').val())}` : ""}`)
|
|
$('#createList').removeClass('disabled')
|
|
}
|
|
|
|
else {
|
|
$('#createList').addClass('disabled')
|
|
if (levels.length > 100) $('#listInfo').html('Custom lists have a max of 100 levels!')
|
|
else if (levels.length == 1) $('#listInfo').html("Please enter more than one level!")
|
|
else $('#listInfo').html(listMsg)
|
|
}
|
|
|
|
})
|
|
|
|
</script> |