User:Psl631/global.js

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

/** Scripts **/

/* add pulldown menu to choose edit summary */

/* global mediaWiki, ve */

( function ( $, mw ) { // Wrap with anonymous function	var $summaryBox = $( '#wpSummary' ),		minorSummaries = [			'Spelling/grammar correction',			'Fixing style/layout errors',			'Reverting vandalism or test edit',			'Reverting unexplained content removal',			'Copyedit (minor)'		],		articleSummaries = [			'Expanding article',			'Adding/improving reference(s)',			'Adding/removing category/ies',			'Adding/removing external link(s)',			'Adding/removing wikilink(s)',			'Removing unsourced content',			'Removing linkspam per WP:EL',			'Clean up',			'Copyedit (major)'		],		nonArticleSummaries = [			'Reply',			'Comment',			'Suggestion'		],		talkPageSummaries = [			'WikiProject tagging',			'WikiProject assessment'		];

function addOptionsToDropdown( dropdown, optionTexts ) { dropdown.menu.addItems( optionTexts.map( function ( optionText ) { return new OO.ui.MenuOptionWidget( { label: optionText } ); } ) );	}

function onSummarySelect( option ) { // Save the original value of the edit summary field var editsummOriginalSummary = $summaryBox.val, canned = option.getLabel, newSummary = editsummOriginalSummary;

// Append old edit summary with space, if exists, // and last character != space if ( newSummary.length !== 0 && newSummary.charAt( newSummary.length - 1 ) !== ' ' ) { newSummary += ' '; }		newSummary += canned; $summaryBox.val( newSummary ).trigger( 'change' ); }

function insertSummaryOptions( $insertBeforeThis, dropdownWidth ) { // For convenience, add a dropdown box with some canned edit // summaries to the form. var namespace = mw.config.get( 'wgNamespaceNumber' ), dropdown = new OO.ui.DropdownWidget( {				label: 'Common edit summaries'			} ), minorDropdown = new OO.ui.DropdownWidget( {				label: 'Common minor edit summaries'			} );

dropdown.$element.css( 'width', dropdownWidth ); dropdown.menu.on( 'select', onSummarySelect );

minorDropdown.$element.css( 'width', dropdownWidth ); minorDropdown.menu.on( 'select', onSummarySelect );

addOptionsToDropdown( minorDropdown, minorSummaries );

if ( namespace === 0 ) { addOptionsToDropdown( dropdown, articleSummaries ); } else { addOptionsToDropdown( dropdown, nonArticleSummaries ); if ( namespace % 2 !== 0 && namespace !== 3 ) { addOptionsToDropdown( dropdown, talkPageSummaries ); }		}

$insertBeforeThis.before( dropdown.$element ); $insertBeforeThis.before( minorDropdown.$element ); }	// VisualEditor mw.hook( 've.saveDialog.stateChanged' ).add( function {		var target, $saveOptions;		// .ve-init-mw-viewPageTarget-saveDialog-checkboxes		if ( $( 'body' ).data( 'wppresent' ) ) { return; }		$( 'body' ).data( 'wppresent', 'true' );

target = ve.init.target; $saveOptions = target.saveDialog.$saveOptions; $summaryBox = target.saveDialog.editSummaryInput.$input; if ( !$saveOptions.length ) { return; }		insertSummaryOptions( $saveOptions ); } );	// WikiEditor	$.when( mw.loader.using( 'oojs-ui-core' ), $.ready ).then( function { var $editCheckboxes = $( '.editCheckboxes' );

// If we failed to find the editCheckboxes class if ( !$editCheckboxes.length ) { return; }		insertSummaryOptions( $editCheckboxes, '48%' ); } ); }( jQuery, mediaWiki ) ); // End wrap with anonymous function

// User:Majr/docTabs.js // Adds Doc + Doc discussion tabs to template and module pages and // changes Template/Module + Discussion tabs to always link to the original template/module + discussion page if ( 	$.inArray( mw.config.get( 'wgNamespaceNumber' ), [ 10, 11, 828, 829 ] ) > -1 ||	$.inArray( mw.config.get( 'wgNamespaceNumber' ), [ 2, 3 ] ) > -1 &&	mw.config.get( 'wgTitle' ).replace( /\/doc$/, '' ).search( /\.(js|css)$/ ) > -1 ) { mw.loader.localLoad( 'User:Majr/docTabs.js' ); }

// User:Majr/Prism.js // Adds JavaScript, CSS and Lua syntax highlighting, see file for license // Requires a theme from http://prismjs.com to be added to usercss mw.loader.localLoad( 'User:Majr/Prism.js' );

// User:Majr/inputCounter.js // Adds a character counter to input fields mw.loader.localLoad( 'User:Majr/inputCounter.js' );

// User:Majr/codeLinks.js mw.loader.localLoad( 'User:Majr/codeLinks.js' );

// User:Majr/renderConsoleOutput.js // Allows the output wikitext of the lua console to be rendered if ( $( '#mw-scribunto-console' ).length ) { mw.loader.localLoad( 'User:Majr/renderConsoleOutput.js' ); }

/** General fixes **/

$( function { 'use strict';

// Add a subpages link to pages if ( mw.config.get( 'wgArticleId' ) != 0 ) { mw.util.addPortletLink (		'p-tb',		'/Special:PrefixIndex/' + mw.config.get( 'wgRelevantPageName' ) + '/',		'Subpages',		't-subpages',		'Subpages of the article'	); }

/** Mostly direct code from User:Majr/hydra.js **/

// Modify the editing toolbar if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) > -1 ) { mw.loader.using( 'ext.wikiEditor.toolbar', function {

// Modify the text added by the signature button. var $button = $( '#wikiEditor-section-main > .group-insert > a[rel="signature"]' ); if ( $button.length ) { var action = $button.data( 'action' ); action.options.pre = ' ' + ' '; $button.data( 'action', action ); }

// Add an option to insert ' } }				}			}		// Add an option to insert template braces } ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'insert', tools: { sign: { label: 'Template', type: 'button', icon: '//upload.wikimedia.org/wikipedia/commons/4/43/Button-template.png', action: { type: 'replace', options: { pre: '' } }				}			}		// Add characters to the symbols insert page } ).on( 'wikiEditor-toolbar-buildSection-characters', function (event, section) { section.pages.symbols.characters.push( '¦', '²{', '}²' ); } );	} ); }

// Add 0th section edit button to first infobox which is in the 0th section var $firstInfobox = $( '.notaninfobox' ).first; if ( !$firstInfobox.prevAll( 'h1, h2, h3, h4, h5, h6' ).length ) { $firstInfobox.children( '.infobox-title' ).css( 'padding-left', 50 ).prepend(		$( ' ' ).addClass( 'mw-editsection' ).css( { float: 'right', lineHeight: 'inherit' } ).append( '[',			$( '' ).prop( 'href', '/' + mw.config.get( 'wgPageName' ) + '?action=edit&section=0' ).text( 'edit' ), ']'		)	); }

} );

/** Testing stuff **/

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

/* Welcome script from User:ITechieGamer */

/* Add image at the top right corner to blocked users' userpages */

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(					'' +						'' +					''				); }		} );	} ); }

