User:GerritH/global.js

// Buttons if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "https://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png", "speedTip": "Weiterleitung", "tagOpen": "#REDIRECT ", "tagClose": "" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "https://upload.wikimedia.org/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png", "speedTip": "Anführungszeichen", "tagOpen": "„", "tagClose": "“" }; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png", "speedTip": "Adoption", "tagOpen": "" }; } window.AjaxCommentDeleteConfig = {vocab:{linkText:"AjaxDelete"},fastDelete:"Clean-up"};

window.AdvancedOasisUI = {RCHeader:false,lightbox:false,activity2RC:false};

anchoredRollbackBot = true;

window.lastEdited = {avatar: false,size: false};

PRAoptions = {editSummary: 'Automatic page link update'}

// check http://dev.wikia.com/wiki/Special:RecentChanges for changes importArticles({   type: 'script',    articles: [    'u:kocka:AjaxCommentDelete/code.js',    'u:dev:AdvancedOasisUI/code.js',    'u:dev:AnchoredRollback/code.js',    'u:dev:LastEdited/code.js',    'u:dev:PageRenameAuto-update/code.js',    'u:dev:AjaxDiff/code.js',    'u:dev:ViewRemoved/code.js',    'u:dev:View_Source/code.js',    'u:dev:RevealAnonIP/code.js',    'u:dev:PortableCSSPad/code.js',    'u:dev:AjaxPatrol/code.js',    'u:dev:QuickToolsv2/code.js',    'u:dev:RecentChangesMultiple/code.2.js',    'u:dev:AjaxBatchDelete/code.2.js',    'u:dev:RedirectManagement/code.js',    'u:dev:AntiSoundcloud/code.js',    'u:dev:AllPagesHideRedirect/code.js',    'u:dev:Thread_Inspection/code.js',    'u:dev:CacheCheck/code.js',    'u:dev:QuickDiff/code.js',    'u:dev:QuickDelete/code.js',    'u:dev:WHAM/code.2.js',    'u:dev:SearchSuggest/code.js',    'u:dev:FindAndReplace/code.js',    'u:dev:SkinSwitchButton/code.js', 'u:dev:BackToTopButton/code.js', 'u:dev:ListFiles/code.js', 'u:dev:FileUsageAuto-update/code.js', 'u:dev:CategoryRenameAuto-update/code.js', 'u:dev:ColoredColors/code.js', 'u:dev:GlobalChatJS.js', 'u:dev:QQX/code.js', 'u:community:Interwiki.js', 'u:community:User:AmonFatalis/stuff.js', 'u:community:User:AmonFatalis/ShowUserGroupsFork.js' ] });

importScriptURI( 'http://internal.vstf.wikia.com/index.php?title=MediaWiki:CU.js&action=raw&ctype=text/javascript' ); if (wgCanonicalSpecialPageName === 'Contributions') { importStylesheetURI('http://internal.vstf.wikia.com/index.php?title=MediaWiki:NiceButtons.css&action=raw&ctype=text/css'); var usernamej2 = $('input[name="target"]').val, usernamej = usernamej2.replace(/_/g,'+'); if(usernamej.match(/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/)) { $('#contentSub >a:first').before("" + usernamej + ""); } }

//Add links to toolbar $('Global.css' +  'Global.js' +   'Zusätzliches JS' +   'Mypage/wikia.css</a></li>' +   'Mypage/chat.js</a></li>' +   'MediaWiki:Recentchangestext?</a></li>' +   'Watchlist/raw</a></li>' +   'SpecialPages</a></li>' +   'DoubleRedirects</a></li>' +   'WikiFeatures</a></li>' +   'MediaWiki:ImportJS</a></li>' +   'JSPages</a></li>' + '<li><a href="/wiki/Special:CheckUserLog">CheckUserLog</a></li>' + '<li><a href="/wiki/Special:Log/chatconnect">Log/chatconnect</a></li>' + '<li><a href="/wiki/Special:AllPages">AllPages</a></li>' + '<li><a href="/wiki/Special:PrefixIndex">PrefixIndex</a></li>' + '<li><a href="/wiki/Special:UnusedFiles">UnusedFiles</a></li>' + '<li><a href="/wiki/Special:ListGroupRights">ListGroupRights</a></li>' + '<li><a href="/wiki/Special:ListUsers">ListUsers</a></li>' + '<li><a href="/wiki/Special:ListAdmins">ListAdmins</a></li>')   .insertBefore('.WikiaBarWrapper .tools-menu li:first'); $(function { if( skin == 'oasis' ) { // Add RC link in global nav $('.WikiaSiteWrapper').append('<a href="/wiki/Special:RecentChanges"> RecentChanges </a>'); $('<li style="position: absolute; right: -85px; top: 3px; border:none;"><a style="background-color: #00647a; color: #fff; font-weight: bold; font-size: 13px; padding: 1px 4px; border-radius: 4px" href="/wiki/Special:CSS">CSS</a></li>').appendTo('#WikiaBarWrapper .toolbar > .tools'); $('<li style="position: absolute; right: -125px; top: 3px; border:none;"><a style="background-color: #007a64; color: #fff; font-weight: bold; font-size: 13px; padding: 1px 4px; border-radius: 4px" href="/wiki/MediaWiki:Wiki-navigation?action=edit">Nav</a></li>').appendTo('#WikiaBarWrapper .toolbar > .tools'); } });

