User:Psl85/common.js

/** * Creates a default summary of "new page" when without a provided summary for new pages. * * @author User:TheSatanicSanta * @author User:Xbony2 * @author User:Chocohead (for new page fix) * Based off of: * * wikipedia:Wikipedia:WikiProject_User_scripts/Scripts/Force_edit_summary * * http://habbo.gamepedia.com/User:Cblair91/common.js * */ $('#wpSave').click(function{	if (wgArticleId === 0 && !document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/, '$1')) {		if (!document.forms.editform.wpTextbox1.value.startsWith("#REDIRECT")) {			document.forms.editform.wpSummary.value = 'new page';		}	} });

/** * Automatically uncheck the "Leave a redirect behind" button on the move page */ var inputObject = $('#wpLeaveRedirect > .oo-ui-inputWidget-input'); if (inputObject.length > 0) { inputObject[0]['checked'] = false; }

mw.loader.localLoad = function(url){ return mw.loader.load('https://ftb.gamepedia.com/index.php?title=' + url + '&action=raw&ctype=text/javascript'); };

mw.loader.localLoad('User:Xbony2/common/autosummary.js'); //mw.loader.localLoad('User:Xbony2/common/dirtydefault.js'); //mw.loader.localLoad('User:Xbony2/common/everyonelovesbony.js'); //mw.loader.localLoad('User:Xbony2/common/nei.js'); //mw.loader.localLoad('User:Xbony2/common/translatation admins toolbar.js');

/*if(ftb !== undefined && ftb.loaded.length === 0){ mw.loader.localLoad('MediaWiki:Common.js'); }*/

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 or IP address is blocked from editing';		( 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('//m.wikimedia.org/w/index.php?title=Mediawiki:Gadget-markblocked.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');

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

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

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:PrimeHunter/My_subpages.js&action=raw&ctype=text/javascript');

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:The_Evil_IP_address/hdedit.js&action=raw&ctype=text/javascript');

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Theopolisme/ajaxWatchlist.js&action=raw&ctype=text/javascript');

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Equazcion/SafetyEdit.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: 'JavaScript Error',		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( '' );		} else if ( restrictions.indexOf( 'director' ) !== -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( 'Discussion' ); $( '#ca-history a' ).text( 'Edit history' );