-9 Removals
+6 Additions
1// Check if Twinkle gadget is enabled, otherwise do nothing (unfortunately won't detect manual installs)1// Check if Twinkle gadget is enabled, otherwise do nothing (unfortunately won't detect manual installs)
2if (mw.user.options.get('gadget-Twinkle') == 1){2if (mw.user.options.get('gadget-Twinkle') == 1){
3 3
4 // Replace spaces in username with underscores for comparison to page title4 // Replace spaces in username with underscores for comparison to page title
5 var fixedUn = wgUserName.replace(/ /g,'_');5 var fixedUn = mw.config.get('wgUserName').replace(/ /g,'_');
6 6
7 // Check if we're on an owned JS or CSS page. 7 // Check if we're on an owned JS or CSS page.
8 if ( (wgPageName.lastIndexOf('.js') == wgPageName.length - 3) && (wgPageName.substring(0, fixedUn.length + 5) == "User:" + fixedUn) ){8 if ( (mw.config.get('wgPageName').lastIndexOf('.js') == mw.config.get('wgPageName').length - 3) && (mw.config.get('wgPageName').substring(0, fixedUn.length + 5) == "User:" + fixedUn) ){
9 9
10 // Suppress the Twinkle preference notification box, which normally shows up on any owned JS or CSS page. 10 // Suppress the Twinkle preference notification box, which normally shows up on any owned JS or CSS page.
11 // (Hiding it via JS doesn't always work, especially while editing a JS or CSS page, so we need to import some CSS to do it)11 // (Hiding it via JS doesn't always work, especially while editing a JS or CSS page, so we need to import some CSS to do it)
12 importStylesheet('User:Equazcion/HideTwinklePrefs.css');12 importStylesheet('User:Equazcion/HideTwinklePrefs.css');
13 }13 }
1414
15 // Set URL prefix
16 var pre = location.protocol + '//' + wgPageContentLanguage + '.' + wgNoticeProject + '.org' + '/w/index.php?title=';
17
18 // Add the Twinkle prefs link in the user links line at page tops, next to the usual Preferences link15 // Add the Twinkle prefs link in the user links line at page tops, next to the usual Preferences link
19 $('li#pt-preferences').after('<li id="pt-twinklePrefs" style="margin-left:.2em" title="Your Twinkle preferences">' + 16 $('li#pt-preferences').after('<li id="pt-twinklePrefs" style="margin-left:.2em" title="Your Twinkle preferences">' +
20 '<a href="' + pre + 'Wikipedia:Twinkle/Preferences">[TW]</a></li>');17 '<a href="' + mw.util.getUrl('Wikipedia:Twinkle/Preferences') + '">[TW]</a></li>');
2118
22}19}
Editor
Original Text
Changed Text
Recommended videos