/* AjaxFastDelete by Grunny, original FastDelete was written by Splarka, and later modified by uberfuzzy and Grunny. Update by KockaAdmiralac */ window.fdButtons = []; window.fdButtons.push({summary:'Clean-up',label:'C'},{summary:'Veralteten Default-Import gelöscht',label:'D'},{summary:'Löschantrag',label:'LA'}); (function($) {   "use strict";    if (typeof window.wkAjaxFastDelete !== 'undefined') {        return false;    }    window.wkAjaxFastDelete = {        version: '2.2',        init: function {            if (wgNamespaceNumber === -1 || !window.fdButtons) {                return;            }            var deleteButtons = '';            switch (skin) {                case 'uncyclopedia':                case 'wowwiki':                case 'monobook':                    if (!$('#ca-delete').length) {                        return;                    }                    deleteButtons = fdButtons.map(function(b) { var sum = b.summary; return '<li><a style="cursor: pointer;" title="Ajax delete: ' + sum + '" data-summary="' + sum + '" data-id="fastdelete">' + b.label + '</a></li>'; }).join('');                   $('#p-cactions > .pBody > ul').append(deleteButtons);                    break;

case 'oasis': case 'wikia': if(!$('.wds-list #ca-delete').length) { return; }                   deleteButtons = fdButtons.map(function(b) {                        var sum = b.summary;                        return '<a class="wds-is-squished wds-button" title="one-click delete: ' + sum + '" data-summary="' + sum + '" data-id="fastdelete">' + b.label + '</a>';                    }).join(' '); if($('.UserProfileActionButton').exists) { $('.UserProfileActionButton').append(deleteButtons); } else { $('.page-header__contribution-buttons').prepend(deleteButtons); }                   break; }           if($('a[data-id="fastdelete"]').length) { $('a[data-id="fastdelete"]').click(function {                   wkAjaxFastDelete.ajaxDeleteAPage($(this).attr('data-summary'));                }); }       },        ajaxDeleteAPage: function(deleteReason) { var url = wgServer + wgScriptPath + '/api.php?action=query&prop=info&intoken=delete&titles=' + encodeURIComponent(wgPageName) + '&format=json'; $.getJSON(url, function(data) {               var editToken = data.query.pages[wgArticleId].deletetoken,                    url = wgServer + wgScriptPath + '/api.php?action=delete&title=' + encodeURIComponent(wgPageName) + '&reason=' + encodeURIComponent( deleteReason) + '&format=json&token=' + encodeURIComponent(editToken);                $.post( url, function { document.location.reload; });           });        }    };    $(document).ready(wkAjaxFastDelete.init); }(jQuery));

/* Creates an actual "Purge" button, based on http://dev.wikia.com/wiki/MediaWiki:PurgeButton/code.js?oldid=56312 */ (function ($, mw) {   'use strict';    var nsNr = mw.config.get('wgNamespaceNumber');    if (nsNr < 0 || window.PurgeButtonsLoaded || document.getElementById('control_purge')) {        return;    }    window.PurgeButtonsLoaded = true;    $(addPurgeButton);    function purgePage  {        var page = encodeURIComponent(mw.config.get('wgPageName'));        $.get( '/index.php?title=' + page + '&action=purge', function  { location.reload(true); } );       $('html,body').css({ display: 'block', overflow: 'hidden' });       $('<div style="background: url(\'/skins/common/images/ajax.gif\') no-repeat fixed center center #efefef;height: 100%;left: 0;opacity: 0.25;position: absolute;top: 0;width: 100%;z-index: 1000000000;"> ').appendTo(document.body)        .css('height', $(window).height);    }    function addOasisPurgeButton  {        switch (nsNr) {            case 3:                $('.UserProfileActionButton .wikia-menu-button ul').append( '<li><a class="custom-purge-button" href="javascript:void(0)" title="Purge page"></a></li>' );               break;            default:                $('.page-header__contribution-buttons').append( '<a class="custom-purge-button wds-button wds-is-squished wds-is-secondary" href="javascript:void(0)" title="Purge page"></a>' );       }    }    function addPurgeButton  {        switch(mw.config.get('skin')) {            case 'monobook':                $('#p-cactions > .pBody > ul').append('<li id="ca-purge"><a class="custom-purge-button" href="javascript:void(0)" title="Purge page"></a></li>');                break;            case 'oasis':            case 'wikia':                addOasisPurgeButton;                break;        }        $('.custom-purge-button').text('Purge').click(purgePage);    }    } (jQuery, mediaWiki)); /* Bypass Special:InfoboxBuilder by Nanaki*/ if ($('.template-classification-type-text').data('type') == 'infobox') $('#ca-edit').attr('href', function(a) {   return this.href + '&useeditor=source'; }); if (window.location.pathname.indexOf('InfoboxBuilder') != -1) { var lname = window.location.pathname.split('InfoboxBuilder/')[1]; location.replace(document.URL.replace(window.location.href.split('/wiki/')[1],'Template:' + lname + '?action=edit&useeditor=source')); }

