User:Moviesign/common.js

/* This first attempt to add a double-click even handler to the image did not work */ //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"))); //       } //    } //}

/* This code will enable the "info-icon" when you hover your mouse over an image inside a portable infobox. */ /* var portbox = document.getElementsByClassName("portable-infobox"); if (portbox.length > 0) { var list = portbox[0].getElementsByTagName("FIGURE"); var i;   for (i = 0; i < list.length; i++) { list[i].className += " article-thumb show-info-icon"; var img = list[i].getElementsByTagName("IMG")[0]; img.className += " thumbimage"; var node = document.createElement("A"); node.href = "/wiki/File:" + img.getAttribute("data-image-name"); node.className = "sprite info-icon"; if (list[i].getElementsByTagName("FIGCAPTION").length <= 0) { list[i].appendChild(document.createElement("FIGCAPTION")); }       list[i].getElementsByTagName("FIGCAPTION")[0].appendChild(node); } } //function myFunction(filename) { //   location.pathname = "/wiki/File:" + filename; //}