User:Ais523/selfreftab.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
// <pre> addOnloadHook(function () { var spans = document.body.getElementsByTagName('span'); var i; var a; for(i in spans) { if(spans[i].className!=null) if(spans[i].className.toLowerCase().indexOf("selfreference")!=-1) { //found a selfref spans[i].style.display="none"; a=spans[i].getElementsByTagName("A"); if(a.length==0) break; //can't find a dablink a=a[a.length-1]; //find last hyperlink in the selfref; this will probably be the dablink itself addPortletLink("p-cactions",a.href,"WP","ca-dablink","WP",""); break; //in case of multiple selfrefs, just do one } } }); // </pre> //[[Category:Wikipedia scripts]]