User:BabylonAS/common.js

/* Most of that is from user:KnightMiner/hydra.js */

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

/** Scripts **/

// User:KnightMiner/editSummaryPresets.js // Creates a dropdown menu on edit summaries with presets if (mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit') { var customSummaries = [ 'Reverted edits by ['+'[Special:Contributions/{user}|{user}]] ([' + '[User talk:{user}|talk]]) ', 'to last revision by [' + '[User:{user}|{user}]]', '== 0: Style guide', '[' + '[MCW:Style guide#Writing|Tutorial information in non-tutorial article]]', '[' + '[MCW:Style guide#Writing|Mod info in vanilla article]]', '[' + '[MCW:Style guide#Keeping articles concise and up to date|Outdated information]]', '[' + '[MCW:Style guide#Future|Content not in a development version]]', '[' + '[MCW:Style guide#Grammar|This wiki uses American English]]', '[' + '[MCW:Style guide#Capitalization|Improper capitalization]]', '[' + '[MCW:Style guide#Images|Improper image]]', '[' + '[MCW:Style guide#Linking|Overlinking]]', '[' + '[MCW:Style guide/Features#Trivia|Bad trivia]]', '== Wiki rules', '[' + '[MCW:Wiki rules#1|Rule #1]]: Violates Minecraft ToU/brand guidelines', '[' + '[MCW:Wiki rules#2|Rule #2]]: Spam', '[' + '[MCW:Wiki rules#2|Rule #2]]: Vandalism', '[' + '[MCW:Wiki rules#3|Rule #3]]: Harassment/insult/[' + '[wikipedia:ad hominem|ad hominem]]', '[' + '[MCW:Wiki rules#4|Rule #4]]: False info/speculation/hoax', '[' + '[MCW:Wiki rules#5|Rule #5]]: Advertising', '[' + '[MCW:Wiki rules#6|Rule #6]]: Fan community', '[' + '[MCW:Wiki rules#7|Rule #7]]: [' + '[wikipedia:Plagiarism|Plagiarism]]', '[' + '[MCW:Wiki rules#8|Rule #8]]: Violates the [' + '[MCW:Wiki rules/Video policy|video policy]]', '== 4:Talk page guidelines: Talk page guidelines', '[' + '[MCW:Talk page guidelines#General|Improper talk page usage]]', '[' + "[MCW:Talk page guidelines#General|Don’t edit other user’s comments]]", '[' + "[MCW:Talk page guidelines#General|Don’t edit archives]]", '== MAIN: Projects', '[' + '[MCW:Projects/Rewrite for Style|Rewrite for Style]]', '[' + '[MCW:Projects/Rewrite for Style|Rewrite for Style]] – part ', '[' + '[MCW:Projects/Categorization|Categorize]]', '[' + '[MCW:Projects/Categorization|Change category]]', '== Forums', '[' + '[forum:minecraft-discussion|Go to the forums]]', '[' + '[forum:minecraft-discussion/suggestions|Go to the suggestion forums]]', '[' + '[forum:mapping-and-modding/minecraft-mods|Go to the mod forums]]', '[' + '[forum:support|Go to the support forums]]', ];	mw.loader.localLoad('User:KnightMiner/editSummaryPresets.js'); }

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

// 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/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 purge tab after the move tab mw.util.addPortletLink (	'p-cactions',	'/index.php?title=' + mw.config.get( 'wgRelevantPageName' ) + '&action=purge',	'Purge',	'ca-purge',	'Purge the page' );

// 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 page'	); }

/** 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"]' ), action = $button.data( 'action' ); action.options.pre = '— ' + ''; $button.data( 'action', action );

// Add an option to insert ' } }				}			}		} );		// Add an option to insert Template:AutoUnsigned		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'insert', tools: { // Template:AutoUnsigned sign: { label: 'Autosign previous comment', type: 'button', icon: '//hydra-media.cursecdn.com/minecraft.gamepedia.com/6/6d/Button_sig.png', action: { type: 'encapsulate', options: { pre: '' } }				}			}		} );	} );	// Prototype of Wikificator adapted to English Minecraft Wiki mw.loader.localLoad("User:NickTheRed37/Scripts/Wikificator.js"); }

} );