User:PSL600/common.js

//

{		imageId: 'button-redirect', imageFile: '//upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png', speedTip: 'Redirect', tagOpen: '#REDIRECT',		tagClose: '', sampleText: 'Target page name' },	{		imageId: 'button-strike', imageFile: '//upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png', speedTip: 'Strike', tagOpen: ' ', tagClose: ' ', sampleText: 'Strike-through text' },	{		imageId: 'button-enter', imageFile: '//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png', speedTip: 'Line break', tagOpen: ' ', tagClose: '', sampleText: '' },	{		imageId: 'button-subscript', imageFile: '//upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png', speedTip: 'Subscript', tagOpen: ' ', tagClose: ' ', sampleText: 'Subscript text' },	{		imageId: 'button-superscript', imageFile: '//upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png', speedTip: 'Superscript', tagOpen: ' ', tagClose: ' ', sampleText: 'Superscript text' },	{		imageId: 'button-small', imageFile: '//upload.wikimedia.org/wikipedia/en/5/58/Button_small.png', speedTip: 'Small', tagOpen: ' ', tagClose: ' ', sampleText: 'Small text' },	{		imageId: 'button-hide-comment', imageFile: '//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png', speedTip: 'Insert hidden Comment', tagOpen: '', sampleText: 'Comment' },	{		imageId: 'button-gallery', imageFile: '//upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png', speedTip: 'Insert a picture gallery', tagOpen: '\n', sampleText: 'Insert gallery images' },	{		imageId: 'button-insert-wplink', imageFile: '//upload.wikimedia.org/wikipedia/commons/7/7f/Button_link_to_Wikipedia.png', speedTip: 'Insert a link to a Wikipedia article', tagOpen: 'wikipedia:',		tagClose: '', sampleText: 'Wikipedia article name' },	{		imageId: 'button-insert-wplink', imageFile: '//upload.wikimedia.org/wikipedia/commons/0/0d/Button_wikification.png', speedTip: 'Insert a link to a Wiktionary word definition', tagOpen: 'wikt:',		tagClose: '', sampleText: 'Wiktionary definition' },	{		imageId: 'button-insert-poem', imageFile: '//upload.wikimedia.org/wikipedia/commons/d/d3/Button_definition_list.png', speedTip: 'Insert a poem', tagOpen: ' ', tagClose: ' ', sampleText: 'Text' },	{		imageId: 'button-insert-subpage', imageFile: '//upload.wikimedia.org/wikipedia/commons/0/0c/Button_Link_DifferentName.png', speedTip: 'Link to a subpage', tagOpen: '/',		tagClose: '', sampleText: 'Subpage' },	{		imageId: 'button-insert-textcenter', imageFile: '//upload.wikimedia.org/wikipedia/commons/5/5f/Button_center.png', speedTip: 'Text centered', tagOpen: ' ', tagClose: ' ', sampleText: 'Centered text' },	{		imageId: 'button-insert-textcenter', imageFile: '//upload.wikimedia.org/wikipedia/commons/d/d5/Button_noinclude.png', speedTip: 'noinclude', tagOpen: ' ', tagClose: ' ', sampleText: 'noinclude text' },	{		imageId: 'button-insert-plainlink', imageFile: '//upload.wikimedia.org/wikipedia/commons/2/26/Button_plainlinks.png', speedTip: 'Insert a external link without the external link icon', tagOpen: ' ', tagClose: ' ', sampleText: 'Enter URL here' }	); }

