Skip to content

Commit 4d1a7ef

Browse files
fix image click
1 parent 38457bf commit 4d1a7ef

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

static/misc.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ function fillEntirePage() {
4040
(function () {
4141
// Images click
4242
for (var image of document.querySelectorAll("img")) {
43-
(function (i, src) {
44-
i.addEventListener("click", function () { window.open(src, "_blank"); });
45-
})(image, image.getAttribute("src"));
43+
var a = document.createElement("a");
44+
a.setAttribute("target", "_blank");
45+
a.setAttribute("href", image.getAttribute("src"));
46+
image.replaceWith(a);
47+
a.append(image);
4648
}
4749
})();

0 commit comments

Comments
 (0)