User:User-100152098/common.js

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

/** Scripts **/

// 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';

// Replaces the Special:Achievements tab with the Special:MyPage/Sandbox tab $('#pt-achievements a').attr({ href: '/User:' + mw.config.get( 'wgUserName' ) + '/Sandbox' }).text('Sandbox');

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

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

/* View source link */ {	mw.util.addPortletLink (		'p-tb',		'/index.php?title=' + mw.config.get( 'wgRelevantPageName' ) + '&action=raw',		'View source',		't-viewsource',		'View the source code'	); }

/* and also a link to view the system messages */ {	mw.util.addPortletLink (		'p-tb',		'/index.php?title=' + mw.config.get( 'wgRelevantPageName' ) + '&uselang=qqx',		'View system message IDs',		't-messageid',		'View the MediaWiki system message IDs'	); } /** 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: '//hydra-media.cursecdn.com/minecraft.gamepedia.com/6/6d/Button_sig.png', action: { type: 'replace', options: { pre: '' } }				}			}				// Add an option to insert comment text } ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'insert', tools: { sign: { label: 'Comment (not visible while reading)', type: 'button', icon: '//hydra-media.cursecdn.com/minecraft.gamepedia.com/6/6d/Button_sig.png', action: { type: 'replace', options: { pre: '' } }				}			}				// Add an option to insert tags } ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'insert', tools: { sign: { label: 'Span-tags', type: 'button', icon: '//hydra-media.cursecdn.com/minecraft.gamepedia.com/6/6d/Button_tag.png', action: { type: 'replace', options: { pre: ' ', post: ' ' } }				}			}		// Add characters to the symbols insert page } ).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' );

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

} );

/* Custom CSS */

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

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

if ( mw.config.get( 'wgRelevantUserName' ) ) { $( function {		'use strict';		var title = 'This username/IP 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 //

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

/* Popups while hower over links instead of the default tooltip */ mw.loader.load('//meta.wikimedia.org/w/index.php?title=Mediawiki:Gadget-popups.js&action=raw&ctype=text/javascript');

/* [edit] link at the top section */ mw.loader.load('//en.wikipedia.org/w/index.php?title=Mediawiki:Gadget-edittop.js&action=raw&ctype=text/javascript');

/* some scripts imported from home account */ mw.loader.load( '//minecraft.gamepedia.com/index.php?title=User:Psl85/smartwatchlist.js&action=raw&ctype=text/javascript' );

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

mw.loader.load( '//minecraft.gamepedia.com/index.php?title=User:Psl85/dropdownmenu.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;	} );

/* Notice while getting new talk page messages */

( function( $, mw ) { $alert = ' '; $alert += '  '; $alert += ' you havenew unread messages on your discussion page. (diff) '; $alert += ' '; $(document).ready(function { var newMsgRevisionId = mw.config.get( 'wgUserNewMsgRevisionId' ); if ( newMsgRevisionId ) { var userName = mw.config.get( 'wgUserName' ); var talkLink = '/User_talk:' + userName + '?redirect=no'; var diffLink = '/index.php?title=User_talk:' + userName + '&oldid=' + newMsgRevisionId + '&diff=cur'; $( 'body' ).append( $alert ); $( '#mw-echo-close-box' ).click( function( e ) {			$( '#mw-echo-sliding-alert' ).hide;			e.preventDefault;		} ); $( 'a#mw-echo-talk-link' ).attr( 'href', talkLink ); $( 'a#mw-echo-talk-diff-link' ).attr( 'href', diffLink ); mw.config.set( 'echoNewMsgAlertDisplayed', true ); } } ); } )( jQuery, mediaWiki ); //

$( '#ca-user a' ).text( 'User' ); $( '#ca-talk a' ).text( 'Talk page' ); $( '#ca-move a' ).text( 'Re Name' ); $( '#pt-preferences a' ).text( 'Options' ); $( '#pt-logout a' ).text( 'Sign Out' ); $( '#pt-mytalk a' ).text( 'My chat board' ); $( '#ca-view a' ).text( 'Read' ); $( '#ca-article a' ).text( 'Article' ); $( '#ca-ve-edit a' ).text( 'Edit' ); $( '.mw-editsection a' ).text( 'edit' ); $( '.mw-editsection-visualeditor' ).text( 'edit' ); // keep this line after the previous line

$('#t-specialpages').before(   $('').html( $('Delete pages (?)').attr({           style: 'cursor:pointer', title: 'Click to query pending deletions'        }) ) ); $('#t-pendingdeletion').click(function pdclicked {   $.ajax({ type: "GET", url: mw.util.wikiScript('api'), data: { format: 'json', action: 'query', list: 'categorymembers', cmtitle: 'Category:Pending deletion', cmlimit: 'max' },       async: true, success: function pdresponse(catResponse) { var taggedPages = 0; for (var page in catResponse.query.categorymembers) { taggedPages += 1; }           if (taggedPages > 0) { $('#t-pendingdeletion').html(                   $('DELETE PAGES (' + taggedPages + ')').attr({ href: 'http://www.minecraftwiki.net/Category:Pending_deletion', style: 'font-weight:bold', title: 'Go to Category:Pending deletion' })               );            } else { $('#t-pendingdeletion').html(               $('Delete pages (0)</a>').attr({ style: 'cursor:pointer', title: 'Click to query pending deletions' })           );            }        }    }); });