User:343TheGuiltyProphet/global.js

importScriptPage('User:The Mol Man/Annihilate.js','answers'); importScript('MediaWiki:Gadget-HotCat.js', 'answers'); mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Krinkle/RTRC.js&action=raw&ctype=text/javascript'); if ( wgNamespaceNumber !=undefined && !window.ToolbarLinksLoads ) { addOnloadHook( addToolbarLinkss ); } AjaxRCRefreshText = 'Auto-refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; var ToolbarLinksLoads = true; function addToolbarLinkss { $('Kill tool').insertAfter('ul.tools > li:first-childRTRC').insertAfter('ul.tools > li:first-child'); } // Chat hacks. Credits to Callofduty4

importScript('User:Callofduty4/ChatHacks.js', 'c');

// Move template

importScriptPage("User:Jr Mime/MarkForTemplate/General.js","mlp");

// List Admins quick link $('#my-tools-menu').prepend(' List Admins');

// Information on prefixes button importScriptPage("User:343 TheGuiltyProphet/MarkForTemplate.js","mlp");

//Wham

importScriptPage("WHAM/code.js","dev");

// Ajax undo

importScriptPage( 'AjaxUndo/code.js', 'dev' );

// Chat block button, credit to Ozuzanna importArticles( {   type: 'script',    articles: [        // ...        'u:dev:ChatBlockButton/code.js',        // ...    ] } );

// Signature button if (mwCustomEditButtons) { if (wgAction == "edit" || wgAction == "submit") { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://img4.wikia.nocookie.net/__cb20110824125615/mlp/images/a/a6/Pictogram_voting_comment.svg", "speedTip": "Signature", "tagOpen": "\{\{SUBST:w:User:343 TheGuiltyProphet/Sig\}\}", "tagClose": ""+""+"~", "sampleText": " "}; } }

// From http://dev.wikia.com/wiki/QuickCreateUserPage (modified by AmonFatalis) ( function( $, mw, window ) {	'use strict';	var QuickCreateUserPage = {		init: function {			var $qcLink = $( ' ' ).attr( 'id', 'quick-cup' ).html( $( '' ).attr( 'title', QuickCreateUserPage.langMsg( 'button-tooltip', true ) ) .attr( 'style', 'cursor: pointer' ).text( QuickCreateUserPage.langMsg( 'button-link-text', true ) ) .click( QuickCreateUserPage.createUserPage ) );			if ( mw.config.get( 'skin' ) === 'oasis' ) {				$( '#AccountNavigation' ).find( 'li > ul.subnav' ).prepend( $qcLink );			} else {				$( '#column-one' ).find( '#p-personal > .pBody > ul' ).prepend( $qcLink );			}		},		langConfig: {			//Lang			en: {				'button-link-text': 'Create user page',				'button-tooltip': 'Create user page',				'buttontalk-link-text': 'Create user talk page',				'buttontalk-tooltip': 'Create your user talk page',				'cup-reason': 'Creating user page',				'cup-success-text': 'Successfully created page!',				'cup-error-exists': 'Page already exists!',				'cup-error-failed': 'Creating page failed!'			}		},		langMsg: function ( name, userLang ) {			if ( userLang && mw.config.get( 'wgUserLanguage' ) in QuickCreateUserPage.langConfig && name in QuickCreateUserPage.langConfig[mw.config.get( 'wgUserLanguage' )] ) {				return QuickCreateUserPage.langConfig[mw.config.get( 'wgUserLanguage' )][name]; }			if ( !userLang && mw.config.get( 'wgContentLanguage' ) in QuickCreateUserPage.langConfig && name in QuickCreateUserPage.langConfig[mw.config.get( 'wgContentLanguage' )] ) { return QuickCreateUserPage.langConfig[mw.config.get( 'wgContentLanguage' )][name]; }			return QuickCreateUserPage.langConfig.en[name]; },		createUserPage: function { var userPageContent = window.qtUserPageTemplate || '', pageName = 'User:' + mw.config.get( 'wgUserName' ), overwriteUserPage = window.qtEnableUserPageOverwrite || true; if ( overwriteUserPage === true ) { QuickCreateUserPage.makeEdit( pageName, userPageContent ); return; }			$.getJSON( mw.util.wikiScript( 'api' ), {				action: 'query',				prop: 'revisions',				titles: pageName,				format: 'json'			} ).done( function ( data ) {				var	pageIds = Object.keys( data.query.pages ),					pageId = pageIds[0];				if ( pageId !== '-1' ) {					QuickCreateUserPage.showResult( 'ok', 'cup-error-exists' );				} else {					QuickCreateUserPage.makeEdit( pageName, userPageContent );				}			} ); },		makeEdit: function( pageName, pageContent ) { $.ajax( {				type: 'POST',				url: mw.util.wikiScript( 'api' ),				dataType: 'json',				data: {					action: 'edit',					title: pageName,					summary: QuickCreateUserPage.langMsg( 'cup-reason', false ),					text: pageContent,					format: 'json',					token: mw.user.tokens.get( 'editToken' )				}			} ).done( function ( data ) {				if ( data.edit.result === 'Success' ) {					QuickCreateUserPage.showResult( 'ok', 'cup-success-text' );				} else {					QuickCreateUserPage.showResult( 'error', 'cup-error-failed' );				}			} ).fail( function ( data ) {				QuickCreateUserPage.showResult( 'error', 'cup-error-failed' );			} ); },		showResult: function( result, message ) { if ( mw.config.get( 'skin' ) === 'monobook' ) { mw.util.$content.prepend(					'  ' + QuickCreateUserPage.langMsg( message, true ) + ' ' +					' '				); } else { var resultClass = ( result === 'error' ? 'error' : 'confirm' ); window.GlobalNotification.show( QuickCreateUserPage.langMsg( message, true ), resultClass ); }		}	};	$( QuickCreateUserPage.init ); }( jQuery, mediaWiki, this ) );