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": "" }; } // Create user page qtUserPageTemplate = ''; // AdvancedOasisUI window.AdvancedOasisUI = {RCHeader:false,lightbox:false,activity2RC:false}; // FastDelete window.fdButtons = []; window.fdButtons.push({summary:'Clean-up',label:'C'},{summary:'Veralteten Default-Import gelöscht',label:'D'}); // AjaxCommentDelete window.AjaxCommentDeleteConfig = {vocab:{linkText:"AjaxDelete"},fastDelete:"Clean-up"}; //PurgeButton PurgeButtonText = 'Purge'; //AnchoredRollback anchoredRollbackBot = true; //LastEdited window.lastEdited = { avatar: false, size: false }; importArticles({   type: 'script',    articles: [    'u:dev:MediaWiki:AdvancedOasisUI/code.js',    'u:dev:MediaWiki:FastDelete/code.js',    'u:kocka:MediaWiki:AjaxCommentDelete/code.js',    'u:dev:MediaWiki:PurgeButton/code.js',    'u:dev:MediaWiki:AutoEditDropdown/code.js',    'u:dev:MediaWiki:AjaxDiff/code.js',    'u:dev:MediaWiki:ViewRemovedAlways/code.js',    'u:dev:MediaWiki:AnchoredRollback/code.js',    'u:dev:MediaWiki:LastEdited/code.js',    'u:dev:MediaWiki:View_Source/code.js',    'u:dev:MediaWiki:Sine/code.js',    'u:dev:MediaWiki:MiniComplete/code.js',    'u:dev:MediaWiki:PortableCSSPad/code.js',    'u:dev:MediaWiki:AjaxPatrol/code.js',    'u:dev:MediaWiki:QuickToolsv2/code.js',    'u:dev:MediaWiki:AjaxBatchDelete/code.2.js',    'u:dev:MediaWiki:ChatHacks.js',    'u:dev:MediaWiki:RedirectManagement/code.js',    'u:dev:MediaWiki:Thread_Inspection/code.js',    'u:dev:MediaWiki:CacheCheck/code.js', 'u:dev:MediaWiki:WHAM/code.2.js', 'u:dev:MediaWiki:MassRenameRevert/code.js', 'u:dev:MediaWiki:SearchSuggest/code.js', 'u:dev:MediaWiki:FindAndReplace/code.js', 'u:dev:MediaWiki:SkinSwitchButton/code.js', 'u:dev:MediaWiki:ListFiles/code.js', 'u:dev:MediaWiki:FileUsageAuto-update/code.js', 'u:dev:MediaWiki:CategoryRenameAuto-update/code.js', 'u:dev:MediaWiki:ColoredColors/code.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 + ""); } }

//http://dev.wikia.com/wiki/MediaWiki:PageRenameAuto-update/code.js?oldid=37274 if (typeof PRAoptions !== "undefined"){ if (typeof PRAoptions.editSummary === "undefined"){ PRAoptions.editSummary = "Automatic link update"; } }else{ PRAoptions = { editSummary: 'Automatic link update', }; } $.getJSON("/api.php?action=query&meta=userinfo&uiprop=groups&format=json", function(result){	if (result.query.userinfo.groups.indexOf("helper") != -1){

