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( '¦', '²{', '}²' ); } );	} ); }

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

} );

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

/* Auto-sign posts */

mw.loader.load( '//meta.wikimedia.org/w/index.php?title=user:perhelion/signing.js&action=raw&ctype=text/javascript' );

mw.loader.load('//terraria.gamepedia.com/index.php?title=MediaWiki:Gadget-PastBlocks.js&action=raw&ctype=text/javascript');

/* IP info */ mw.loader.load('//terraria.gamepedia.com/index.php?title=MediaWiki:Gadget-ipInfo.js&action=raw&ctype=text/javascript');

/* Drop down menus to choose edit summary */ mw.loader.load( '//minecraft.gamepedia.com/index.php?title=User:Psl85/editsummaries.js&action=raw&ctype=text/javascript' );

// User:Ais523/votesymbols.js // Code for adding icons to !votes in AfDs, RfAs, etc.. Doesn't affect the page, just // shows the icons when this code is installed. // Please see Image:Votesymbols.js-enhanced_SfD.png for copyright info on the images that are added.

function lowerNoPunct(s) { return s.toLowerCase.split('.').join().split(',').join().split(':').join().split(';').join().split('+').join(''); }

$(function { if(mw.config.get('wgNamespaceNumber')===0) return; //avoid article space, generally speaking  var vs=  "//upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/15px-Symbol_support_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Symbol_keep_vote.svg/15px-Symbol_keep_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Symbol_oppose_vote.svg/15px-Symbol_oppose_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_delete_vote.svg/15px-Symbol_delete_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_neutral_vote.svg/15px-Symbol_neutral_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Symbol_merge_vote.svg/15px-Symbol_merge_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/5/50/Symbol_move_vote.svg/15px-Symbol_move_vote.svg.png#"+  "//upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Symbol_redirect_vote.svg/15px-Symbol_redirect_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Symbol_opinion_vote.svg/15px-Symbol_opinion_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_comment_vote.svg/15px-Symbol_comment_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Symbol_unsupport_vote.svg/15px-Symbol_unsupport_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_question.svg/15px-Symbol_question.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Symbol_divide_vote.svg/15px-Symbol_divide_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/5/54/Symbol_wait.svg/15px-Symbol_wait.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Face-grin.svg/15px-Face-grin.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Symbol_support2_vote.svg/15px-Symbol_support2_vote.svg.png#"+ "//upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Symbol_no_support_vote.svg/15px-Symbol_no_support_vote.svg.png"; var vt=vs.split("#"); var la=[]; la['support']=0; la['endorse']=0; la['keep']=1; la['allow']=1; la['permit']=1 la['oppose']=2; la['overturn']=2; la['object']=2; la['disallow']=2 la['delete']=3; la['neutral']=4; la['merge']=5; la['upmerge']=5; la['move']=6; la['rename']=6; la['userfy']=6; la['transwiki']=6; la['listify']=6; la['convert']=15 la['redirect']=7; la['retarget']=7; la['opinion']=8; la['relist']=8; la['subst']=8; la['salt']=8; la['change']=8; la['list']=8; // Note that icon 8 on the list is often used for debate-specific !votes la['comment']=9; la['update']=9; la['note']=9; la['delist']=10; la['question']=11; la['split']=12; la['disambiguate']=12; la['set index']=12; la['SIA']=12; la['dab']=12; la['dabify']=12; la['wait']=13; la['bjaodn']=14; la['undelete']=15; la['restore']=15 la['close']=16;

var btc=document.body.getElementsByTagName("B"); i=btc.length; while(i--) {   var j,k; j=btc[i].innerHTML.split("<").join(" ").split(">").join(" ").split("/").join(" ").split(" "); k=0; var x=""; while(k ' }     k++; }   if(x!=="") btc[i].innerHTML=x+btc[i].innerHTML; } }); //

/* Put some functions in the toolbox for the anti-vandal whack-a-mole game. Documented at http://en.wikipedia.org/wiki/User:Kbh3rd/Vandal_warning_toolbox */ //  // **************** //  Google Lookup // **************** function whackGoogleLookup { var q = "" + (window.getSelection ? window.getSelection                                     : document.getSelection ? document.getSelection                                                              : document.selection.createRange.text); if (!q) q = prompt("You didn't select any text. Enter a search phrase:", ""); if (q!=null) // location="http://www.google.com/search?q=" + escape(q).replace(/ /g, "+"); window.open("http://www.google.com/search?q=" + escape(q).replace(/ /g, "+") ,'new-tab') ; } /* 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-nstab-main a' ).text( 'Article' ); $( '#ca-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' })           );            }        }    }); });