mirror of
https://gitlab.com/skysthelimit.dev/selenite.git
synced 2025-06-16 02:22:07 -05:00
error handling
This commit is contained in:
parent
cb1c9dd7eb
commit
78531c08d5
@ -22,6 +22,7 @@ $.getJSON("/games.json", function (data) {
|
|||||||
$("<img>").prop({
|
$("<img>").prop({
|
||||||
src: data[i].directory + "/" + data[i].image,
|
src: data[i].directory + "/" + data[i].image,
|
||||||
alt: data[i].name + " logo",
|
alt: data[i].name + " logo",
|
||||||
|
onerror: "failedImg($(this));",
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.append($("<h1>").text(data[i].name))
|
.append($("<h1>").text(data[i].name))
|
||||||
@ -41,6 +42,7 @@ $.getJSON("/games.json", function (data) {
|
|||||||
if ($("#pinnedgames #message")) {
|
if ($("#pinnedgames #message")) {
|
||||||
$("#pinnedmessage").hide();
|
$("#pinnedmessage").hide();
|
||||||
}
|
}
|
||||||
|
$element.addEventListener("error", imageNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#games").append($element);
|
$("#games").append($element);
|
||||||
@ -84,6 +86,7 @@ $(document).ready(function () {
|
|||||||
$("<img>").prop({
|
$("<img>").prop({
|
||||||
src: pinnedarraynodes[0].src,
|
src: pinnedarraynodes[0].src,
|
||||||
alt: pinnedarraynodes[0].alt,
|
alt: pinnedarraynodes[0].alt,
|
||||||
|
class: "gameicon"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.append($("<h1>").text(pinnedarraynodes[1].innerHTML))
|
.append($("<h1>").text(pinnedarraynodes[1].innerHTML))
|
||||||
@ -164,4 +167,4 @@ function selectRandomGame() {
|
|||||||
redirectGame(gamelist[randomgame].directory);
|
redirectGame(gamelist[randomgame].directory);
|
||||||
s;
|
s;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
20
js/main.js
20
js/main.js
@ -13,3 +13,23 @@ function check() {
|
|||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
interval = setInterval(check, 50);
|
interval = setInterval(check, 50);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.addEventListener("error", function (event) {
|
||||||
|
if (event.target instanceof HTMLImageElement) {
|
||||||
|
alert(
|
||||||
|
"Error: Image failed to load." +
|
||||||
|
"\nFull Image URL: " + event.target.src +
|
||||||
|
'\nPlease copy this error message and click "Report a Bug" or go to https://forms.gle/j75WUn6UhdqsRZgf7'
|
||||||
|
)
|
||||||
|
event.target.src = "favicon.png";
|
||||||
|
} else {
|
||||||
|
alert (
|
||||||
|
"Error: " + event.message +
|
||||||
|
"\nScript: " + event.filename +
|
||||||
|
"\nLine: " + event.lineno +
|
||||||
|
"\nColumn: " + event.colno +
|
||||||
|
"\nStackTrace: " + event.error +
|
||||||
|
'\nPlease copy this error message and click "Report a Bug" or go to https://forms.gle/j75WUn6UhdqsRZgf7'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
@ -28,4 +28,4 @@ function setTheme(themename, firstload) {
|
|||||||
themeloaded = 1;
|
themeloaded = 1;
|
||||||
console.log("theme loaded");
|
console.log("theme loaded");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user