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