User:Isarra/common.js/global.js
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)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
popupStructure = 'menus';
/* Rollback all */
$( function() {
if ( $('span.mw-rollback-link')[0] && mw.config.get( 'wgCanonicalSpecialPageName' ) == 'Contributions' )
mw.util.addPortletLink( 'p-cactions', 'javascript:rollbackEverything()', "rollback all", "ca-rollbackeverything", "Rollback all top edits displayed here" );
} );
function rollbackEverything() {
for ( var i in document.links ) {
if ( document.links[i].href.indexOf( 'action=rollback' ) != -1 )
window.open( document.links[i].href+'&bot=1' );
}
}
/* Interface modifications because irk */
$( function(){
if( mw.config.get( 'wgNamespaceNumber' ) > -1 ) {
mw.util.addPortletLink( 'p-cactions', '/wiki/Special:PrefixIndex/' + wgPageName, 'Subpages', 'd-subpages', 'List subpages and other pages starting with this title' );
mw.util.addPortletLink( 'p-cactions', '/w/index.php?title=Special:Log&page=' + wgPageName, 'Logs', 'd-logs', 'Show any relevant logs for this title' );
}
$('#n-randompage').before($('#n-recentchanges'));
mw.util.addPortletLink( 'p-personal', '/wiki/Special:ListFiles/' + wgUserName, 'Uploads', 'pt-uploads' );
mw.util.addPortletLink( 'p-personal', '/wiki/Special:Log/' + wgUserName, 'Logs', 'pt-logs' );
// mw.util.addPortletLink( 'p-personal', '/wiki/Special:PrefixIndex/User:'+ wgUserName, 'Subpages', 'pt-subpages' );
$('#pt-logs').after($('#pt-logout'));
$('#pt-logout').after($('#utcdate'));
} );
/* Fix part of ULS */
if ( jQuery( '#pt-uls' ).length ) {
jQuery( '#pt-uls' ).remove();
}
/* Tab thing like proper (yoinked from SO) */
jQuery( "textarea" ).keydown( function( e ) {
if( e.keyCode === 9 ) { // tab was pressed
// get caret position/selection
var start = this.selectionStart;
var end = this.selectionEnd;
var $this = jQuery( this );
var value = $this.val();
// set textarea value to: text before caret + tab + text after caret
$this.val( value.substring( 0, start )
+ "\t"
+ value.substring( end ) );
// put caret at right position again (add one for the tab)
this.selectionStart = this.selectionEnd = start + 1;
// prevent the focus lose
e.preventDefault();
}
} );