User:Psl85/common.js

$(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') }; mw.loader.localLoad('User:ITechieGamer/test');

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

});

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 number is blocked';		( 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 - fast addition of categories */

mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.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' );

/* PopUps - article previews and quick links while hower overlins rather than the default "tooltip" */ mw.loader.load('//meta.wikimedia.org/w/index.php?title=Mediawiki:Gadget-popups.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');

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

/* More Watchlist tools */

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

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

/* Dropdown menus for page tools and options */ mw.loader.load( '//minecraft.gamepedia.com/index.php?title=User:Psl85/dropdownmenu.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' ); /* NightMode from the german wiki, might not work */ mw.loader.load( '//minecraft-de.gamepedia.com/index.php?title=MediaWiki:Gadget-nightmode.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(''); }

/* ======================================================== *\ \* ======================================================== */ window.iglooBranch = 'master'; mw.loader.load("//tools.wmflabs.org/igloo/code/Igloo/gloo.js"); //
 * igloo frontend manager - main
 * The igloo frontend manager handles the client system,
 * displaying information to the user, as well as allowing
 * the user to interact with the program.
 * igloo anti-vandalism tool for Wikipedia
 * based off of the script igloo by Alex Barley
 * By: User:Kangaroopower
 * For instructions, see Igloo
 * You may copy, modify and distribute this software as
 * desired, providing that all previous contributors retain
 * correct attribution.
 * tracker: Igloo
 * You may copy, modify and distribute this software as
 * desired, providing that all previous contributors retain
 * correct attribution.
 * tracker: Igloo
 * correct attribution.
 * tracker: Igloo
 * tracker: Igloo
 * tracker: Igloo

$(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') ; } // ************** // Month section // ************** function whackMonth { var d=new Date var f = document.editform ; var month=new Array(12) month[0]="January"; month[1]="February"; month[2]="March"; month[3]="April"; month[4]="May"; month[5]="June"; month[6]="July"; month[7]="August"; month[8]="September"; month[9]="October"; month[10]="November"; month[11]="December"; f.wpTextbox1.value += "\n== "+month[d.getMonth]+" "+d.getFullYear+" ==\n\n" ; f.wpSummary.value = month[d.getMonth] ; f.wpMinoredit.checked=true; f.wpWatchthis.checked=false; if (f.wpTextbox1.scrollTop || true) f.wpTextbox1.scrollTop = f.wpTextbox1.scrollHeight ; } // ** // Check for month when making an edit // ** function whackCheckMonth { var d=new Date var f = document.editform ; var month=new Array( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") ; var myregexstr = new String ('== *' + month[d.getMonth] + " " + d.getFullYear + ' *==') ; var myregex = new RegExp(myregexstr); if (myregex.test(f.wpTextbox1.value) != true) { f.wpTextbox1.value += "\n== "+month[d.getMonth]+" "+d.getFullYear+" ==\n" ; f.wpSummary.value = month[d.getMonth] ; if (f.wpTextbox1.scrollTop || true) f.wpTextbox1.scrollTop = f.wpTextbox1.scrollHeight ; } } // ************** // Warnings // ************** function whackEdit (message, msg2, summary, level) { var f = document.editform ; var tbox = document.editform.wpTextbox1 ; var a = "" + (window.getSelection ? window.getSelection                                     : document.getSelection ? document.getSelection                                                              : document.selection.createRange.text); if (msg2 != "") { a = prompt ("Article name?\n(Empty+OK for a generic message; Cancel aborts.)", a) ; if (a == null) return ; a = a.replace(/^\s+/, '') ; a = a.replace(/\.?\s*$/, ''); if (a != null && a != "") { message = message.replace(/\|/,"|"+a) ; summary += " in " + a + "" ; } else { message = msg2 ; }   }    whackCheckMonth  ; f.wpTextbox1.value += "\n\n" + message + " <br clear=\"both\" />\n" ; f.wpSummary.value = summary ; if (level > 0) { f.wpSummary.value += " /"+level+"/" ; } if (document.getElementById('wpMinoredit')) f.wpMinoredit.checked=false; f.wpWatchthis.checked=false ; f.wpTextbox1.focus; if (f.wpTextbox1.scrollTop || true) f.wpTextbox1.scrollTop = f.wpTextbox1.scrollHeight ; } function whackVandal (x) { whackEdit (" ~",   " ~","Vandalism", 0); } function whackTest   (x) { whackEdit (" ~",    " ~",      "Test edits", x); } function whackBlank  (x) { whackEdit (" ~",    " ~",   "Removing content", x); } function whackWrong  (x) { whackEdit (" ~",  " ~", "False info", x); } function whackEditWar (x) { whackEdit (" ~",  " ~",  "Edit warring", x); } function whackCopyr  (x) { whackEdit (" ~",    " ~", "Violating copyrights", x); } function whackDeleteN (x) { whackEdit (" ~",    " ~", "Deletion notice", x); } function whackGrammar (x) { whackEdit (" ~",   " ~", "Bad grammar", x); } function whackReadMos (x) { whackEdit (" ~",   " ~", "Not reading the manual of style", x); } function whackRedlink (x) { whackEdit (" ~",     " ~", "Removing useful red links", x); } function whackBlocked (x) { whackEdit ("Block length ~", "", "** BLOCKED **", x); }

// ************************************************** // Installation // ************************************************** window.whack_addlilink=function(tabs, n, url, name, id, title, key){ var ix ; var li = document.createElement('li'); if (n > 0) { li.appendChild(document.createTextNode(name)) ; for (ix = 1 ; ix <= n ; ix++) { var na = document.createElement('a'); na.href = url.replace(/XX/g, ix) ; na.appendChild(document.createTextNode(" "+ix)); li.appendChild(na); }   } else { var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); li.appendChild(na); }   if(id) li.id = id; tabs.appendChild(li); if(id) { if(key && title) ta[id] = [key, title]; else if(key)    ta[id] = [key, '']; else if(title)  ta[id] = ['', title]; }   // re-render the title and accesskeys from existing code in wikibits.js    // ?? akeytt; return li; } window.whack_addToolboxLink=function(n, url, name, id){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; whack_addlilink(tb, n, url, name, id); } window.playWhackMoles=function { if (document.title.match("Editing User talk:") || document.title.match("Creating User talk:") ) { whack_addlilink (document.getElementById('p-tb').getElementsByTagName('ul')[0],        0, "http://en.wikipedia.org/wiki/Wikipedia:Template_messages/User_talk_namespace#Multi_level_templates",         "Warning Templates:", "uTemplates") ; whack_addToolboxLink(3, 'javascript:{whackWarn(XX);};void(0);',   'Test',      'toolbox_test'); whack_addToolboxLink(1, 'javascript:{whackSelf(XX);};void(0);',   'Self Test', 'toolbox_selftest'); whack_addToolboxLink(4, 'javascript:{whackVandal(XX);};void(0);', 'Vandal',    'toolbox_vandal'); whack_addToolboxLink(4, 'javascript:{whackBlank(XX);};void(0);',  'Blank',     'toolbox_dele'); whack_addToolboxLink(3, 'javascript:{whackErrors(XX);};void(0);', 'Errors',    'toolbox_errors'); whack_addToolboxLink(4, 'javascript:{whackNPOV(XX);};void(0);',   'NPOV',      'toolbox_npov'); whack_addToolboxLink(4, 'javascript:{whackNOR(XX);};void(0);',    'O.R.',      'toolbox_nor'); whack_addToolboxLink(4, 'javascript:{whackBLP(XX);};void(0);',    'BLP',       'toolbox_blp'); whack_addToolboxLink(4, 'javascript:{whackSpam(XX);};void(0);',   'Spam',      'toolbox_spam'); whack_addToolboxLink(4, 'javascript:{whackAds(XX);};void(0);',    'Ads',       'toolbox_ads'); whack_addToolboxLink(1, 'javascript:{whackCopyvio(XX);};void(0);', 'Copyright', 'toolbox_copyvio'); whack_addToolboxLink(1, 'javascript:{whackBlatant(XX);};void(0);', 'Blatant',  'toolbox_blatant'); whack_addToolboxLink(3, 'javascript:{whackBlocked(XX);};void(0);', 'BLOCK',    'toolbox_block'); } else { whack_addToolboxLink(0, 'javascript:{whackGoogleLookup;};void(0);', 'Google', 'toolbox_googlelookup'); } } // onload window.simpleAddOnload=function(f) { if (window.addEventListener) window.addEventListener("load", f, false); else if (window.attachEvent) window.attachEvent("onload",f); } simpleAddOnload(playWhackMoles); //

/* Note if there is error with javascript on a page */ // 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;	} );

/* Add a floating JavaScript alert when my talk page gets edited */ ( 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-history a' ).text( 'Page history' ); $( '#ca-move a' ).text( 'Rename' ); $( '#pt-preferences a' ).text( 'Options' ); $( '#pt-logout a' ).text( 'Sign Out' ); $( '#pt-mytalk a' ).text( 'Discussion' );

/* Hide junk (example: ads, social features, and other things that i do not like) */ $('#p-sitePromos').remove; $('#p-socialProfiles').remove; $('#p-sharing').remove; $('.t-netbar-curseInfo').remove; $('#socialContainer').remove; $('#feedlinks').remove; $('.atfmrec').remove; $('.show-ads').remove; $('#siteNotice').remove; $('.curse-stripe').remove;

setTimeout(function{   $('.show-ads').remove;    //$('iframe').remove; },500);