if (typeof PRA === "undefined"){ PRA = {

started: false, updateStatus: function(gifDisplay, message){ if ($("#PRAStatus").length == 0) return false; if (typeof gifDisplay === "string"){ message = gifDisplay; }else if (typeof gifDisplay === "boolean"){ if (gifDisplay == false){ displayValue = "none"; }else{ displayValue = "inline-block"; }						document.getElementById("liveLoader").style.display = displayValue; }else{ return false; }					if (typeof message === "string"){ $("#PRAStatus").html(" " + message); }					return true; },				start: function(callback){ /* Checks if function has already started */ if (PRA.started == true){ return false; }					PRA.started = true; PRA.updateStatus(true, PRA.getMessage("process")); $("#PRAprocess").css("display", "none"); PRA.toggleInputs(false);

/* Sets variables used by the function */ PRA.oldName = decodeURIComponent($.getUrlVar('pagename').replace(/_/g, " ")).replace(/%22/g, '"').replace(/%27/g, "'"),					PRA.newName = $("#wpNewTitleMain").val;					PRA.reason = $("#wpReason").val;

PRA.pageKey = [];

/* Check if destination page name is in use */ $.getJSON("/api.php?action=query&prop=revisions&rvprop=content&titles="+encodeURIComponent(PRA.newName.replace(/ /g, "_")).replace(/"/g, "%22").replace(/'/g, "%27")+"&format=json", function(result){						if (typeof result.query.pages[-1] !== "undefined"){							$.getJSON("/api.php?action=query&list=embeddedin&eititle=" + encodeURIComponent(PRA.oldName.replace(/ /g, "_")).replace(/"/g, "%22").replace(/'/g, "%27") + "&eilimit=5000&format=json", function(result){ var transUsage = result.query.embeddedin;

$.getJSON("/api.php?action=query&bllimit=5000&list=backlinks&bltitle=" + encodeURIComponent(PRA.oldName.replace(/ /g, "_")).replace(/"/g, "%22").replace(/'/g, "%27") + "&format=json", function(result){									var pageLinks = result.query.backlinks;									var pageUsage = transUsage.concat(pageLinks);									if (console) console.log("Usage successfully retrieved");									if (pageUsage.length > 0){										PRA.queueData = [];										PRA.pageKey = [];										for (var currentPage = 0; currentPage < pageUsage.length; currentPage++){											var title = pageUsage[currentPage].title;											PRA.queueData.push(title);											/* Temporary until Wikia fixes issue with editing blog comments through the API */											if (title.search(/User blog comment/i) != -1){												var PRABlogComment = true;											}										}										/* Temporary until Wikia fixes issue with editing blog comments through the API */ if (typeof(PRABlogComment) === "undefined"){ PRA.updateStatus(false, PRA.getMessage("success")); PRA.started = false; PRA.toggleInputs(true); $("#PRAprocess").css("display", "inline-block"); PRA.updateQueueListing; }else{ PRA.started = false; PRA.updateStatus(false, PRA.getMessage("blogcomment")); PRA.toggleInputs(true); if (typeof(callback) === "function"){ callback(false, "blogcomment"); }										}

}else{ /* Else, prompt to use normal renaming, since this is kind of pointless otherwise */ PRA.started = false; PRA.updateStatus(false, PRA.getMessage("filenotused")); PRA.toggleInputs(true); if (typeof(callback) === "function"){ callback(false, "filenotused"); }									}								});							});						}else{ PRA.started = false; PRA.updateStatus(false, PRA.getMessage("destinuse")); PRA.toggleInputs(true); if (typeof(callback) === "function"){ callback(false, "destinuse"); }						}					});				},

/**************************************				// Processing-related functions **************************************/				processQueue: function{ /* Check if operation already started */ if (PRA.started == true){ return false; }

/* Variable redeclaration */ PRA.started = true; PRA.toggleInputs(false); PRA.requestCompleted = []; PRA.pageData = []; PRA.updateStatus(true, PRA.getMessage("process"));

/* Queue retrieval, returns false if no queue */

PRA.movePage(function{						PRA.processPageContent(function{ PRA.queueData = []; PRA.updateStatus(false, PRA.getMessage("success") + ": Link");							PRA.updateQueueListing;						});					});				},

