User:DarkBarbarian/global.js

/* Chat Hacks */ importScriptPage('User:Monchoman45/ChatHacks.js', 'c');

/* Schnelles Löschen */ window.fdButtons = []; window.fdButtons.push(   {        summary: 'Nicht mehr benötigt',        label: 'NmB'    },    {        summary: 'Kein erkennbarer Mehrwert',        label: 'KeM'    },    {        summary: 'Bereits vorhanden',        label: 'Bv'    },    {        summary: 'Spam',        label: 'S'    } );

/* WHAM */ WHAMBotMe = true; WHAMBotReason = "cleanup";

/* Begrüßung erstellen */ var qtEnableMessageWallGreetingOverwrite = true; var qtMessageWallGreetingTemplate = '';

/* Auto-Aktualisierung */ ajaxPages = ['Spezial:Letzte_Änderungen','Spezial:WikiActivity']; AjaxRCRefreshText = 'Auto-Aktualisierung'; AjaxRCRefreshHoverText = 'Automatische Aktualisierung der gesamten Seite';

/* "Neu laden"-Button */ PurgeButtonText = 'Neu laden';

/* Importierte Codes */ importArticles({   type: 'script',    articles: [        'u:dev:AdminDashboard JS-Button/code.js',        'u:dev:AjaxDiff/code.js',        'u:dev:AjaxRC/code.js',        'u:dev:AjaxPatrol/code.js',        'u:dev:AjaxRename/code.js',        'u:dev:AutoEditDropdown/code.js',        'u:dev:FastDelete/code.js',        'u:dev:GiveChatModPrompt/code.js',        'u:dev:LastEdited/code.js',        'u:dev:MessageBlocker/code.js',        'u:dev:PurgeButton/code.js',        'u:dev:QuickComments/code.js',        'u:dev:QuickCreateMessageWallGreeting/code.js',        'u:dev:QuickThreads/code.js',        'u:dev:View_Source/code.js',        'u:dev:ViewRemoved/code.js',        'u:dev:WallGreetingButton/code.js',        'u:dev:WHAM/code.2.js'    ] });

