mirror of
https://gitlab.com/skysthelimit.dev/selenite.git
synced 2025-06-16 02:22:07 -05:00
alphabetize and add failsafe for games with a dot in dir
This commit is contained in:
parent
f4920ee19e
commit
542d3cf39a
54
js/games.js
54
js/games.js
@ -61,20 +61,48 @@ $(document).ready(function() {
|
|||||||
$element = $(this).clone();
|
$element = $(this).clone();
|
||||||
$('#pinnedgames').append($element);
|
$('#pinnedgames').append($element);
|
||||||
$("#pinnedmessage").hide();
|
$("#pinnedmessage").hide();
|
||||||
} else {
|
temp = $('#pinnedgames')[0].childNodes;
|
||||||
$(event.target).removeAttr("id");
|
pinnedarray = [...temp]
|
||||||
$thisdiv = '#' + $(this).attr("id")
|
|
||||||
starred = Cookies.get("starred")
|
pinnedarray.sort(dynamicSort("id"));
|
||||||
starred = JSON.parse(starred);
|
$("#pinnedgames").empty();
|
||||||
ourindex = starred.indexOf($(this).attr("id"));
|
for (let i = 0; i < pinnedarray.length; i++) {
|
||||||
starred.splice(ourindex, 1);
|
pinnedarraynodes = pinnedarray[i].childNodes;
|
||||||
Cookies.set("starred", JSON.stringify(starred));
|
pinnedarraynodes = [...pinnedarraynodes]
|
||||||
$("#pinnedgames " + $thisdiv).remove();
|
let $element = $('<div>').prop({
|
||||||
if($('#pinnedgames').is(':empty')) {
|
class: 'game',
|
||||||
$("#pinnedmessage").show();
|
style: 'cursor: pointer;',
|
||||||
|
id: pinnedarray[i].id
|
||||||
|
}).append(
|
||||||
|
$('<img>').prop({
|
||||||
|
src: pinnedarraynodes[0].src,
|
||||||
|
alt: pinnedarraynodes[0].alt
|
||||||
|
})
|
||||||
|
).append(
|
||||||
|
$('<h1>').text(pinnedarraynodes[1].innerHTML)
|
||||||
|
).append(
|
||||||
|
$("<mat-icon>").prop({
|
||||||
|
class: 'material-symbols-rounded',
|
||||||
|
id: 'starred'
|
||||||
|
}).text("star")
|
||||||
|
);
|
||||||
|
$('#pinnedgames').append($element);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$(event.target).removeAttr("id");
|
||||||
|
$thisdiv = '#' + $(this).attr("id")
|
||||||
|
$thisdiv = $thisdiv.replace(".", "\\.");
|
||||||
|
starred = Cookies.get("starred")
|
||||||
|
starred = JSON.parse(starred);
|
||||||
|
ourindex = starred.indexOf($(this).attr("id"));
|
||||||
|
starred.splice(ourindex, 1);
|
||||||
|
Cookies.set("starred", JSON.stringify(starred));
|
||||||
|
$("#pinnedgames " + $thisdiv).remove();
|
||||||
|
if($('#pinnedgames').is(':empty')) {
|
||||||
|
$("#pinnedmessage").show();
|
||||||
|
}
|
||||||
|
$($thisdiv + " #starred").removeAttr("id");
|
||||||
}
|
}
|
||||||
$($thisdiv + " #starred").removeAttr("id");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
redirectGame($(this).attr("id"));
|
redirectGame($(this).attr("id"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user