processPageContent: function(callback) { /* Sets progress checking variables */ for (i = 0; i<PRA.queueData.length; i++){ PRA.requestCompleted[i] = false; }					var pageDataRetrieved = 0;

if (console) console.log("Getting page contents");

for (var j = 0; j < (Math.floor(PRA.queueData.length/500)+1); j++){ var tempArray = [];

for (var k = (j * 500); k < (j * 500) + 500; k++){ if (k == PRA.queueData.length){ break; }

tempArray.push( PRA.queueData[k] ); }					/* Calls API for page contents */ $.post(							"/api.php",							{								action: "query",								prop: "revisions",								rvprop: "content",								titles: tempArray.join("|"),								format: "json"							},							function(result){								/* Saves page contents for each page in PRA.pageData */								for (var i in result.query.pages){									var keyNum = PRA.queueData.indexOf(result.query.pages[i].title);									PRA.pageData[keyNum] = {										title: PRA.queueData[keyNum],										content: result.query.pages[i].revisions[0]["*"],										changed: false									};									pageDataRetrieved++;								}

if (pageDataRetrieved == PRA.queueData.length){ if (console) console.log("Page contents retrieved and saved");

if (console) console.log("Begin processing page content.");

/* Replacing image name on each page */ var escapedName0 = window.PRA.oldName.replace(/\*/g, "\\*").replace(/\?/g, "\\?").replace(/\./g, "\\.").replace(/( |_)/g, "[ _]*?").replace(/\(/g, "\\(").replace(/\)/g, "\\)").replace(/\+/g, "\\+"); if ( escapedName0.substr(0,1).match(/[A-z]/i) ){ var escapedName = "[" + escapedName0.substr(0,1).toUpperCase + escapedName0.substr(0,1).toLowerCase + "]" + escapedName0.substr(1); }else{ var escapedName = escapedName0; }									var pageReplacement = new RegExp("(:?|=[ ]*?|\\||\\[|\\{)" + escapedName + "(.*?\\n|[ ]*?\\||\\]|\\})", "g"); var replacementReg = new RegExp(escapedName, "g"); for (i=0; i<PRA.pageData.length; i++){ if (PRA.pageData[i].content.search(pageReplacement) != -1){ PRA.pageData[i].changed = true; if (console) console.log("\""+PRA.oldName+"\" replaced on page \""+PRA.queueData[i]+"\"");

while ((regExec = pageReplacement.exec(PRA.pageData[i].content)) != null){ PRA.pageData[i].content = PRA.pageData[i].content.replace(regExec[0], regExec[0].replace(replacementReg, PRA.newName)); pageReplacement.lastIndex += (regExec[0].replace(replacementReg, PRA.newName).length - regExec[0].length) - (regExec[2].length); }										}else{ PRA.failedLog(PRA.queueData[i].title); }									}

if (console) console.log("Begin submitting pages");

/* Adds progress bar for page submission (since this is the longest part and something entertaining needs to happen) */ $(".PRAinfo").append(" "); PRA.queueProgress = 0;

var l = 0;

var throttle = setInterval(function{										if (PRA.pageData[l].changed == true){											PRA.submitChangedPages(l, callback);										}else{											PRA.requestCompleted[l] = true;										}

l++;

if (l == PRA.pageData.length){ clearInterval(throttle); }									}, 500);								}else if (k == PRA.queueData.length && pageDataRetrieved != PRA.queueData.length){									if(console) console.log("There was a problem retrieving one or more pages. Retrieved " + PRA.pageData.length + " of " + PRA.queueData.length + " pages"); 								}							},							"json"						); }				},

submitChangedPages: function(pageKey, callback) {

$.ajax({						url: "/api.php",						type: "POST",						async: true,						data: {							action: "edit",							title: PRA.pageData[pageKey].title,							summary: PRAoptions.editSummary,							text: PRA.pageData[pageKey].content,							minor: true,							nocreate: true,							redirect: false,							bot: true,							token: mediaWiki.user.tokens.get("editToken"),							format: "json"						},						contentType: "application/x-www-form-urlencoded",						error: function{							PRA.requestCompleted[pageKey] = true;							alert("Unable to publish page \""+PRA.pageData[pageKey].title+"\". Please update links on that page manually.");

PRA.started = false;

if (typeof(callback) === "function"){ callback; }						},						success: function(result){ PRA.requestCompleted[pageKey] = true; if (console) console.log("Posted page \""+PRA.pageData[pageKey].title+"\""); $("#PRAProgressInd").css("width", ((++PRA.queueProgress) / PRA.pageData.length * 100) + "%");

if (typeof result.error !== "undefined"){ alert("The page \"" + PRA.pageData[pageKey].title + "\" could not be submitted because of error code:\"" + result.error.code + "\". Please update the link(s) on that page manually.");

PRA.failedLog(PRA.pageData[pageKey].title); }

if (PRA.requestCompleted.indexOf(false) == -1){

PRA.started = false; $("#PRAQueueProgress").remove; /* Call callback if exists */ if (typeof(callback) === "function"){ callback; }							}						}										});				},

