From f4920ee19e26a9682ae2340c8ae440a9ad5d7646 Mon Sep 17 00:00:00 2001 From: Sky Date: Thu, 27 Jul 2023 21:53:52 -0400 Subject: [PATCH] im gonna make alphabetize and shit tomorrow bc i havent eaten dinner and im tired --- index.html | 7 +++---- js/games.js | 12 ++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 53750593..bdd33621 100644 --- a/index.html +++ b/index.html @@ -56,10 +56,9 @@



-
-

Pinned Games

-

Looks like you haven't pinned any games, click the star icon next to any game in order to pin them up here!

-
+

Pinned Games

+
+

Looks like you haven't pinned any games, click the star icon next to any game in order to pin them up here!

All Games

Please wait for the games to load.. If you see this for more than a second, try reloading and reporting a bug report.

diff --git a/js/games.js b/js/games.js index 9108d64f..cc327f51 100644 --- a/js/games.js +++ b/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 = $('
').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"); }