User:Microchip08/global.js
Appearance
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:Microchip08/global.js&action=raw&ctype=text/javascript' );
if ( mw.config.get('wgPageName') === 'User:Microchip08/global.js' ) {
throw new Error('shan\'t load global.js on itself'); /* failsafe */
}
mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:Microchip08/highlight.js&action=raw&ctype=text/javascript' );
mw.loader.load( '//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-markblocked.js&action=raw&ctype=text/javascript' );
mw.loader.load( '//he.wikipedia.org/w/index.php?title=Mediawiki:Gadget-autocomplete.js&action=raw&ctype=text/javascript' );
/** Make redlink talk page tabs automatically start a new section */
function tpl () {
$( '#ca-talk.new span a' ).text( '+' );
$( '#ca-talk.new span a' ).attr( 'href', $( '#ca-talk.new span a' ).attr( 'href' ) + '§ion=new' );
}
$( tpl );
if ( mw.config.get( 'wgDBname' ) == 'enwiki' ) {
if ( mw.config.get('wgNamespaceNumber') === 0 ) {
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Shubinator/DYKcheck.js&action=raw&ctype=text/javascript' );
} else if ( mw.config.get('wgNamespaceNumber') === 6 ) {
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Microchip08/PermissionOTRS.js&action=raw&ctype=text/javascript' );
mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:MGA73/nowcommonsreview.js&action=raw&ctype=text/javascript' );
}
} else if ( mw.config.get( 'wgDBname' ) == 'otrs_wikiwiki' ) {
/** make private wikis green as a reminder */
//mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:Microchip08/green.css&action=raw&ctype=text/css', 'text/css' );
}
function commonsHelperLink () {
// ?interface={{CONTENTLANGUAGE}}&image={{PAGENAME}}&lang={{CONTENTLANGUAGE}}
if ( mw.config.get('wgNamespaceNumber') == 6 && mw.config.get('wgServer') !== '//commons.wikimedia.org' ) { //NS_IMAGE
var t = document.getElementById( 't-whatlinkshere' );
if ( !t ) return;
var li = document.createElement( 'li' );
var a = document.createElement( 'a' );
var ch = '//tools.wmflabs.org/commonshelper/?interface=' + mw.config.get('wgContentLanguage');
ch += '&image=' + mw.config.get('wgTitle') + '&lang=' + mw.config.get('wgContentLanguage');
a.setAttribute( 'href', ch );
a.appendChild( document.createTextNode( 'Move to Commons' ) );
li.appendChild( a );
t.parentNode.appendChild( li );
}
}
$( commonsHelperLink );
// https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2014-September/000941.html
// Intentionally using non-strict comparison with ==, not ===, because of [[bugzilla:52542]]
if ( mw.user.options.get( 'wikibase-otherprojects' ) == 0 ) {
mw.loader.using( 'mediawiki.api', function () {
var api = new mw.Api();
api.postWithToken( 'options', {
action: 'options',
optionname: 'wikibase-otherprojects',
optionvalue: 1
} );
} );
}