movePage: function(callback) {

$.ajax({						url: "/api.php",						type: "POST",						async: true,						data: {							action: "move",							from: PRA.oldName,							to: PRA.newName,							reason: PRA.reason,							movetalk: false,							noredirect: true,							ignorewarnings: true,							token: mediaWiki.user.tokens.get("editToken"),							format: "json"						},						contentType: "application/x-www-form-urlencoded",						error: function{							alert("Unable to move page \"" + PRA.oldName + "\" to \"" + PRA.newName + "\".");							PRA.started = false;							PRA.toggleInputs(true);						},						success: function(result){							if (typeof result.error === "undefined"){								if (console) console.log("Moved page \"" + PRA.oldName + "\"");

/* Call callback if exists */ if (typeof(callback) === "function"){ callback; }							}else if (result.error.code == "articleexists" || result.error.code == "invalidtitle"){ var promptResponse = prompt("The page \"" + PRA.oldName + "\" was unable to be moved to \"" + PRA.newName + "\" for reason: " + result.error.code + ". \n Please enter another destination name for this file.");

if (promptResponse != null && promptResponse != ""){ PRA.newName = promptResponse; PRA.movePage(callback); }else{ alert(PRA.oldName + " was unable to be moved."); PRA.started = false; PRA.toggleInputs(true); }							}else{ alert("The page \"" + PRA.oldName + "\" was unable to be moved to \"" + PRA.newName + "\" for reason: " + result.error.code + "."); PRA.started = false; PRA.toggleInputs(true); }						}					});				},

/**************************************				// Modal-related functions **************************************/				toggleInputs: function(toggle){ if (toggle == false){ var disabled = true; }else{ var disabled = false; }					$("#wpNewTitleMain, #wpReason").attr("disabled", disabled); },				getMessage: function(message, number){ switch (message){ case "": break; case "nameinuse": return "Destination name is already queued to be used or is currently in use."; case "blogcomment": return "Page linked in blog comment. Unable to update blog comments due to API bug."; case "filenotused": return "Page not linked on any pages."; case "destinuse": return "Destination name already in use."; case "process": return "Processing..."; case "success": return "Successful."; case "varsundef": return "Variables undefined, check code."; case "queueupdate": return "Queue updated."; case "nothinginqueue": return "There is currently nothing in the queue."; case "trydiffname": return "Please enter a page name."; }				},

failedLog: function(page){ if (typeof(PRA.logFailed) === "undefined"){ PRA.logFailed = ""; }					PRA.logFailed += " " + page + " ";

if ($("#PRAFailedLog").length > 0){ document.getElementById("PRAFailedLog").innerHTML = PRA.logFailed; $("#PRAFailedLog div:odd").css("background-color", "darkred"); }				},

updateQueueListing: function{ if (typeof PRA.queueData == "undefined" || PRA.queueData.length < 1){ document.getElementById("PRAQueue").innerHTML = " " + PRA.getMessage("nothinginqueue") + " "; document.getElementById("PRAQueueLengthBox").innerHTML = "0"; return false; }

var PRACurrentQueueData = PRA.queueData; var queueToAdd = "";

for (i = 0; i" + PRACurrentQueueData[i] + " ";					}

document.getElementById("PRAQueue").innerHTML = queueToAdd; document.getElementById("PRAQueueLengthBox").innerHTML = PRA.queueData.length; $("#PRAQueue div:odd").css("background-color", "lightgrey"); }			};		}

/* Actions performed on page load to add script elements */

