User:Dispenser/imageunlink.js

/** Image unlink ** * This script will unlink images so screen readers wont indicate that they are * links. It will relocate the attribute links to the footer. * If you want to use this script, simply add the following line to your Special:Mypage/skin.js: importScript('User:Dispenser/imageunlink.js'); // Linkback: User:Dispenser/imageunlink.js

* (Please keep the comment so I can see how many people use this). */ function imageUnlink { var bodyc = document.getElementById('bodyContent') || document.getElementById('content') || document.getElementById('mw_content') || document.body; var images = bodyc.getElementsByTagName("IMG"); var creditLinks = []; for(var i=images.length-1; i>=0; i--){ var a = images[i].parentNode; if(a.tagName == "A" && a.childNodes.length==1){ if(a.className=="image") { // Images which link to its own description page a.parentNode.insertBefore(images[i], a); creditLinks.push(a); } else if(a.className=="internal") { // Enlarge icon a.parentNode.removeChild(a); }else if(a.className=="") { // Overridden image link (|link=) }		}	}	if(creditLinks.length>0) { var copyright = document.getElementById('copyright') || document.getElementById('footer-info-copyright'); copyright.appendChild(document.createTextNode(creditLinks.length==1?"Image credit: ":"Image credits: ")); creditLinks.reverse; for(var i=0; creditLinks[i]; i++){ copyright.appendChild(creditLinks[i]).appendChild(				document.createTextNode(creditLinks[i+1]?(i+1)+", ":i+1)			); }		copyright.appendChild(document.createElement("BR")); } } if(doneOnloadHook) imageUnlink; //if imported dynamically else addOnloadHook(imageUnlink);