User:Ucucha/duplinks.js: Difference between revisions

Content deleted Content added
exclude any links in infoboxes and navboxes
import Evad37's script
Tag: Replaced
 
(7 intermediate revisions by 2 users not shown)
Line 1:
importScript('User:Evad37/duplinks-alt.js');
$( function($) {
if(wgNamespaceNumber != 0) {
return;
}
var portletlink = mw.util.addPortletLink('p-tb', '#', 'Hightlight duplicate links', 'ca-findduplicatelinks');
$(portletlink).click( function(e) {
e.preventDefault();
var seen = {};
mw.util.addCSS(".duplicate-link { border: 1px solid red; }");
mw.util.$content.find('a').not('.infobox *, .navbox *').each(function() {
var href = $(this).attr('href');
if(href.indexOf('#') != 0) {
if(seen[href]) {
$(this).addClass("duplicate-link");
}
else {
seen[href] = true;
}
}
});
});
});