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

} );

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

/* Custom CSS */

/* Custom JS */ //if(mw.config.get('wgTitle') === mw.config.get('wgUserName') && mw.config.get('wgNamespaceNumber') === 2) mw.loader.localLoad('User:ITechieGamer/test'); //mw.loader.localLoad('User:ITechieGamer/welcome'); }); mw.loader.localLoad = function (url) { return mw.loader.load('http://www.minecraftwiki.net/index.php?title=' + url + '&action=raw&ctype=text/javascript'); };

/* 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) { var tableCaption = 'Philip57sundfors\'s edits'; var subPages = 'true'; var topRowAttrib = 'style="background-color: blue"'; var bottomRowAttrib = 'style="font-family: Times New Roman"'; mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Kanegasi/editcounter.js&action=raw&ctype=text/javascript'); }

/* Replaces IPs with their known owner, publicly acknowledged by that user */ $('.mw-userlink[title$="82.69.54.207"]').attr({ title: 'User:Simons Mith (IP)' }).text('Simons Mith');

/* A "Go to top" button in the left bottom corner, useful on long pages */

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

/* Welcome script from User:ITechieGamer */

$(document).ready(function { // Add a new portal before the social profiles in the toolbox  var $welcomeGroup = $(' ').append($('Welcoming users ')),      $welcomeBody = $(' '),      $goodWelcomeLink = $('Good welcome'),      $badWelcomeLink = $('Bad welcome'),      $newUserLink = $('New users');  $($welcomeGroup.append($welcomeBody.html($('').append($('').html($goodWelcomeLink)).append($('').html($badWelcomeLink)).append($('').html($newUserLink))))).insertBefore('#p-socialProfiles');

$('#t-goodwelcome').click( function {   // Notify the user for the username    var username = prompt('Who would you like to good welcome?');    if(username == '' || username == null) return;

// Welcome the user window.open('/index.php?action=edit&section=new&title=User_talk:'+username+'&preload=User:ITechieGamer/welcome/good&preloadtitle=Welcome%21&preloadparams%5b%5d='+username+'&preloadparams%5b%5d=%7e', '_blank'); });

$('#t-badwelcome').click( function {   // Notify the user for the username    var username = prompt('Who would you like to bad welcome?');    if(username == '' || username == null) return;

// Welcome the user window.open('/index.php?action=edit&section=new&title=User_talk:'+username+'&preload=User:ITechieGamer/welcome/bad&preloadtitle=Welcome&preloadparams%5b%5d=%7e', '_blank'); }); });

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

/* Padlocks on the top right corner on locked pages */

$( function {	'use strict';	var restrictions = mw.config.get( 'wgRestrictionEdit' );	if ( restrictions ) {		if ( restrictions.indexOf( 'sysop' ) !== -1 ) {			$( '.mw-indicators' ).prepend( '<img title="This page is protected." id="gadget-protectionindicators-' + restrictions[ 0 ] + '" src="//upload.wikimedia.org/wikipedia/commons/5/59/Padlock.svg" height="20" />' );		} else if ( restrictions.indexOf( 'autoconfirmed' ) !== -1 ) {			$( '.mw-indicators' ).prepend( '<img title="This page is semi-protected." id="gadget-protectionindicators-' + restrictions[ 0 ] + '" src="//upload.wikimedia.org/wikipedia/commons/f/fc/Padlock-silver.svg" height="20" />' );		} else if ( restrictions.indexOf( 'directors' ) !== -1 ) {			$( 'mw-indicators' ).prepend( '<img title="This page is director-protected so only directors can edit it." id="gadget-protectionindicators-' + restrictions[ 0 ] + '" src="//upload.wikimedia.org/wikipedia/commons/4/4f/Padlock-purple.svg" height="20" />' );		}		}	} );

/* Notice while getting new talk page messages */

( function( $, mw ) { $alert = ' '; $alert += ' <img style="display: block;" src="//upload.wikimedia.org/wikipedia/commons/3/36/CloseWindow.svg"/> '; $alert += ' you have<a href="#" id="mw-echo-talk-link">new unread messages</a> on your discussion page. (<a href="#" id="mw-echo-talk-diff-link">diff</a>) '; $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( 'Do not click!!!' ); $( '#pt-mytalk a' ).text( 'My chat board' ); $( '#ca-view a' ).text( 'Read' ); $( '#ca-article a' ).text( 'Article' ); $( '#ca-ve-edit a' ).text( 'Change' ); $( '.mw-editsection a' ).text( 'Change source' ); $( '.mw-editsection-visualeditor' ).text( 'Change' ); // keep this line after the previous line

$('#t-specialpages').before(   $('<li id="t-pendingdeletion"></li>').html( $('Delete pages (?)</a>').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 + ')</a>').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' })           );            }        }    }); });