mirror of
https://gitlab.com/skysthelimit.dev/selenite.git
synced 2025-06-16 02:22:07 -05:00
im gonna make alphabetize and shit tomorrow bc i havent eaten dinner and im tired
This commit is contained in:
parent
b8a04b602f
commit
f4920ee19e
@ -56,10 +56,9 @@
|
|||||||
<p id="gamecounter"></p>
|
<p id="gamecounter"></p>
|
||||||
<input type="text" id="gamesearch" placeholder="Type here to search.."> <br>
|
<input type="text" id="gamesearch" placeholder="Type here to search.."> <br>
|
||||||
<br>
|
<br>
|
||||||
<div id="pinnedgames">
|
<h2>Pinned Games</h2>
|
||||||
<h2>Pinned Games</h2>
|
<div id="pinnedgames"></div>
|
||||||
<p id="message">Looks like you haven't pinned any games, click the star icon next to any game in order to pin them up here!</p>
|
<p id="pinnedmessage">Looks like you haven't pinned any games, click the star icon next to any game in order to pin them up here!</p>
|
||||||
</div>
|
|
||||||
<div id="games">
|
<div id="games">
|
||||||
<h2>All Games</h2>
|
<h2>All Games</h2>
|
||||||
<p id="message">Please wait for the games to load.. If you see this for more than a second, try reloading and reporting a <a href="https://forms.gle/j75WUn6UhdqsRZgf7">bug report</a>.</p>
|
<p id="message">Please wait for the games to load.. If you see this for more than a second, try reloading and reporting a <a href="https://forms.gle/j75WUn6UhdqsRZgf7">bug report</a>.</p>
|
||||||
|
12
js/games.js
12
js/games.js
@ -11,7 +11,6 @@ $.getJSON("/games.json", function (data) {
|
|||||||
$("#gamesearch").prop({placeholder: "Click here to search through our " + data.length + " games!"});
|
$("#gamesearch").prop({placeholder: "Click here to search through our " + data.length + " games!"});
|
||||||
data.sort(dynamicSort("name"));
|
data.sort(dynamicSort("name"));
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
console.log("Loop iteration:", i);
|
|
||||||
let $element = $('<div>').prop({
|
let $element = $('<div>').prop({
|
||||||
class: 'game',
|
class: 'game',
|
||||||
style: 'cursor: pointer;',
|
style: 'cursor: pointer;',
|
||||||
@ -34,7 +33,7 @@ $.getJSON("/games.json", function (data) {
|
|||||||
let $pinnedelement = $element.clone();
|
let $pinnedelement = $element.clone();
|
||||||
$('#pinnedgames').append($pinnedelement);
|
$('#pinnedgames').append($pinnedelement);
|
||||||
if($("#pinnedgames #message")) {
|
if($("#pinnedgames #message")) {
|
||||||
$("#pinnedgames #message").hide();
|
$("#pinnedmessage").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -61,17 +60,18 @@ $(document).ready(function() {
|
|||||||
Cookies.set("starred", JSON.stringify(starred));
|
Cookies.set("starred", JSON.stringify(starred));
|
||||||
$element = $(this).clone();
|
$element = $(this).clone();
|
||||||
$('#pinnedgames').append($element);
|
$('#pinnedgames').append($element);
|
||||||
$("#pinnedgames #message").hide();
|
$("#pinnedmessage").hide();
|
||||||
} else {
|
} else {
|
||||||
$(event.target).removeAttr("id");
|
$(event.target).removeAttr("id");
|
||||||
$thisdiv = '#' + $(this).attr("id")
|
$thisdiv = '#' + $(this).attr("id")
|
||||||
starred = Cookies.get("starred")
|
starred = Cookies.get("starred")
|
||||||
starred = JSON.parse(starred);
|
starred = JSON.parse(starred);
|
||||||
starred.pop(starred.indexOf($(this).attr("dir")), starred.indexOf($(this).attr("dir")));
|
ourindex = starred.indexOf($(this).attr("id"));
|
||||||
|
starred.splice(ourindex, 1);
|
||||||
Cookies.set("starred", JSON.stringify(starred));
|
Cookies.set("starred", JSON.stringify(starred));
|
||||||
$("#pinnedgames " + $thisdiv).remove();
|
$("#pinnedgames " + $thisdiv).remove();
|
||||||
if(!$("#pinnedgames div") == "") {
|
if($('#pinnedgames').is(':empty')) {
|
||||||
$("#pinnedgames #message").show();
|
$("#pinnedmessage").show();
|
||||||
}
|
}
|
||||||
$($thisdiv + " #starred").removeAttr("id");
|
$($thisdiv + " #starred").removeAttr("id");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user