MediaWiki:Gadget-AcceleratedFormCreation.js: Difference between revisions

Created page with "// <nowiki> globals mw, $: // jshint maxerr:500 // FIXME: This gadget relies to an excessive degree on OrangeLinks to function. These gadgets should be made independent. * The starting point of the whole script. * * This adds a hook to the page load event so that the script runs * adds the generated text to the edit window once the page is done loading.: "use strict"; mw.loader.using(["mediawiki.util"]).done(function() { var pageName = mw.config.get(..."
 
m 1 revision imported
 
(4 intermediate revisions by 2 users not shown)
Line 140: Line 140:
}
}
// use URL to ensure we append to the query string, not e.g. the hash.
var targetUrl = new URL(link.href);
// Now build a new "green link" URL to replace the original red link with
// Now build a new "green link" URL to replace the original red link with
link.href +=
targetUrl.search +=
"&editintro=MediaWiki:Gadget-AcceleratedFormCreation.js/intro" +
"&editintro=MediaWiki:Gadget-AcceleratedFormCreation.js/intro" +
"&accel_lang=" + encodeURIComponent(lang) +
"&accel_lang=" + encodeURIComponent(lang) +
Line 147: Line 149:
"&" + accelParam +  
"&" + accelParam +  
"&veswitched=1";
"&veswitched=1";
link.href = targetUrl.href;
link.classList.add("accelerated");
link.classList.add("accelerated");
link.processedLink = true;
link.processedLink = true;