User:Evad37/duplinks-alt.js: Difference between revisions

Content deleted Content added
this should make it more efficient
will now work when editing with VisualEditor
Line 11:
// create a separate div surrounding the lead
// first get the element immediately surrounding the article text. Unfortunately, MW doesn't seem to provide a non-fragile way for that.
// also check if VisualEditor is being used - the element surrounding text is different in VE
var content = ".mw-content-ltr";
var href = window.___location.href;
if(href.search("veaction")>0) { var content = ".ve-ce-documentNode.ve-ce-branchNode"; }
else { var content = ".mw-content-ltr"; }
$(content).prepend(document.createElement('div'));
var lead = $(content).children()[0];