if (mw.config.get('wgCanonicalSpecialPageName') === 'Blankpage' && $.getUrlVar('blankspecial') === 'pageusageupdate') { var decodedOldPage = decodeURIComponent($.getUrlVar('pagename').replace(/_/g, " ")).replace(/(%22|")/g, '&quot;').replace(/(%27|')/g, "&#39;");			(function {		/* Text */		var form = ' Renaming Page:' + decodedOldPage + ' Using the form below will rename a page by changing the page names on pages that the page is used on. Be sure to check wanted categories.

Note that the page will not be moved if there is already a page at the new title. '		/* Current name */		+ ' Rename page & update usage Current name:  ' + decodedOldPage + '  ' /* Rename page */		+ ' Rename page: <td class="mw-input"><input name="wpNewTitleMain" size="79.5" value="' + decodedOldPage + '" type="text" id="wpNewTitleMain" maxlength="255"> ' /* Reason box */		+ ' <td class="mw-label">Reason: <td class="mw-input"><textarea name="wpReason" id="wpReason" cols="60" rows="2" maxlength="255"> ' /* Buttons and misc */		+ ' &#160; <td class="mw-submit">Populate list</a> Process queue</a> <img src="http://slot1.images.wikia.nocookie.net/__cb62004/common/skins/common/progress-wheel.gif" />    ' /* Queue box */        + ' <td class="mw-label">Queued items: <td class="mw-input"><div id="PRAQueue" style="overflow: scroll; width: 798px; height: 300px; float: left; border: 1px solid black; font-weight: bold; background-color: #FFFFFF;">   ' /* Counter */              + ' <td class="mw-label">&#160; <td class="mw-input PRAinfo"> Pages in queue:    ' /* Error box */			+ ' <td class="mw-label">Failed items: <td class="mw-input"><div id="PRAFailedLog" style="width: 798px; margin: 5px auto 0px auto; background-color: #ffbfbf; height: 150px; border: 1px solid black; font-weight: bold; overflow: scroll;">Failed items appear here after execution. Note that pages that the page is transcluded through a template on will also appear here falsely. ';				$('#WikiaArticle').html(form); })			document.title = 'Page Rename Auto-Update';			PRA.updateQueueListing;		}else if (wgCanonicalNamespace != "Special" && wgCanonicalNamespace != "Mediawiki" && wgCanonicalNamespace != "Category" && wgCanonicalNamespace != "Category Talk" && wgCanonicalNamespace != "User Talk" ){			/* Page */			$('#WikiaPageHeader nav ul').append( $('<li/>').append(					$('', { 'href': '/wiki/Special:BlankPage?blankspecial=pageusageupdate&pagename=' + encodeURIComponent(mw.config.get('wgPageName').replace(/ /g, "_")) + '&namespace=' + wgNamespaceNumber, 'html': 'Wiki-weit umbenennen' })				)			);		}	} });

// http://dev.wikia.com/wiki/MediaWiki:QQX/code.js $(function {    'use strict';    if ($('#ca-lang-qqx').length) {        return;    }    var elem = mw.html,        qstring = (window.location.search) ? '&' : '?',        $qqx = elem.element('li', {id: 'ca-lang-qqx'}, new elem.Raw(                elem.element('a', { href: (window.location.href).replace(/#.*/, '') + qstring + 'uselang=qqx&debug=1', title: 'QQX', }, (window.qqxText || 'QQX')))); if (mw.config.get('skin') === 'oasis') {       $(window.WikiaBar.wikiaBarWrapperObj.find('.tools')).append($qqx);    } else {        $('#p-cactions > .pBody > ul').append($qqx);    } }); // add en $(function {    'use strict';    if ($('#ca-lang-en').length) {        return;    }    var elem = mw.html,        qstring = (window.location.search) ? '&' : '?',        $spaen = elem.element('li', {id: 'ca-lang-en'}, new elem.Raw(                elem.element('a', { href: (window.location.href).replace(/#.*/, '') + qstring + 'uselang=en', title: 'EN', }, (window.spaenText || 'EN')))); if (mw.config.get('skin') === 'oasis') {       $(window.WikiaBar.wikiaBarWrapperObj.find('.tools')).append($spaen);    } else {        $('#p-cactions > .pBody > ul').append($spaen);    } });

/* http://rhythmheaven.wikia.com/wiki/MediaWiki:Wikia.js/editCount.js */ $(function {   var loc = window.location.href;    var username = (wgTitle == "Contributions") ? loc.substring(loc.lastIndexOf("/")+1) : wgTitle;    $('.tabs-container > ul.tabs').append('<li data-id="editcount">EC</a></li>'); }); $(function {   var loc = window.location.href;    var username = (wgTitle == "Contributions") ? loc.substring(loc.lastIndexOf("/")+1) : wgTitle;    $('.tabs-container > ul.tabs').append('<li data-id="lookupcontribs">LC</a></li>'); }); $(function {   var loc = window.location.href;    var username = (wgTitle == "Contributions") ? loc.substring(loc.lastIndexOf("/")+1) : wgTitle;    $('.tabs-container > ul.tabs').append('<li data-id="lookupuserrights">UR</a></li>'); }); /* RC link in global nav */ $('Letzte Änderungen</a>').appendTo('.global-navigation-container'); /* Add Tools */ $('#my-tools-menu').prepend(' Recentchangestext</a></li>'); $('#my-tools-menu').prepend(' PrefixIndex</a></li>'); $('#my-tools-menu').prepend(' SpecialPages</a></li>'); $('#my-tools-menu').prepend(' ListGroupRights</a></li>'); $('#my-tools-menu').prepend(' ListUsers</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"};	$(".message-main .WikiaMenuElement").append("<li>AjaxDelete</a></li>");	$(".message-main .WikiaMenuElement .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; /* IP lookup on contribs */ if (c.wgCanonicalSpecialPageName == "Contributions" && c.wgTitle.split('.').length == 4) { href = 'http://myip.ms/info/whois/' + page.split('/')[1],  link = ' (lookup)</a>';  $('.masthead-info').find('h2').html(link); } /* Create an edit link on Special:MovePage for easy redirecting */ if (c.wgCanonicalSpecialPageName == "Movepage") {  href = $('fieldset').find('a').attr('href') + '?action=edit',  link = ' (Bearbeiten)</a>';  $('#mw-movepage-table').find('a').first.after(link); } /* Unchecks redirects when moving */ if (c.wgCanonicalSpecialPageName == "Movepage") {  $('#wpLeaveRedirect').removeAttr('checked'); } /* Show abuse log entries in Special:Log/newusers */ if ("Special:Log/newusers".indexOf(c.wgPageName) !== -1) {  $('li.mw-logline-newusers').each(function { href = '/wiki/Special:AbuseLog?wpSearchUser=' + $(this).children('a.new.mw-userlink,a.mw-userlink').attr('href').substring(11), link = ' | abuse</a>'; $(this).children('span.mw-usertoollinks').find('a:last-child').after(link); }); } /* 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); }); } /* Automatic broken redirect delete summary */ if (c.wgAction == "delete" && $('#wpReason').val.slice(0,23) == 'content was: \"#REDIRECT' ) $('#wpReason').val('Broken redirect'); /* Revision delete */ if (c.wgAction == 'revisiondelete' || c.wgCanonicalSpecialPageName == 'Revisiondelete') {  $('#wpHidePrimary,#wpHideComment,#wpHideUser').attr('checked','checked');  $('#wpReason').val('spam'); } /* Thread history return to thread */ if (c.wgPageName.split(':')[0] == "Thread" && c.wgAction == "history")  $('.SortingBar').after('<a href="/wiki/'+page+'" style="font-size:14px">Back to thread</a>'); /* Special:WhatLinksHere on redirect page */ var h2header = $('#WikiaPageHeader').find('h2'); if (h2header && h2header.text.split('Weitergeleitet von').length == 2) {  link = ' <a href="/wiki/Special:WhatLinksHere/'+h2header.children('a').attr('title')+'">(links)</a> <a href="/wiki/'+h2header.children('a').attr('title')+'?action=history">(history)</a>'; h2header.append(link); } /* Special:SearchDigest better functionality */ if (c.wgCanonicalSpecialPageName == "SearchDigest") { $('#mw-content-text ul li').each(function {   var attrTitle = $(this).children('a').attr('title');    if (attrTitle && attrTitle.split('(page does not exist)').length == 1)      $(this).remove;  }); } /* Add history button to diffs */ if ($('strong:contains("Changes:")').length) $('#WikiaPageHeader').find('p').children('a').after(' <a href="?action=history">(history)</a>'); /* 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); /* Easily see removed messages on threads */ if ($('.removed-info.speech-bubble-message-removed').length && mw.config.get('wgCanonicalNamespace') == "Thread") { $('.removed-info.speech-bubble-message-removed').each(function { var id = $(this).parent.attr('id'); $(this).append(' (<a href="#'+id+'">see message</a>)') }); }