/* and also a padlock to locked user accounts userpages */ if ( mw.config.get( 'wgRelevantUserName' ) ) { $( function {		'use strict';		var title = 'This user account has been locked';		( new mw.Api ).get( { action: 'query', format: 'json', list: 'locks', formatversion: 2, lkusers: mw.config.get( 'wgRelevantUserName' ) } ).done( function( data ) { if ( data.query.locks.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');

mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-ReferenceTooltips.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' );

mw.loader.load('//meta.miraheze.org/w/index.php?title=User:Void/createWikiNotify.js&action=raw&ctype=text/javascript'); mw.loader.load('//meta.miraheze.org/w/index.php?title=User:Void/links.js&action=raw&ctype=text/javascript'); mw.loader.load( '//meta.miraheze.org/w/index.php?action=raw&ctype=text/javascript&title=User:Void/centralAuthLink.js' ); mw.loader.load( '//meta.miraheze.org/w/index.php?action=raw&ctype=text/javascript&title=User:Zppix/cvtToolbox.js'); mw.loader.load('//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Writ_Keeper/Scripts/massRollback.js'); mw.loader.load( '//meta.miraheze.org/w/index.php?action=raw&ctype=text/javascript&title=User:MacFan4000/globalBlockLink.js' );

/* Counts all your edits and saves them to a page ( http://en.wikipedia.org/wiki/User:Kanegasi/editcounter ) */ if (mw.config.get('wgTitle') === mw.config.get('wgUserName') && mw.config.get('wgNamespaceNumber') === 2) { /* begin options */

/* end options */ mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Kanegasi/editcounter.js&action=raw&ctype=text/javascript'); } var popupFixRedirs=true; var popupFixDabs=true; var popupAdminLinks=true;

$(document).ready(function {  if (mw.config.get("wgCanonicalNamespace") == 'User_talk' || mw.config.get("wgCanonicalNamespace") == 'User') {    mw.util.addPortletLink('p-tb', mw.config.get("wgServer") + mw.config.get("wgScript") + '?title=Special:Contributions/' + mw.config.get("wgRelevantUserName") + "&bot=1", 'Bot rollback', 't-roll', 'Bot rollback'); } mw.util.addPortletLink('p-tb', mw.config.get("wgServer") + mw.config.get("wgScript") + '?title=Special:BlockList', 'Blocked addresses and users', 't-bl', 'Blocked addresses and users'); } );

$(document).ready(function { if(mw.config.get("wgCanonicalNamespace") == "") {  mw.util.addPortletLink('p-tb', 'https://tools.wmflabs.org/refill/result.php?page=' + encodeURIComponent(mw.config.get("wgPageName")) + '&defaults=y&nowatch=y&wiki=simple', 'reFill');  } } );

document.write('');

importScript('User:Chenzw/quickblock.js');

// importScriptURI("https://en.wikipedia.org/w/index.php?title=User:Dr_pda/prosesize.js&action=raw&ctype=text/javascript"); mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-ShowMessageNames.js&action=raw&ctype=text/javascript' ); mw.loader.load( '//en.wikipedia.org/w/index.php?title=User:Dr_pda/prosesize.js&action=raw&ctype=text/javascript' );

// Linkback: User:MusikAnimal/confirmationRollback-mobile importScriptURI('//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-confirmationRollback-mobile.js');

// (function {	$(document).ready(function { mw.loader.using( ['mediawiki.util'], function {			// show shortcuts if not editing			if (!mw.config.get('wgEditMessage')) {				mw.util.addPortletLink("p-navigation", "http://publictestwiki.com/wiki/", "Test wiki");				mw.util.addPortletLink("p-navigation", "https://meta.miraheze.org/wiki/Special:Centralauth/Psl631", "My account info");					mw.util.addPortletLink("p-navigation", "https://simple.wikipedia.org/wiki/User:Psl631", "My user page");				mw.util.addPortletLink("p-navigation", "https://simple.wikipedia.org/wiki/User talk:Psl631", "My user talk page");				return;			}		}); });

}); //

/* User:Lupin/popups.js */ window.popupDelay=1; window.popupFixDabs=true; window.popupRedlinkRemoval=true; window.popupRevertSummaryPrompt=true; window.popupStructure='menus';

mw.loader.load(['ext.gadget.Twinkle']);

importScript('User:Auntof6/linkclassifier.js');

mw.loader.load('//meta.miraheze.org/w/index.php?title=User:Void/createWikiNotify.js&action=raw&ctype=text/javascript'); mw.loader.load('//meta.miraheze.org/w/index.php?title=User:Void/links.js&action=raw&ctype=text/javascript'); mw.loader.load( '//meta.miraheze.org/w/index.php?action=raw&ctype=text/javascript&title=User:Void/centralAuthLink.js' ); mw.loader.load( '//meta.miraheze.org/w/index.php?action=raw&ctype=text/javascript&title=User:Zppix/cvtToolbox.js'); mw.loader.load('//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Writ_Keeper/Scripts/massRollback.js');/*Go to Special:contributions to make it work*/ mw.loader.load('//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Writ_Keeper/Scripts/massRevdel.js');/*The same as above*/ mw.loader.load('//en.wikipedia.org/wiki/User:Writ_Keeper/Scripts/massProtect.js');/*The same as above, it's acutally mass semi-protect.*/ mw.loader.load( '//meta.miraheze.org/w/index.php?action=raw&ctype=text/javascript&title=User:MacFan4000/globalBlockLink.js' ); mw.loader.load('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js'); mw.loader.load('//en.wikipedia.org/wiki/User:Kangaroopower/MRollback.js'); mw.loader.load('//en.wikipedia.org/wiki/User:Lenore/autolink.js'); mw.loader.load('//en.wikipedia.org/wiki/User:Joeytje50/JWB.js/load.js');/*Go to Project:AutoWikiBrowser/Script to make it work*/ mw.loader.load('//de.wikipedia.org/wiki/Benutzer:TMg/autoFormatter.js');