Added alert if there's no active daily

This commit is contained in:
GDColon 2020-12-08 21:28:09 -05:00
parent e8b55851f0
commit 01aefc8314
3 changed files with 16 additions and 3 deletions

View file

@ -17,7 +17,7 @@ module.exports = async (app, req, res, api, ID, analyze) => {
request.post(app.endpoint + 'downloadGJLevel22.php', req.gdParams({ levelID }), async function (err, resp, body) {
if (err || !body || body == '-1' || body.startsWith("<!")) {
if (!api && levelID < 0) return res.redirect('/')
if (!api && levelID < 0) return res.redirect(`/?daily=${levelID * -1}`)
if (!api) return res.redirect('search/' + req.params.id)
else return res.send("-1")
}

View file

@ -230,7 +230,7 @@ fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID
$(`#date-${x.ID}`).html(x.date)
$(`#likes-${x.ID}`).html(x.likes)
$(`#thumb-${x.ID}`).attr('style', x.likes < 0 ? 'transform: translateY(25%); margin-right: 0.4%' : '').attr('src', `../assets/${x.likes < 0 ? "dis" : ""}like.png`)
$(`#thumb-${x.ID}`).attr('style', x.likes < 0 ? `transform: translateY(${compact ? '15' : '25'}%); margin-right: 0.4%` : '').attr('src', `../assets/${x.likes < 0 ? "dis" : ""}like.png`)
if ($(`.comment[commentID=${x.ID}]`).length) return // auto mode, ignore duplicates
let bgCol = index % 2 ? "evenComment" : "oddComment"

View file

@ -68,8 +68,12 @@
<img id="browserlogo" src="../assets/browser.png" height="7%" style="margin: 0.5% 0% 0% 30%">
</div>
<div id="noDaily" style="display: none;">
<div class="copied center noClick" style="position:absolute; top: 29%; left: 50%; transform: translate(-50%,-50%); width: 90vh; background-color: rgba(0, 0, 0, 0.7);">
<h1 class="smaller noSelect">No active <span id="noLevel">daily</span> level!</h1>
</div>
</div>
</div>
</body>
@ -83,6 +87,15 @@ $('#browserlogo').css('filter', `hue-rotate(${Math.floor(Math.random() * (330 -
let xButtonPos = '43%'
let lastPage
let noDaily = (window.location.search == "?daily=1")
let noWeekly = (window.location.search == "?daily=2")
if (noDaily || noWeekly) {
if (noWeekly) $('#noLevel').html("weekly")
$('#noDaily').fadeIn(200).delay(500).fadeOut(500)
window.history.pushState(null, null, "/")
}
function loadCredits() {
$('.subCredits').hide()
$('#credits' + page).show()