User:KnightMiner/hydra.js

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

/** Scripts **/

// mcw: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 = [ 'Revert consecutive edits by {user} ([' + '[User talk:{user}|talk]])', // to do: add summaries... ];	mw.loader.mcLoad('User:KnightMiner/editSummaryPresets.js'); }

// mcw: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.mcLoad( 'User:Majr/docTabs.js' ); }

// mcw: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.mcLoad( 'User:Majr/Prism.js' );

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

// User:Majr/codeLinks.js mw.loader.mcLoad( '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.mcLoad( 'User:Majr/renderConsoleOutput.js' ); }

/** General fixes **/

$( function { 'use strict';

// Replaces the Special:GlobalWatchlist tab with the Special:MyPage/Sandbox tab $('#pt-globalwatchlist a[href$="/Special:GlobalWatchlist"]').attr({ href: '/User:' + mw.config.get( 'wgUserName' ) + '/Sandbox' }).text('Sandbox');

// Makes one of the user links my profile, and the other the userwiki $('.netbar-right li.user li.user a').attr({ href: '/UserProfile:' + mw.config.get( 'wgUserName' ) }).text( 'Profile' );

// Add a purge tab after the move tab

if(!document.getElementById('ca-purge')) { 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 article'	); }

/** Mostly direct code from mcw: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 } ).on( 'wikiEditor-toolbar-buildSection-characters', function (event, section) { section.pages.symbols.characters.push( '¦', '²{', '}²' ); } );	} ); }

// Changes vector menu items into tabs $( '#p-cactions' ).addClass( 'emptyPortlet' ).find( '> .menu li' ).addClass( 'collapsible' ).find( 'a' ).wrap( ' ' ).end.appendTo( '#p-views > ul' );

} );