mw.loader.using( 'user.options', function {	// This can be the string "0" if the user disabled the preference (52542)	if ( mw.user.options.get( 'usebetatoolbar' ) != 1 && mw.user.options.get( 'showtoolbar' ) == 1 ) {		$.when( mw.loader.using( 'mediawiki.toolbar' ), $.ready ).then( addExtraButtons );	} } );

mw.loader.load( '//minecraft.gamepedia.com/index.php?title=User:Majr/goToTop.js&action=raw&ctype=text/javascript' );

if ( mw.config.get( 'wgRelevantUserName' ) ) { $( function {		'use strict';		var title = 'This user is blocked';		( new mw.Api ).get( { action: 'query', format: 'json', list: 'blocks', formatversion: 2, bkusers: mw.config.get( 'wgRelevantUserName' ) } ).done( function( data ) { if ( data.query.blocks.length ) { $( '.mw-indicators' ).prepend(					'' +						'' +					''				); }		} );	} ); }

// Scripts, some imported from Wiki Pedia, and modified to use on this wiki //

mw.loader.load('//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript');

mw.loader.load('//en.wikipedia.org/w/index.php?title=Mediawiki:Gadget-popups.js&action=raw&ctype=text/javascript');

mw.loader.load('//en.wikipedia.org/w/index.php?title=Mediawiki:Gadget-edittop.js&action=raw&ctype=text/javascript');

/** * charinsert loader */

$( function {    var tab, tablink;

tab = document.getElementById('ca-addsection'); if ( !tab ) { return; }

tablink = tab.getElementsByTagName('a')[0]; if ( !tablink ) { return; }

tablink.firstChild.nodeValue = '+'; if ( mw.config.get( 'skin' ) === 'monobook' ) { tablink.style.paddingLeft = ".4em"; tablink.style.paddingRight = ".4em"; } });

// This only shows alerts for things after this handler is installed of course. // Because this is a gadget, error reporting can thus be inconsistent. var originalErrorHandler = window.onerror || null; // Column and error args are optional window.onerror = function ( message, url, line, colomn, error ) { var $msg = $( ' ' ); if ( url ) { $( ' ' )			.text( url + ' at line ' + line + ': ' ) .appendTo( $msg ); }	$( ' ' )		.text( message ) .appendTo( $msg );

mw.notify( $msg, {		autoHide: true,		autoHideSeconds: 10,		tag: null,		title: 'An error occured:',		type: 'error'	} ); if (originalErrorHandler) { return originalErrorHandler.apply(this, arguments); } }; // unbind on leaving the page $( window ) .on( 'unload', function {		window.onerror = originalErrorHandler;	} );

$( function {	'use strict';	var restrictions = mw.config.get( 'wgRestrictionEdit' );	if ( restrictions ) {		if ( restrictions.indexOf( 'sysop' ) !== -1 ) {			$( '.mw-indicators' ).prepend( '' );		} else if ( restrictions.indexOf( 'autoconfirmed' ) !== -1 ) {			$( '.mw-indicators' ).prepend( '' );		}		}	} );

// See User:Equazcion/SafetyEdit if ( 	// Activate on edits	(( wgAction == "edit" ) || ( wgAction == "submit" ))){ // Insert the checkbox $('#mw-editpage-watch').after('&#160; &#160;Enable save '); // Disable the save button on load $('input[name="wpSave"]').prop("disabled", true); // Set summary line to disable enter key saving when it recieves focus. // Unbinding on load doesn't work since MediaWiki JS will bind after this. $('#wpSummary').focus(function{		$(this).unbind;	}); // Set the change function for the checkbox $('input.ruSure').change(function{		if ($(this).prop("checked")){			// We use the name attribute so all potential save buttons (produced by other scripts etc) are affected			$('input[name="wpSave"]').prop("disabled", false);			// If checked, undo our summary line focus event from above 			$('#wpSummary').unbind('focus');			// Make enter key on summary line save again			$('#wpSummary').keydown(function(event){ if (event.keyCode == 13) { $('form#editform').submit; return false; }			});		} else {			$('input[name="wpSave"]').prop("disabled", true);			// Here we can just unbind without a focus event, because MediaWiki JS won't supercede us again			$('#wpSummary').unbind;		}	}); } //

$( '#ca-nstab-user a' ).text( 'Userpage' ); $( '#ca-talk a' ).text( 'Talk' ); $( '#ca-history a' ).text( 'Page history' );

//