User:DarkBarbarian/global.js

//WHAM window.WHAMDelay = 100; window.WHAMDeleteReason = "cleanup";

//LastEdited window.lastEdited = { diffModal: false };

//FastDelete 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'    }, {        summary: 'Löschantrag',        label: 'L'    }, {        summary: 'cleanup',        label: 'C'    } );

//QuickCreateUserPage window.qtEnableUserPageOverwrite = true;

$(function {   //global.js button in account menu    $('.wds-global-navigation__user-menu .wds-list > li:first').before('global.js');    //link to my RecentChangesMultiple    $('#WikiaBar .toolbar .tools').append('RCMultiple');    //UCP?    $(".wds-global-navigation__content-bar-left").after(' ' + (mw.config.get("wgVersion") !== "1.19.24" ? "UCP" : "Legacy") + ' ');

//User avatar links to profile $('.wds-dropdown.wds-global-navigation__user-menu.wds-has-shadow.wds-global-navigation__user-logged-in .wds-avatar').wrap($('', { href: mw.util.getUrl('User:' + mw.config.get('wgUserName')) }));

//Testwikis in global nav $('.wds-dropdown.wds-global-navigation__link-group span')[0].innerHTML = 'My Test Wikis'; $('.wds-dropdown.wds-global-navigation__link-group li').remove; $('.wds-dropdown.wds-global-navigation__link-group ul').append('darkbarbarian'); $('.wds-dropdown.wds-global-navigation__link-group ul').append('barbs-secret-tests</li>'); });

$(function backToFile {   if (wgCanonicalSpecialPageName !== "Upload") return;

var link = wgScriptPath + "/wiki/File:" +  document.getElementById('wpDestFile').value; $("div#uploadtext").before("<< Zurück zur Datei</a>"); });

//link to phalanxstats for phalanxed users $(function phalanxStatsLink {	if (wgCanonicalSpecialPageName !== 'Contributions') return;	//-> https://dev.fandom.com/wiki/MediaWiki:ProfileTags.js?oldid=142816	var __init = function {       if ($('.user-identity-box').length) {            var username = $('.user-identity-header__attributes h1[itemprop="name"]').text;			$('.mw-changeslist-links > span:nth-child(1)').after(' | PhalanxStats</a> ');        } else {            setTimeout(__init, 500);        }    };    __init; });

//Imported Codes mw.loader.load('//internal-soap.fandom.com/index.php?title=User:DarkBarbarian/scripts-ucp.js&action=raw&ctype=text/javascript'); mw.loader.load('//helpers.fandom.com/index.php?title=User:DarkBarbarian/special.js&action=raw&ctype=text/javascript'); mw.loader.load('//darkbarbarian.fandom.com/index.php?title=User:DarkBarbarian/AnchoredRollback.js&action=raw&ctype=text/javascript'); mw.loader.load('//darkbarbarian.fandom.com/index.php?title=User:DarkBarbarian/ShowUserGroupsFork.js&action=raw&ctype=text/javascript'); mw.loader.load('//darkbarbarian.fandom.com/index.php?title=User:DarkBarbarian/FormatUserPageCounts.js&action=raw&ctype=text/javascript');

importArticles({   type: 'script',    articles: [    	'u:dev:MediaWiki:AjaxRename/code.js',		'u:dev:MediaWiki:AjaxUndo/code.js',		'u:dev:MediaWiki:FastDelete/code.js',		'u:dev:MediaWiki:QuickDiff/code.js',		'u:dev:MediaWiki:LastEdited/code.js',		'u:dev:MediaWiki:PortableCSSPad/code.js',		'u:dev:MediaWiki:PurgeButton/code.js',		'u:dev:MediaWiki:RecentChangesMultiple/code.2.js',		//'u:dev:MediaWiki:RevealAnonIP/code.js',		//'u:dev:MediaWiki:Standard_Edit_Summary/code.js',		'u:dev:MediaWiki:View_Source/code.js',		'u:dev:MediaWiki:Wikimarks/code.js',		//'u:dev:MediaWiki:FindAndReplace/code.js',		'u:dev:MediaWiki:ContribsLink/code.js',		//'u:dev:MediaWiki:SearchSuggest/code.js',		//'u:dev:MediaWiki:EditConflictAlert/code.js',		//'u:dev:MediaWiki:FileUsageAuto-update/code.js',		//'u:dev:MediaWiki:MultiUpload/code.js',		//'u:dev:MediaWiki:VanguardTools.js',		'u:dev:MediaWiki:QuickCreateUserPage/code.js', //'u:dev:MediaWiki:AjaxRedirect/code.js', 'u:dev:MediaWiki:PortableListUsers.js', //'u:dev:MediaWiki:Discussions Delete All/code.js', //'u:dev:MediaWiki:AnchoredRollback/code.js', //'u:dev:MediaWiki:!bang/code.js', 'u:dev:MediaWiki:InfoboxEditorPreview.js', //'u:dev:MediaWiki:PageRenameAuto-update/code.js', 'u:dev:MediaWiki:PowerDelete.js', 'u:dev:MediaWiki:DiscussionsRC.js', 'u:dev:MediaWiki:WHAM/code.2.js', 'u:dev:MediaWiki:AnalyticsShortcut.js', 'u:dev:MediaWiki:AjaxEditPreview.js', 'u:dev:MediaWiki:Discussions_Delete_All/code.js', 'u:dev:MediaWiki:Sofix.js' ] });

mw.loader.using('mediawiki.api').then(function{	if (mw.config.get('wgWikiaEnvironment') !== "sandbox") return;	if (mw.config.get('skin') === "fandomdesktop") return;	if (mw.config.get('wgCanonicalSpecialPageName') === "ThemeDesigner") return;	new mw.Api.saveOption('skin','fandomdesktop').then(function { location.reload; }); });

/****************************************** * OLD JAVASCRIPT FROM CC - TO BE CHECKED * *****************************************/

/* //Standard_Edit_Summary window.dev = window.dev || {}; window.dev.editSummaries = { css: '#stdSummaries {width: 265px;}', select: [ '(Wählen)', 'Inhalt', [ 'typo', 'Korrektur', 'Ergänzung' ],       'Vandalismus/Spam', [ 'Reverting vandalism', 'Reverting spam', 'Spam entfernt', 'Vandalismus zurückgesetzt' ],   ] };

// Custom Edit Buttons by AmonFatalis window.mwCustomEditButtons = window.mwCustomEditButtons || []; window.mwCustomEditButtons.push({   imageFile: 'https://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png',    speedTip: 'Weiterleitung',    tagOpen: '#REDIRECT [' + '[',    tagClose: ']]',    sampleText: 'R' }); window.mwCustomEditButtons.push({   imageFile: 'https://upload.wikimedia.org/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png',    speedTip: 'Anführungszeichen',    tagOpen: '„',    tagClose: '“',    sampleText: 'M' });

//FastDelete 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'    }, {        summary: 'Löschantrag',        label: 'L'    }, {        summary: 'cleanup',        label: 'C'    } ); //AjaxRC ajaxSpecialPages = ['Recentchanges','WikiActivity']; ajaxRefresh = 45000;

//WHAM WHAMDelay = 100; WHAMDeleteReason = "cleanup";

//AjaxBlock window.AjaxBlock = { expiryTimes: { '2 hours': '2 Stunden', '1 day': '1 Tag', '3 days': '3 Tage', '1 week': '1 Woche', '2 weeks': '2 Wochen', '1 month': '1 Monat', '3 months': '3 Monate', '6 months': '6 Monate', '1 year': '1 Jahr', 'never': 'Unbeschränkt' },   blockReasons: { 'Vandalismus': 'Vandalismus (DE)', 'vandalism': 'Vandalism (EN)', 'spam': 'Spam', 'Inappropriate behaviour/harassment in the Discussions': 'Discussions block', 'Unangemessenes Verhalten/Belästigung in den Diskussionen': 'Diskussions-Sperre', 'Sperrumgehung': 'Sperrumgehung' },   check: { talk: true, autoBlock: true, override: false } };

//Template classification hotkeys (additon to VanguardTools) if (mw.config.get('wgCanonicalNamespace') == 'Template' && mw.config.get('wgAction')=='view') { require(['mw', 'wikia.nirvana'], function(mw, nirvana) {    var types = {         160: 'infobox', // ^         63: 'navigation', // ?         192: 'nonarticle' // ´     };     document.addEventListener('keyup', function(event) { if (!event.altKey) return; var type = types[event.which || event.keyCode]; nirvana.sendRequest({            controller: 'TemplateClassificationApi',             method: 'classifyTemplate',             data: {                 pageId: mw.config.get('wgArticleId'),                 type: type,                 editToken: mw.user.tokens.values.editToken             },             callback: function {                 document.getElementsByClassName('template-classification-type-label')[0].innerHTML = type;                 var notification = new BannerNotification('Successfully changed template type to: ' + type, 'confirm');                 notification.show;             }         }); }); }); }

//global.js button in account menu $('.wds-global-navigation__user-menu .wds-list > li:first').before('global.js</a></li>');

//link to my RecentChangesMultiple $('#WikiaBar .toolbar .tools').append('RCMultiple</a></li>');

//User avatar links to profile $('.wds-dropdown.wds-global-navigation__user-menu.wds-has-shadow.wds-global-navigation__user-logged-in .wds-avatar').wrap($('', { href: mw.util.wikiGetlink('User:' + mw.config.get('wgUserName')) }));

//Highlight whitespace characters in diffs when they're the only thing in the change //Winner of most conspicuous missing feature for five consecutive years if (window.location.href.indexOf('diff=') !== -1) { $('.diffchange-inline').each(function {       if (!(new RegExp('\\S+').test($(this).text))) {            $(this).css('background-color', 'red');        }    }); }

//GlobalChatJS window.wgWikiaChatWindowFeatures = '';

//LastEdited window.lastEdited = { diffModal: false };

//BackToFile $(function backToFile {   if (wgCanonicalSpecialPageName !== "Upload") return;

var link = wgScriptPath + "/wiki/File:" +  document.getElementById('wpDestFile').value; $("div#uploadtext").before("<< Zurück zur Datei</a>"); });

//Back to AbuseFilter homepage $(function backToAF {   var posOfAFNumber = wgPageName.search(/\/[0-9]*$/);    if (posOfAFNumber === -1 || wgCanonicalSpecialPageName !== "AbuseFilter") return;    var localAFTitle = wgPageName.substring(0, posOfAFNumber);    var link = wgScriptPath +  "/wiki/" + localAFTitle;    $("div.page-header__subtitle").after(' < ' + localAFTitle + '</a>'); });

//Link to CC contribs $(function ccLink {	if (wgCanonicalSpecialPageName !== 'Contributions') return;

var username = $('.masthead-info h1[itemprop="name"]').text; $('#contentSub a:contains("wall"), #contentSub a:contains("talk")').after(' | CC</a>'); });

//Diff link if (window.location.pathname.indexOf('index.php') != -1 && window.location.href.indexOf('diff=') != -1) { var diffLink = window.location.href.split('index.php')[0] + "Special:Diff/" + (new URLSearchParams(window.location.href)).get("diff"); $(".page-header__subtitle").after('Special:Diff</a>'); }

//AwesomeSearch (author: PedroM) document.forms[0].addEventListener ("submit", function(event) { "use strict";  var suchText = this["query"].value;  if (suchText.indexOf(":") != -1) {    event.preventDefault;    var loc = window.location.href;    window.location = loc.substring(0, 6 + loc.lastIndexOf("/wiki/")) + encodeURI(suchText);  } });

//QuickCreateUserPage window.qtEnableUserPageOverwrite = true;

//PortableListUsers window.PortableListUsers = { time: 'local' };

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

//Threads: Show more options on hover, not on click Array.from(document.getElementsByClassName('wikia-menu-button secondary combined')).forEach(function(item) {   item.addEventListener('mouseover', function(e) { item.classList.add('active'); });   item.addEventListener('mouseout', function(e) { item.classList.remove('active'); }); });

//UCP? $(".wds-global-navigation__content-bar-left").after(' ' + (mw.config.get("wgVersion") !== "1.19.24" ? "UCP" : "Legacy") + ' ');

// Multiple Interwiki links importScriptPage('User:机智的小鱼君/interwiki.js','helpers');

//Imported Codes importScriptURI('https://internal-soap.fandom.com/index.php?title=User:DarkBarbarian/scripts.js&action=raw&ctype=text/javascript');

//Testwikis in global nav $('.wds-dropdown.wds-global-navigation__link-group span')[0].innerHTML = 'My Test Wikis'; $('.wds-dropdown.wds-global-navigation__link-group li').remove; $('.wds-dropdown.wds-global-navigation__link-group ul').append('darkbarbarian</a></li>'); $('.wds-dropdown.wds-global-navigation__link-group ul').append('ucp-darkbarbarian</a></li>'); $('.wds-dropdown.wds-global-navigation__link-group ul').append('<a href="https://barbs-secret-tests.fandom.com">barbs-secret-tests</a></li>');

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AjaxRename/code.js',        'u:dev:MediaWiki:AjaxRC/code.js',        'u:dev:MediaWiki:AjaxUndo/code.js',        'u:dev:MediaWiki:FastDelete/code.js',        'u:dev:MediaWiki:QuickDiff/code.js',        'u:dev:MediaWiki:LastEdited/code.js',        'u:dev:MediaWiki:PortableCSSPad/code.js',        'u:dev:MediaWiki:PurgeButton/code.js',        'u:dev:MediaWiki:RecentChangesMultiple/code.2.js',        'u:dev:MediaWiki:RevealAnonIP/code.js',        'u:dev:MediaWiki:Standard_Edit_Summary/code.js',        'u:dev:MediaWiki:View_Source/code.js',        'u:dev:MediaWiki:ViewRemoved/code.js',        'u:dev:MediaWiki:QuickComments/code.js',        'u:dev:MediaWiki:Wikimarks/code.js',        'u:dev:MediaWiki:FindAndReplace/code.js',        'u:dev:MediaWiki:ContribsLink/code.js',        'u:dev:MediaWiki:SearchSuggest/code.js',        'u:dev:MediaWiki:EditConflictAlert/code.js', 'u:dev:MediaWiki:AjaxPatrol/code.js', 'u:dev:MediaWiki:FileUsageAuto-update/code.js', 'u:dev:MediaWiki:MultiUpload/code.js', 'u:dev:MediaWiki:VanguardTools.js', 'u:dev:MediaWiki:AjaxBlock/code.js', 'u:dev:MediaWiki:GlobalChatJS.js', 'u:dev:MediaWiki:QuickCreateUserPage/code.js', 'u:dev:MediaWiki:LinkToDiscussionsProfileIfTheyDontHaveLivePosts/code.js', 'u:dev:MediaWiki:AjaxRedirect/code.js', 'u:dev:MediaWiki:PortableListUsers.js', 'u:dev:MediaWiki:WLHEditLinks/code.js', 'u:dev:MediaWiki:UnhideUserMasthead/code.js', 'u:dev:MediaWiki:Discussions Delete All/code.js', 'u:dev:MediaWiki:DiscussionsViewer.js', //'u:dev:MediaWiki:AnchoredRollback/code.js', 'u:dev:MediaWiki:!bang/code.js', 'u:dev:MediaWiki:InfoboxEditorPreview.js', 'u:dev:MediaWiki:FileLogs.js', 'u:dev:MediaWiki:PageRenameAuto-update/code.js', 'u:dev:MediaWiki:PowerDelete.js', 'u:community:User:AmonFatalis/ShowUserGroupsFork.js', 'u:dev:MediaWiki:WHAM/code.2.js', 'u:dev:MediaWiki:PreventTheLimbo.js', 'u:dev:MediaWiki:AnalyticsShortcut.js', 'u:darkbarbarian:User:DarkBarbarian/AnchoredRollback.js', 'u:dev:MediaWiki:DiscussionsActivity.js' ] });