/* Lets the join chat button open in a new tab + let the /chat.css and /chat.js pages work. Taken from Monchoman */ $(setTimeout('ChatCheck', 200)); function ChatCheck { if($('.chat-join button').length != 0) { $('.chat-join button').replaceWith('Join the Chat'); } else { setTimeout('ChatCheck', 200); }   }    function OpenChatWindow { window.chatwindow = window.open('/index.php?title=Special:Chat&useskin=wikia'); window.chatwindow.onload = function { //addOnloadHook, importScript, and importStylesheet window.chatwindow.$('body').prepend(' \nfunction importScript(b){var a=wgScript+"?title="+encodeURIComponent(b.replace(/ /g,"_")).replace(/%2F/ig,"/").replace(/%3A/ig,":")+"&action=raw&ctype=text/javascript";return importScriptURI(a)}\nfunction importScriptURI(a){var b=document.createElement("script");b.setAttribute("src",a);b.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(b);return b}\nfunction importScriptPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/javascript";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importScriptURI(a)}\nfunction importStylesheet(a){return importStylesheetURI(wgScript+"?action=raw&ctype=text/css&title="+encodeURIComponent(a.replace(/ /g,"_")))}\nfunction importStylesheetURI(b,d){var a=document.createElement("link");a.type="text/css";a.rel="stylesheet";a.href=b;if(d){a.media=d}document.getElementsByTagName("head")[0].appendChild(a);return a}\nfunction importStylesheetPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/css";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importStylesheetURI(a)}\n//This isn\'t the same as the regular addOnloadHook, because the regular one runs from a script tag in the body that I don\'t feel like appending. It\'s easier to just make it $(function), which is essentially equivalent\nfunction addOnloadHook(func) {$(func);}\n ');                   //global.js                    window.chatwindow.importScriptURI('http://community.wikia.com/index.php?title=User:' + wgUserName + '/global.js&action=raw&ctype=text/javascript');                    //chat.js                    window.chatwindow.importScriptURI(wgServer + '/index.php?title=User:' + wgUserName + '/chat.js&action=raw&ctype=text/javascript');                    //global.css                    window.chatwindow.importStylesheetURI('http://community.wikia.com/index.php?title=User:' + wgUserName + '/global.css&action=raw&ctype=text/css');                    //chat.css                    window.chatwindow.importStylesheetURI(wgServer + '/index.php?title=User:' + wgUserName + '/chat.css&action=raw&ctype=text/css');            }    } // 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': 'User page',				'button-tooltip': '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 ) ); // 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': 'Benutzerseite', 'button-tooltip': 'Benutzerseite', 'buttontalk-link-text': 'Create user talk page', 'buttontalk-tooltip': 'Create your user talk page', 'cup-reason': 'Erstellen der Benutzerseite', 'cup-success-text': 'Benutzerseite erfolgreich erstellt!', 'cup-error-exists': 'Benutzerseite existiert bereits!', 'cup-error-failed': 'Benutzerseite konnte nicht erstellt werden!' }		},		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 ) );

/** * Ajax Message Wall Greeting Creation * Attempts to create your message wall greeting * Adapted from Grunny's QuickCreateUserPage tool * From http://dev.wikia.com/wiki/QuickCreateMessageWallGreeting and modified by AmonFatalis */ ( function( $, mw, window ) {	'use strict';	var QuickCreateMessageWallGreeting = {		init: function {			var $qcLink = $( ' ' ).attr( 'id', 'quick-cup' ).html( $( '' ).attr( 'title', QuickCreateMessageWallGreeting.langMsg( 'button-tooltip', true ) ) .attr( 'style', 'cursor: pointer' ).text( QuickCreateMessageWallGreeting.langMsg( 'button-link-text', true ) ) .click( QuickCreateMessageWallGreeting.createMessageWallGreeting ) );			if ( mw.config.get( 'skin' ) === 'oasis' ) {				$( '#AccountNavigation' ).find( 'li > ul.subnav' ).prepend( $qcLink );			} else {				$( '#column-one' ).find( '#p-personal > .pBody > ul' ).prepend( $qcLink );			}		},		langConfig: {			//English			en: {				'button-link-text': 'Greeting',				'button-tooltip': 'Greeting',				'buttontalk-link-text': 'Greeting',				'buttontalk-tooltip': 'Greeting',				'cup-reason': 'Creating message wall greeting',				'cup-success-text': 'Successfully created greeting!',				'cup-error-exists': 'Greeting already exists!',				'cup-error-failed': 'Creating greeting failed!'			}		},		langMsg: function ( name, userLang ) {			if ( userLang && mw.config.get( 'wgUserLanguage' ) in QuickCreateMessageWallGreeting.langConfig && name in QuickCreateMessageWallGreeting.langConfig[mw.config.get( 'wgUserLanguage' )] ) { return QuickCreateMessageWallGreeting.langConfig[mw.config.get( 'wgUserLanguage' )][name]; }			if ( !userLang && mw.config.get( 'wgContentLanguage' ) in QuickCreateMessageWallGreeting.langConfig && name in QuickCreateMessageWallGreeting.langConfig[mw.config.get( 'wgContentLanguage' )] ) { return QuickCreateMessageWallGreeting.langConfig[mw.config.get( 'wgContentLanguage' )][name]; }			return QuickCreateMessageWallGreeting.langConfig.en[name]; },		createMessageWallGreeting: function { var	MessageWallGreetingContent = window.qtMessageWallGreetingTemplate2 || '', pageName = 'Message_Wall_Greeting:' + mw.config.get( 'wgUserName' ), overwriteMessageWallGreeting = window.qtEnableMessageWallGreetingOverwrite || false; if ( overwriteMessageWallGreeting === true ) { QuickCreateMessageWallGreeting.makeEdit( pageName, MessageWallGreetingContent ); 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' ) {					QuickCreateMessageWallGreeting.showResult( 'ok', 'cup-error-exists' );				} else {					QuickCreateMessageWallGreeting.makeEdit( pageName, MessageWallGreetingContent );				}			} ); },		makeEdit: function( pageName, MessageWallGreetingContent ) { $.ajax( {				type: 'POST',				url: mw.util.wikiScript( 'api' ),				dataType: 'json',				data: {					action: 'edit',					title: pageName,					summary: QuickCreateMessageWallGreeting.langMsg( 'cup-reason', false ),					text: MessageWallGreetingContent,					format: 'json',					token: mw.user.tokens.get( 'editToken' )				}			} ).done( function ( data ) {				if ( data.edit.result === 'Success' ) {					QuickCreateMessageWallGreeting.showResult( 'ok', 'cup-success-text' );				} else {					QuickCreateMessageWallGreeting.showResult( 'error', 'cup-error-failed' );				}			} ).fail( function ( data ) {				QuickCreateMessageWallGreeting.showResult( 'error', 'cup-error-failed' );			} ); },		showResult: function( result, message ) { if ( mw.config.get( 'skin' ) === 'monobook' ) { mw.util.$content.prepend(					'  ' + QuickCreateMessageWallGreeting.langMsg( message, true ) + ' ' +					' '				); } else { var resultClass = ( result === 'error' ? 'error' : 'confirm' ); window.GlobalNotification.show( QuickCreateMessageWallGreeting.langMsg( message, true ), resultClass ); }		}	};	$( QuickCreateMessageWallGreeting.init ); }( jQuery, mediaWiki, this ) );