X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=3235f5191f285f71cad6468496f526805325cb86;hp=07c5b3dad3546cf62eea589a74e42be9ccdc902c;hb=a404c9c2b1908f4b9181d8e60f11b846812757fb;hpb=748a763416ff1bf018a4e425f78d01b39f460dd6 diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 07c5b3d..3235f51 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1878,6 +1878,22 @@ var currentSoneMenuId; /** Timeout handler for the next-to-show Sone context menu. */ var currentSoneMenuTimeoutHandler; +function replaceImagesWithErrorWithBrokenImages() { + var replaceImage = function(imageElement, sourcePath) { + $(imageElement).attr("src", sourcePath) + .attr("width", "160") + .attr("height", "120") + .attr("style", "position: absolute; top: 0px; left: 0px; opacity: .25"); + }; + + $(".image-in-album .image img").error(function () { + replaceImage(this, "images/broken-image.png"); + }); + $(".album .image img").error(function () { + replaceImage(this, "images/broken-album.png"); + }); +} + $(document).ready(function() { /* rip out the status update textarea. */ @@ -2005,6 +2021,8 @@ $(document).ready(function() { /* activate status polling. */ setTimeout(getStatus, 5000); + replaceImagesWithErrorWithBrokenImages(); + /* reset activity counter when the page has focus. */ $(window).focus(function() { focus = true;