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>
|
||||
<input type="text" id="gamesearch" placeholder="Type here to search.."> <br>
|
||||
<br>
|
||||
<div id="pinnedgames">
|
||||
<h2>Pinned Games</h2>
|
||||
<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>
|
||||
</div>
|
||||
<h2>Pinned Games</h2>
|
||||
<div id="pinnedgames"></div>
|
||||
<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 id="games">
|
||||
<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>
|
||||
|
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!"});
|
||||
data.sort(dynamicSort("name"));
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
console.log("Loop iteration:", i);
|
||||
let $element = $('<div>').prop({
|
||||
class: 'game',
|
||||
style: 'cursor: pointer;',
|
||||
@ -34,7 +33,7 @@ $.getJSON("/games.json", function (data) {
|
||||
let $pinnedelement = $element.clone();
|
||||
$('#pinnedgames').append($pinnedelement);
|
||||
if($("#pinnedgames #message")) {
|
||||
$("#pinnedgames #message").hide();
|
||||
$("#pinnedmessage").hide();
|
||||
}
|
||||
|
||||
}
|
||||
@ -61,17 +60,18 @@ $(document).ready(function() {
|
||||
Cookies.set("starred", JSON.stringify(starred));
|
||||
$element = $(this).clone();
|
||||
$('#pinnedgames').append($element);
|
||||
$("#pinnedgames #message").hide();
|
||||
$("#pinnedmessage").hide();
|
||||
} else {
|
||||
$(event.target).removeAttr("id");
|
||||
$thisdiv = '#' + $(this).attr("id")
|
||||
starred = Cookies.get("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));
|
||||
$("#pinnedgames " + $thisdiv).remove();
|
||||
if(!$("#pinnedgames div") == "") {
|
||||
$("#pinnedgames #message").show();
|
||||
if($('#pinnedgames').is(':empty')) {
|
||||
$("#pinnedmessage").show();
|
||||
}
|
||||
$($thisdiv + " #starred").removeAttr("id");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user