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

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

/* Warnings */ mw.loader.load( '//minecraft.gamepedia.com/index.php?title=User:Psl85/warnings.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 */ //

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

/*        Editing improvements         */

/* To clear summary */ $( function {	'use strict';	var lang = mw.config.get( 'wgUserLanguage' );	var title = 'Clear edit summary ';	if ( lang === 'sv' ) {		title = 'Töm sammanfattningsfältet';	}	$( '#wpSummary' ).closest( '.oo-ui-fieldLayout-body' ).find( '.oo-ui-fieldLayout-header' ).append( '<button type="button" id="gadget-clearcomment" title="' + title + '">✖ ' );	$( '#gadget-clearcomment' ).click( function { $( '#wpSummary' ).val( '' ); } ); } );

/* To make a custom edit summary dropdown */ $( function {	'use strict';	var text = 'Comments';	var title = 'View and edit user-defined edit comments';	var label = 'Enter your edit comments here (separate with newline)';	var close = 'Close';	var closetitle = 'Close the dialog window without inserting any edit comment';	var key = 'gadget-userdefinedcomments-key';	function getComments {		var commentsoutput = localStorage.getItem( key );		if ( commentsoutput ) {			commentsoutput = commentsoutput.trim;			if ( commentsoutput ) {				return commentsoutput.split( '\n' );			}		}		return [];	}	if ( mw.config.get( 'wgUserLanguage' ) === 'sv' ) {		text = 'Kommentarer';		title = 'Visa och redigera användardefinierade redigeringskommentarer';		label = 'Lägg in dina redigeringskommentarer här (separara med radbrytning)';		close = 'Stäng';		closetitle = 'Stäng dialogrutan utan att infoga någon redigeringskommentar';	}	$( '#wpSummary' ).after( '<button id="gadget-userdefinedcomments" title="' + title + '" type="button">' + text + ' ' ); $( '#gadget-userdefinedcomments' ).click( function( ev ) {		ev.preventDefault;		// Creating and opening a simple dialog window.

// Subclass Dialog class. Note that the OOjs inheritClass method extends the parent constructor's prototype and static methods and properties to the child constructor.

function MyDialog( config ) { MyDialog.super.call( this, config ); }

// Declare early for use in MyDialog.prototype methods var myDialog; var windowManager;

OO.inheritClass( MyDialog, OO.ui.Dialog );

// Specify a title statically (or, alternatively, with data passed to the opening method). MyDialog.static.name = 'gadgetuserdefinedcommentsdialog'; MyDialog.static.title = 'Simple dialog';

// Customize the initialize function: This is where to add content to the dialog body and set up event handlers. MyDialog.prototype.initialize = function { // Call the parent method MyDialog.super.prototype.initialize.call( this ); // Create and append a layout and some content. this.content = new OO.ui.PanelLayout( { padded: true, expanded: false } ); var comments = getComments; var str = ''; comments.forEach( function( comment ) {				str += '<button class="gadget-userdefinedcomments-comment">' + mw.html.escape( comment ) + ' ';			} ); str += '<label for="gadget-userdefinedcomments-textarea">' + label + ' '; str += '<textarea id="gadget-userdefinedcomments-textarea"> '; str += '<button id="gadget-userdefinedcomments-close" title="' + closetitle + '">' + close + ' '; this.content.$element.append( str ); this.$body.append( this.content.$element ); $( '.gadget-userdefinedcomments-comment' ).click( function( ev ) {				$( '#wpSummary' ).val( function( i, v ) { return v + $( ev.currentTarget ).text; } );				myDialog.close;			} ); $( '#gadget-userdefinedcomments-textarea' ).change( function( ev ) {				var commentsinput = $( ev.currentTarget ).val.trim;				if ( commentsinput ) {					localStorage.setItem( key, commentsinput );				} else {					localStorage.removeItem( key );				}			} ); $( '#gadget-userdefinedcomments-textarea' ).val( comments.join( '\n' ) ); $( '#gadget-userdefinedcomments-close' ).click( function {				myDialog.close;			} ); };

// Use the getTeardownProcess method to perform actions whenever the dialog is closed. // This method provides access to data passed into the window's close method // or the window manager's closeWindow method. MyDialog.prototype.getTeardownProcess = function ( data ) { return MyDialog.super.prototype.getTeardownProcess.call( this, data ) .first( function {				// Perform any cleanup as needed				$( '.oo-ui-windowManager' ).remove;			}, this ); };

// Make the window. myDialog = new MyDialog;

// Create and append a window manager, which will open and close the window. windowManager = new OO.ui.WindowManager; $( 'body' ).append( windowManager.$element );

// Add the window to the window manager using the addWindows method. windowManager.addWindows( [ myDialog ] );

// Open the window! windowManager.openWindow( myDialog ); } ); } );

/* To save wiki text to use later */ if ( window.Storage ) { $( function {		'use strict';		var text = 'Saved wikitext';		var tooltip = 'View and copy saved wikitext on your computer';		var selecttext = 'Select the wikitext';		var selecttitle = 'Select the wikitext for easy copying';		var settingstext = 'Settings';		var settingstitle = 'Settings for auto save';		var closetext = 'Close';		var closetitle = 'Close the dialog window';		var typeofoptions = 'Choose type of options';		var lengthbuttontext = 'Minimum length';		var lengthbuttontitle = 'Set the minimum length to be saved';		var timebuttontext = 'Time interval';		var timebuttontitle = 'Set the time interval between the saves';		var settingsdescriptionlength = 'Set the minimum length (in number of characters) to be saved';		var settingsdescriptiontime = 'Set the time interval (in number of milliseconds) between the saves';		var savetext = 'Save';		var savetitle = 'Save the input and close the dialog'; var removelocalstoragetext = 'Remove saved wikitext'; var removelocalstoragetitle = 'Remove wikitext saved on the computer'; var removesavedlengthtext = 'Reset minimum length'; var removesavedlengthtitle = 'Remove saved custom minimum length to save'; var removesavedtimetext = 'Reset time interval'; var removesavedtimetitle = 'Remove saved custom time interval between the saves'; if ( mw.config.get('wgUserLanguage') === 'sv' ) { text = 'Sparad wikitext'; tooltip = 'Visa och kopiera sparad wikitext som finns på din dator'; selecttext = 'Markera wikitexten'; selecttitle = 'Markera wikitexten för att enkelt kunna kopiera den'; settingstext = 'Inställningar'; settingstitle = 'Inställningar för autospar'; closetext = 'Stäng'; closetitle = 'Stäng dialogrutan'; typeofoptions = 'Välj typ av inställningar'; lengthbuttontext = 'Minimilängd'; lengthbuttontitle = 'Bestäm hur lång texten måste vara för att få sparas'; timebuttontext = 'Tidsintervall'; timebuttontitle = 'Bestäm tidsintervallet mellan sparningarna'; settingsdescriptionlength = 'Bestäm hur lång texten måste vara (i antal tecken) för att få sparas'; settingsdescriptiontime = 'Bestäm tidsintervallet (i antal millisekunder) mellan sparningarna'; savetext = 'Spara'; savetitle = 'Spara inställningar och stäng dialogrutan'; removelocalstoragetext = 'Ta bort sparad wikitext'; removelocalstoragetitle = 'Ta bort sparad wikitext från datorn'; removesavedlengthtext = 'Återställ minimilängd'; removesavedlengthtitle = 'Ta bort sparad anpassad minimilängd som får sparas'; removesavedtimetext = 'Återställ tidsintervall'; removesavedtimetitle = 'Ta bort sparat anpassat tidsintervall för sparningarna'; }		function getMinimumLength { if ( localStorage.getItem( 'gadget-autosave-length' ) ) { return localStorage.getItem( 'gadget-autosave-length' ); } else { return 10; }		}		function getTimeInterval { if ( localStorage.getItem( 'gadget-autosave-time' ) ) { return localStorage.getItem( 'gadget-autosave-time' ); } else { return 1000 * 60; }		}		if ( $( '#wpTextbox1' ).length ) { setInterval( function {				if ( $( '#wpTextbox1' ).val.length >= Number( getMinimumLength ) ) {					localStorage.setItem( 'svwikigadgetautosave', $( '#wpTextbox1' ).val );				}			}, Number( getTimeInterval ) ); }		mw.util.addPortletLink(			'p-tb',			'#',			text,			'gadget-autosave',			tooltip		); $( '#gadget-autosave' ).find( 'a' ).click( function( e ) {			e.preventDefault;			var dialog;			// Creating and opening a simple dialog window.

// Subclass Dialog class. Note that the OOjs inheritClass method extends the parent constructor's prototype and static methods and properties to the child constructor.

function MyDialog( config ) { MyDialog.super.call( this, config ); }			if ( $( '.oo-ui-window-active' ).length === 0 ) { OO.inheritClass( MyDialog, OO.ui.Dialog );

// Specify a title statically (or, alternatively, with data passed to the opening method). MyDialog.static.name = 'gadgetautosavedialog'; MyDialog.static.title = 'Simple dialog';

// Customize the initialize function: This is where to add content to the dialog body and set up event handlers. MyDialog.prototype.initialize = function { var str = ' '; str += '<textarea id="gadget-autosave-textarea" readonly> '; str += '<button id="gadget-autosave-select" title="' + selecttitle + '">' + selecttext + ' '; str += '<button id="gadget-autosave-settings" title="' + settingstitle + '">' + settingstext + ' '; str += '<button id="gadget-autosave-close" title="' + closetitle + '">' + closetext + ' '; str += ' '; // Call the parent method MyDialog.super.prototype.initialize.call( this ); // Create and append a layout and some content. this.content = new OO.ui.PanelLayout( { padded: true, expanded: false } ); this.content.$element.append( str ); this.$body.append( this.content.$element ); dialog = $( '#gadget-autosave-dialog' ); $( '#gadget-autosave-dialog' ).on( 'keyup', 'input', function( e ) {						if ( e.which === 13 ) {							$( '#gadget-autosave-dialog button' ).click;						}					} ); $( '#gadget-autosave-textarea' ).val( localStorage.getItem( 'svwikigadgetautosave' ) ); };

// Use the getTeardownProcess method to perform actions whenever the dialog is closed. // This method provides access to data passed into the window's close method // or the window manager's closeWindow method. MyDialog.prototype.getTeardownProcess = function ( data ) { return MyDialog.super.prototype.getTeardownProcess.call( this, data ) .first( function {						// Perform any cleanup as needed						$( '.oo-ui-windowManager' ).remove;					}, this ); };

// Make the window. var myDialog = new MyDialog;

// Create and append a window manager, which will open and close the window. var windowManager = new OO.ui.WindowManager; $( 'body' ).append( windowManager.$element );

// Add the window to the window manager using the addWindows method. windowManager.addWindows( [ myDialog ] );

// Open the window! windowManager.openWindow( myDialog ); $( '#gadget-autosave-select' ).click( function {					$( '#gadget-autosave-textarea' ).select;				} ); $( '#gadget-autosave-settings' ).click( function( e ) {					$( e.currentTarget ).closest( '.oo-ui-window-content' ).focus;					dialog.html( ' ' + typeofoptions + ' ' + '<button id="gadget-autosave-settings-length" title="' + lengthbuttontitle + '">' + lengthbuttontext + ' ' + '<button id="gadget-autosave-settings-time" title="' + timebuttontitle + '">' + timebuttontext + ' ' );					$( '#gadget-autosave-settings-length' ).click( function { dialog.html(							' ' + settingsdescriptionlength + ' ' +							' ' +							'<button id="gadget-autosave-settings-length-save" title="' + savetitle + '">' + savetext + ' ' +							'<button id="gadget-autosave-close" title="' + closetitle + '">' + closetext + ' '						); $( '#gadget-autosave-dialog input' ).attr( 'value', String( getMinimumLength ) ); $( '#gadget-autosave-dialog input' ).focus; $( '#gadget-autosave-settings-length-save' ).click( function {							var input = $( '#gadget-autosave-dialog input' ).val;							if ( /\d/.test( input ) ) {								localStorage.setItem( 'gadget-autosave-length', input );								myDialog.close;							}						} ); } );					$( '#gadget-autosave-settings-time' ).click( function { dialog.html(							' ' + settingsdescriptiontime + ' ' +							' ' +							'<button id="gadget-autosave-settings-time-save" title="' + savetitle + '">' + savetext + ' ' +							'<button id="gadget-autosave-close" title="' + closetitle + '">' + closetext + ' '						); $( '#gadget-autosave-dialog input' ).attr( 'value', String( getTimeInterval ) ); $( '#gadget-autosave-dialog input' ).focus; $( '#gadget-autosave-settings-time-save' ).click( function {							var input = $( '#gadget-autosave-dialog input' ).val;							if ( /\d/.test( input ) ) {								localStorage.setItem( 'gadget-autosave-time', input );								myDialog.close;							}						} ); } );					if ( localStorage.getItem( 'svwikigadgetautosave' ) ) {						dialog.append( '<button id="gadget-autosave-removelocalstorage" title="' + removelocalstoragetitle + '">' + removelocalstoragetext + ' ' );						$( '#gadget-autosave-removelocalstorage' ).click( function { localStorage.removeItem( 'svwikigadgetautosave' ); myDialog.close; } );					}					if ( localStorage.getItem( 'gadget-autosave-length' ) ) {						dialog.append( '<button id="gadget-autosave-removesavedlength" title="' + removesavedlengthtitle + '">' + removesavedlengthtext + ' ' );						$( '#gadget-autosave-removesavedlength' ).click( function { localStorage.removeItem( 'gadget-autosave-length' ); myDialog.close; } );					}					if ( localStorage.getItem( 'gadget-autosave-time' ) ) {						dialog.append( '<button id="gadget-autosave-removesavedtime" title="' + removesavedtimetitle + '">' + removesavedtimetext + ' ' );						$( '#gadget-autosave-removesavedtime' ).click( function { localStorage.removeItem( 'gadget-autosave-time' ); myDialog.close; } );					}					dialog.append( '<button id="gadget-autosave-close" title="' + closetitle + '">' + closetext + ' ' );				} ); dialog.on( 'click', '#gadget-autosave-close', function {					myDialog.close;				} ); }		} );	} ); }

/* RC: Hide user */ ( function {	'use strict';	var key = 'gadget-rcexcludeuser-excludedusers';	var v = mw.config.get;	var hideClass = 'gadget-rcexcludeuser-hidden';	function removeUnsafeCharacters( str ) {		var unsafeCharacters = /[\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;		return str.replace( unsafeCharacters, '' );	}	function getExcludedUsers {		var output = localStorage.getItem( key );		if ( output ) {			output = output.trim;			if ( output ) {				output = removeUnsafeCharacters( output );				return output.split( '\n' );			}		}		return [];	}	function hideExcludedUsers {		var excludedusers = getExcludedUsers;		$( '.mw-changeslist' ).children( '.special' ).children( 'li' ).each( function( i, e ) { $( e ).removeClass( hideClass ); var user = $( e ).find( '.mw-userlink' ).first.text; if ( excludedusers.includes( user ) ) { $( e ).addClass( hideClass ); }		} );	}	$( function { var buttontitle = 'Hide actions from users you trust'; var buttontext = 'Hide users'; var label = 'Exclude users (separate with newline)'; if ( v.wgUserLanguage === 'sv' ) { buttontitle = 'Dölj handlingar från användare du litar på'; buttontext = 'Dölj användare'; label = 'Exkludera användare (separera med radbrytning)'; }		if ( $( '.mw-changeslist' ).length ) { $( '#firstHeading' ).append( '<button type="button" title="' + buttontitle + '" id="gadget-rcexcludeuser-button">' + buttontext + ' ' ); $( '#gadget-rcexcludeuser-button' ).click( function {				var settingsstr = ' ';				settingsstr += ' <label for="gadget-rcexcludeuser-textarea">' + label + ' ';				settingsstr += '<textarea id="gadget-rcexcludeuser-textarea"> ';				settingsstr += ' ';

// Creating and opening a simple dialog window.

// Subclass Dialog class. Note that the OOjs inheritClass method extends the parent constructor's prototype and static methods and properties to the child constructor.

function MyDialog( config ) { MyDialog.super.call( this, config ); }				var myDialog; var windowManager; if ( $( '.oo-ui-window-active' ).length === 0 ) { OO.inheritClass( MyDialog, OO.ui.Dialog );

// Specify a title statically (or, alternatively, with data passed to the opening method). MyDialog.static.name = 'gadgetrcexcludeuserdialog'; MyDialog.static.title = 'Simple dialog';

// Customize the initialize function: This is where to add content to the dialog body and set up event handlers. MyDialog.prototype.initialize = function { // Call the parent method MyDialog.super.prototype.initialize.call( this ); // Create and append a layout and some content. this.content = new OO.ui.PanelLayout( {							padded: true,							expanded: false						} ); this.content.$element.append( settingsstr ); this.$body.append( this.content.$element ); $( '#gadget-rcexcludeuser-textarea' ).val( ( getExcludedUsers ).join( '\n' ) ); $( '#gadget-rcexcludeuser-textarea' ).on( 'input', function( e ) {							var input = $( e.currentTarget ).val.trim;							if ( input ) {								input = removeUnsafeCharacters( input );								localStorage.setItem( key, input );							} else {								localStorage.removeItem( key );							}						} ); $( '.oo-ui-windowManager' ).click( function( e ) {							if ( !$( e.target ).parents.filter( '.oo-ui-window' ).length ) {								myDialog.close;							}						} ); };

// Set up the ready mode of the window. MyDialog.prototype.getReadyProcess = function ( data ) { return MyDialog.super.prototype.getReadyProcess.call( this, data ) .next( function {							$( '#gadget-rcexcludeuser-textarea' ).focus;						}, this ); };

// Use the getTeardownProcess method to perform actions whenever the dialog is closed. // This method provides access to data passed into the window's close method // or the window manager's closeWindow method. MyDialog.prototype.getTeardownProcess = function ( data ) { return MyDialog.super.prototype.getTeardownProcess.call( this, data ) .first( function {							// Perform any cleanup as needed							$( '.oo-ui-windowManager' ).remove;							hideExcludedUsers;						}, this ); };

// Make the window. myDialog = new MyDialog( {						classes: [							'gadget-rcexcludeuser-dialog'						]					} );

// Create and append a window manager, which will open and close the window. windowManager = new OO.ui.WindowManager; $( 'body' ).append( windowManager.$element );

// Add the window to the window manager using the addWindows method. windowManager.addWindows( [ myDialog ] );

// Open the window! windowManager.openWindow( myDialog ); }			} );			hideExcludedUsers;		}	} ); mw.hook( 'wikipage.content' ).add( function( elements ) {		if ( elements.hasClass( 'mw-changeslist' ) ) {			hideExcludedUsers;		}	} ); } ); /* 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 ); //

$( function {   mw.loader.using( [ "mediawiki.util", "mediawiki.api.edit" ] ).then( function  { var link = mw.util.addPortletLink(           "p-cactions",            "#",            "Undo last edit",            "ca-undo",            "Using the API, undo the last edit made to this page."            ); link.addEventListener( "click", function {            var api = new mw.Api;            api.get( { prop: 'revisions', rvprop: 'content', rvlimit: 2, titles: mw.config.get( "wgPageName" ) } ).done( function ( data ) { if ( !data.query || !data.query.pages ) return; var pageid = Object.getOwnPropertyNames( data.query.pages )[0], text = data.query.pages[pageid].revisions[1]["*"]; api.postWithToken( "csrf", {                   action: "edit",                    title: mw.config.get( "wgPageName" ),                    summary: "Undoing last edit (undo-last-edit)",                    minor: "yes",                    text: text                } ).done ( function ( data ) {                    if ( data && data.edit && data.edit.result && data.edit.result == 'Success' ) {                        mw.notify( "Undid last edit successfully! Reloading..." );                       document.location.reload( true );                    }                } ); } );       } );    } ); } );

/** * Ajax Undo links * * Adds an Ajax undo link next to the normal undo link on page histories * and on diff pages */ jQuery(document).ready( function ( $ ) {	"use strict";	function createUndoLink( diffUndoUrl ) {		var $ajaxUndoLink = $( '<a />' ).text( 'AJAX Undo' ).attr( 'href', '#' ).click( function { var	$ajaxUndoLinkob = $( this ), undoIdRegex = /&undo=([^&]*)/, undoId = undoIdRegex.exec( diffUndoUrl )[1], editToken, etUrl = wgServer + wgScriptPath + '/api.php?action=query&prop=info|revisions&intoken=edit&titles=' + encodeURIComponent( wgPageName ) + '&format=json'; $ajaxUndoLinkob.html( ' <img src="http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif" style="vertical-align: baseline;" border="0" alt="Undoing..." />' ); $.getJSON( etUrl, function ( data ) {				editToken = data.query.pages[wgArticleId].edittoken;				$.ajax( { url: wgScriptPath + '/api.php?', data: 'action=edit&format=json&title=' + encodeURIComponent( wgPageName ) + '&undo=' + encodeURIComponent( undoId ) + '&minor=yes&token=' + encodeURIComponent( editToken ), dataType: 'json', type: 'POST', success: function ( data ) { if ( data.edit && data.edit.result === 'Success' ) { $ajaxUndoLinkob.text( '(undone)' ); } else if ( data.error && data.error.code === 'undofailure' ) { $ajaxUndoLinkob.text( '(error)' ); alert( data.error.info ); } else { $ajaxUndoLinkob.text( '(error)' ); alert( 'Error: Unknown result from API.' ); }					},					error: function { $ajaxUndoLinkob.text( '(error)' ); }				} );			} );		} );		return $ajaxUndoLink;	}	if ( $( '.mw-history-undo > a' ).length && wgAction === 'history' ) {		$( '.mw-history-undo > a' ).each( function { var	diffUndoUrl = $( this ).attr( 'href' ), $ajaxUndoLink = createUndoLink( diffUndoUrl ); $( this ).parent.after( ' | ', $ajaxUndoLink ); } );	} else if ( $( 'table.diff' ).length && typeof $.getUrlVar( 'diff' ) !== 'undefined' ) {		var	$diffUndoLink = $( 'table.diff' ).find( '.diff-ntitle > #mw-diff-ntitle1 a:last' ),			diffUndoUrl = $diffUndoLink.attr( 'href' ),			$ajaxDiffUndoLink = createUndoLink( diffUndoUrl );		$diffUndoLink.parent.append( ' (', $ajaxDiffUndoLink, ')' );	} } ); $( '#ca-user a' ).text( 'User' ); $( '#ca-history a' ).text( 'Page history' ); $( '#ca-move a' ).text( 'Rename' ); $( '#pt-preferences a' ).text( '⚙' ); $( '#ca-emailuser a' ).text( '📧' ); $( '#pt-logout a' ).text( 'Sign Out' ); $( '#pt-mytalk a' ).text( 'Discussion' ); $( '#ca-edit a' ).text( '✏' );

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