mirror of
https://gitlab.com/skysthelimit.dev/selenite.git
synced 2025-06-16 02:22:07 -05:00
29 lines
805 B
JavaScript
29 lines
805 B
JavaScript
$.getJSON("/games.json", function (data) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
$('#games').append(
|
|
$('<div>').prop({
|
|
id: 'game',
|
|
style: 'cursor: pointer;',
|
|
dir: data[i].directory
|
|
}).append(
|
|
$('<img>').prop({
|
|
src: data[i].directory + "/" + data[i].image,
|
|
alt: data[i].name + " logo"
|
|
})
|
|
).append(
|
|
$('<h1>').text(data[i].name)
|
|
)
|
|
);
|
|
}
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
$(document).on("click", "#game", function(event) {
|
|
redirectGame($(this).attr("dir"));
|
|
});
|
|
});
|
|
|
|
function redirectGame(dir) {
|
|
window.location.href = window.location.origin + "/" + dir + "/index.html";
|
|
}
|