User:Moviesign/common.js

var x = document.getElementsByClassName("portable-infobox")[0]; if (x.length > 0) { var list = x.getElementsByTagName("FIGURE"); var i; var a; var img; for (i = 0; i < list.length; i++) { a = list[i].getElementsByTagName("A")[0]; img = a.getElementsByTagName("IMG")[0]; if (img.hasAttribute("data-image-name")) { a.addEventListener("dblclick", myFunction(img.getAttribute("data-image-name"))); }   } } function myFunction(filename) { location.pathname = "/wiki/File:" + filename; }