From: Steinar H. Gunderson Date: Mon, 14 Jul 2014 11:06:10 +0000 (+0200) Subject: A small fix to make some loads of /box/ redundant. X-Git-Url: https://git.sesse.net/?p=pr0n;a=commitdiff_plain;h=e78f88f249607b1367c7cbe38c564e93ad52f30e A small fix to make some loads of /box/ redundant. --- diff --git a/files/pr0n-fullscreen.js b/files/pr0n-fullscreen.js index 661cea7..8c02b45 100644 --- a/files/pr0n-fullscreen.js +++ b/files/pr0n-fullscreen.js @@ -113,17 +113,16 @@ function replace_image_element(url, element_id, parent_node) { var img = document.getElementById(element_id); if (img !== null) { + if (img.src === url) { + return img; + } img.parentNode.removeChild(img); } img = document.createElement("img"); img.id = element_id; img.alt = ""; - - if (img.src != url) { - img.src = url; - } - + img.src = url; parent_node.appendChild(img); return img; }