// based on script by Gguigui1 $(function { var page = mw.config.get('wgPageName'); var specialpage = mw.config.get('wgCanonicalSpecialPageName'); var name = page.split('/')[1]; var name2 = (wgTitle == "Contributions") ? window.location.href.substring(window.location.href.lastIndexOf("/")+1) : wgTitle; if (specialpage === "Contributions" && page.split('.').length != 4) {   $('.tabs-container > ul.tabs').append('<li data-id="lookupuserrights"><a href="/wiki/Special:UserRights/' + name + '" title="Special:UserRights">Rechte</a></li><li data-id="cuchatlog"><a href="/wiki/Special:Log?type=chatconnect&user=' + name + '" title="Special:Log?type=chatconnect">ChatConnect</a></li><li data-id="lookupcontribs"><a href="http://community.wikia.com/wiki/Special:LookupContribs?target=' + name + '" title="Special:LookupContribs">Globale Beiträge</a></li><li data-id="editcount"><a href="/wiki/Special:Editcount/' + name + '" title="Special:Editcount">Beitragszähler</a></li>'); } else { $('.tabs-container > ul.tabs').append('<li data-id="lookupuserrights"><a href="/wiki/Special:UserRights/' + name2 + '" title="Special:UserRights">Rechte</a></li><li data-id="cuchatlog"><a href="/wiki/Special:Log?type=chatconnect&user=' + name2 + '" title="Special:Log?type=chatconnect">ChatConnect</a></li><li data-id="lookupcontribs"><a href="http://community.wikia.com/wiki/Special:LookupContribs?target=' + name2 + '" title="Special:LookupContribs">Globale Beiträge</a></li><li data-id="editcount"><a href="/wiki/Special:Editcount/' + name2 + '" title="Special:Editcount">Beitragszähler</a></li>'); } });

// Based on http://kocka.wikia.com/wiki/MediaWiki:AjaxThreadDelete/code.js?oldid=446 by User:KockaAdmiralac $(function { if(wgNamespaceNumber !== wgNamespaceIds.thread && wgNamespaceNumber !== wgNamespaceIds.board_thread && wgNamespaceNumber !== wgNamespaceIds.message_wall) return;	var api = new mw.Api,	config = window.AjaxThreadDeleteConfig || {fastDelete: "true"};	$("<a style='font-size: 11px; line-height: 8px; margin-left: 2px' href='#' class='AjaxThreadDeleteButton'>AjaxDelete</a>").insertAfter("a.permalink");	$(".AjaxThreadDeleteButton").click(function(e) {		var superParent = $(e.currentTarget).closest(".SpeechBubble"); function deleteThread {			api.post({				action: 'delete',				pageid: superParent.data.id,				reason: ("Schnelllöschung"),				bot: true,				token: mw.user.tokens.get('editToken')			}).done(function(d)			{				if(!d.error) $("[data-id=" + superParent.data.id + "]").slideToggle;				else new BannerNotification(("Fail") + ": " + d.error.code, 'error').show;			}).fail(function(d) { new BannerNotification(("Fail"), 'error').show; }); }    if(config.fastDelete) deleteThread; }); }); (function($, mw) { var c = mw.config.get([ 'wgPageName', 'wgCanonicalSpecialPageName', 'wgTitle', 'wgAction', 'wgCanonicalNamespace', 'wgNamespaceNumber', 'wgUserGroups', 'wgSiteName', 'skin' ]), escapedPage = encodeURIComponent(c.wgPageName), href, link; /* Create an edit link on Special:MovePage for easy redirecting */ if (c.wgCanonicalSpecialPageName == "Movepage") { href = $('fieldset').find('a').attr('href') + '?action=edit',  link = ' <a href="'+href+'">(Bearbeiten)</a>';  $('#mw-movepage-table').find('a').first.after(link); } /* Unchecks redirects when moving */ if (c.wgCanonicalSpecialPageName == "Movepage") {  $('#wpLeaveRedirect').removeAttr('checked'); } /* Create move link on Special:ListFiles for users' files listed */ if (c.wgCanonicalSpecialPageName == "Listfiles" && c.wgPageName.split('/').length === 2) {  $('.TablePager_col_img_name').each(function { link = ' (<a href="/wiki/Special:MovePage/File:' + $(this).find('a').first.text + '">move</a>)'; $(this).append(link); }); } /* Always go to IP contributions, not userpage */ if (c.wgNamespaceNumber == 2 && title.split('.').length == 4) location.replace("/wiki/Special:Contributions/"+mw.config.get('wgPageName').split(':')[1]); }) (this.jQuery, this.mediaWiki);