diff --git a/js/games.js b/js/games.js
index ee0a9993..1727af27 100644
--- a/js/games.js
+++ b/js/games.js
@@ -22,6 +22,7 @@ $.getJSON("/games.json", function (data) {
$("
").prop({
src: data[i].directory + "/" + data[i].image,
alt: data[i].name + " logo",
+ onerror: "failedImg($(this));",
})
)
.append($("
").text(data[i].name))
@@ -41,6 +42,7 @@ $.getJSON("/games.json", function (data) {
if ($("#pinnedgames #message")) {
$("#pinnedmessage").hide();
}
+ $element.addEventListener("error", imageNotFound);
}
$("#games").append($element);
@@ -84,6 +86,7 @@ $(document).ready(function () {
$("
").prop({
src: pinnedarraynodes[0].src,
alt: pinnedarraynodes[0].alt,
+ class: "gameicon"
})
)
.append($("").text(pinnedarraynodes[1].innerHTML))
@@ -164,4 +167,4 @@ function selectRandomGame() {
redirectGame(gamelist[randomgame].directory);
s;
}, 3000);
-}
+}
\ No newline at end of file
diff --git a/js/main.js b/js/main.js
index 78527497..20168a20 100644
--- a/js/main.js
+++ b/js/main.js
@@ -13,3 +13,23 @@ function check() {
window.onload = function () {
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);
diff --git a/js/themes.js b/js/themes.js
index 11fa5b43..14da78a2 100644
--- a/js/themes.js
+++ b/js/themes.js
@@ -28,4 +28,4 @@ function setTheme(themename, firstload) {
themeloaded = 1;
console.log("theme loaded");
}
-}
+}
\ No newline at end of file