diff --git a/js/image_viewer.js b/js/image_viewer.js index c5a4275..08c2cf1 100644 --- a/js/image_viewer.js +++ b/js/image_viewer.js @@ -22,6 +22,18 @@ function unpop(event) { } } +function display(event) { + if (event.button != 1) { + return; + } + var target = event.target.parentNode; + if (target.nodeName != "FIGURE") { + target = event.target; + } + var href = target.parentNode.dataset.href; + window.open(href, '_blank'); +} + function displayNeighbour(which) { var viewer = document.getElementById('viewer'); var current = viewer.lastChild; @@ -98,6 +110,8 @@ document.body.addEventListener( /* Makes thumbnails interactive */ for (var thumb of document.getElementsByClassName('thumbnail')) { thumb.dataset.href = thumb.href; - thumb.href = 'javascript: void(0);'; + thumb.removeAttribute('href'); + thumb.style = "cursor: pointer;"; thumb.addEventListener('click', pop); + thumb.addEventListener('auxclick', display); }