User:Withersoul 235/global.js

// // Notes to self /* For wiki-specific codes in Global JS page, use one of following codes:

if (mw.config.get("wgServer") === "https:// .wikia.com") { // code };

if (mw.config.get("wgDBname") === "lyricwiki") { //we use lyricwiki as example //code. You can find your wiki's DB name by opening the developer console (Ctrl-Shift-J), navigating to the Elements tab and checking the last few lines of the element, after "wiki-". }

Apparantly you can add multiple rail modules using AddRailModule like this:

window.ARMModules = ['Template:RailModule', 'Template:RailModule2'];

Do noot forgetti */

//============================ // Responsive Mobile //============================

$('head').append('');

//========================================= // Show all deleted comments by default //=========================================

$("[class*='ViewFilter'] input:checked").click;

//================================================================== // Makes the Tab key in the editor actually behave like a Tab key //==================================================================

if (({ edit: 1, editredlink: 1, submit: 1 })[mediaWiki.config.get('wgAction')] === 1) { // Edit pages only jQuery(function ($) {           'use strict';            var $box;            // CKE Source mode            if (mw.config.get('skin') === 'oasis') {$box = $('textarea.cke_source')}            // Monobook Editing / Oasis Raw Source mode            if (!$box || !$box.length) {$box = $('#wpTextbox1')}            $box.keydown(function (e) { if (e.keyCode === 9) { // Get caret position/selection var start = this.selectionStart, end  = this.selectionEnd, value = jQuery(this).val; // Text before caret + tab + text after caret jQuery(this).val(                       value.substring(0, start) + "\t" +                         value.substring(end)                    ); // Put caret at right position again (add one for the tab) this.selectionStart = this.selectionEnd = start + 1; // Prevent the focus lose e.preventDefault; }})}); }

//=============================== // Script configurations //===============================

$.extend(true, window, {   /** AJAX Auto-Refresh **/     ajaxPages: new Array( "Special:WikiActivity", "Special:WikiActivity/watchlist", "Special:RecentChanges", "Special:RecentChangesLinked", "Special:Log", "Special:Images", "Special:ListFiles", "Special:Contributions", "Special:NewPages", "Special:UncategorizedPages", "Special:DoubleRedirects", "Special:WhatLinksHere", "Special:Categories", "Special:Videos", "Special:Watchlist", "Special:LonelyPages", "Special:BrokenRedirects", "Special:DeadendPages", "Special:Disambiguation", "Special:Withoutimages", "Blog:Recent_posts" ),   ajaxRefresh: 30000,    AjaxRCRefreshText: 'Auto-refresh',    AjaxRCRefreshHoverText: 'Automatically refresh the page over time',    ajaxIndicator: 'https://vignette.wikia.nocookie.net/deathbattlefanon/images/d/de/Ajax-loader.gif/revision/latest?cb=20200828094018',    /** LastEdited **/    timezone: "local",    /** PageCreator **/    useAvatar: true,    useTimestamp: true,    /** Rollback **/    Rollback: {confirm: true},    /** DiscordIntegrator **/    DiscordIntegratorConfig: {siderail: {theme: "dark"}},    /** InactiveUsers **/    InactiveUsers: {months: 3},    /** SeeMoreActivityButton **/    SeeMoreActivityButtonRC: false,    /** HighlightUsers (outdated) **/    highlight: {selectAll: true},    /** UserTags **/    /**UserTagsJS: {        modules: {            stopblocked: false,            isblocked: true,    }},**/    /** WHAM **/    WHAMDelay:         2125,    WHAMBotMe:         true, WHAMBlockDuration: "infinite", /** ShowHide **/ ShowHideDisplayWarning: false, /** SnowStorm **/ excludeMobile: true, useTwinkleEffect: true, useMeltEffect: false, usePositionFixed: true, freezeOnBlur: false, // Stop snowflakes from going Speedy Gonzales /** WallGreetingButton **/ WallGreetingButtonProtect: true, WallGreetingButtonRaw: true, /** YouTubePlayer **/ YoutubePlayerDisableAutoplay: true, /** WikiActivity **/ rwaOptions: { autoInit: true, limit: 100, refresh: true, headerLink: true },   /** DisableVisualEditor **/ configDisableVisualEditor: { "action": "edit", "disable": "visual" },   /** AnnouncementsIgnore **/ announcementsIgnore: { option: 'opt-in-all', exceptWikiIds: new Array(586137, 1479632) } });

if (window.PurgeButtonText == "Purge") {window.PurgeButtonText = "Refresh"}

/** ViewDeleted **/

var ViewDeleted = { noPrompt: true, rc: true, logs: true, modal: { preview: {width: 800}, content: {width: 700} } };

//================ // Script Imports //================

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:AddNukeLink.js',        'u:dev:MediaWiki:AjaxRC.js',        'u:dev:MediaWiki:AjaxUndo/code.js',        'u:dev:MediaWiki:AnnouncementsIgnore.js',        'u:dev:MediaWiki:AntiSoundcloud/code.js',        'u:dev:MediaWiki:CodeQuickLinks/code.js',         'u:dev:MediaWiki:ChainQuotes.js',        //'u:dev:MediaWiki:ChromeToolbarColor.js', (Causes bug?)        'u:dev:MediaWiki:CommentsToggle.js',        'u:dev:MediaWiki:CodeEditor.js',        //'u:dev:MediaWiki:DedicatedTalkButton.js',        'u:dev:MediaWiki:DisableVisualEditor.js',        //'u:dev:MediaWiki:EditBio/code.js',        'u:dev:MediaWiki:EditProfilesButton/code.js',        'u:dev:MediaWiki:EnableDisabledCancelButton.js',        'u:dev:MediaWiki:FavoriteWikisPersistTab/code.js',        'u:dev:MediaWiki:FirstEditDate.js',        'u:dev:MediaWiki:FixCascadingProtectionEditButton.js', 'u:dev:MediaWiki:FixEditorTooltips.js', 'u:dev:MediaWiki:FixJSRTLang.js', 'u:dev:MediaWiki:FixLazyloadingInsideOfScrollable.js', 'u:dev:MediaWiki:FixSourcePages/code.js', //'u:dev:MediaWiki:GlobalEditcount/code.js', 'u:dev:MediaWiki:LastEdited/code.js', //'u:dev:MediaWiki:LegacyWall/code.js', //'u:dev:MediaWiki:ListFiles/code.js', //'u:dev:MediaWiki:ListGroupMembers.js', [Broken mess] 'u:dev:MediaWiki:MastheadRightsBadge.js', 'u:dev:MediaWiki:MultipleActivity.js', 'u:dev:MediaWiki:NewImages.js', 'u:dev:MediaWiki:NoGlobalNav.js', 'u:dev:MediaWiki:OldFilePages/code.js', 'u:dev:MediaWiki:PageCreator/code2.js', 'u:dev:MediaWiki:PersistentParameters/code.js', 'u:dev:MediaWiki:PiniginsUserInfo/code.js', 'u:dev:MediaWiki:PortableCSSPad/code.js', 'u:dev:MediaWiki:PreventTheLimbo.js', 'u:dev:MediaWiki:ProtectionIcons.js', //'u:dev:MediaWiki:QuickLogs/code.js', 'u:dev:MediaWiki:Quick Management/code.js', //'u:dev:MediaWiki:RandomPageShortcut/code.js', broken //'u:dev:MediaWiki:RelatedDiscussionsModule/code.js', 'u:dev:MediaWiki:Rollback/code.2.js', 'u:dev:MediaWiki:RollbackSpamUserContribs/code.js', //'u:dev:MediaWiki:ThreadInspection/code.js', 'u:dev:MediaWiki:SavedDrafts.js', 'u:dev:MediaWiki:ShowUserGroups.js', //'u:dev:MediaWiki:SnowStorm.js', Until next Christmas //'u:dev:MediaWiki:SpellCheckModule/code.js', 'u:dev:MediaWiki:ThemeSelector.js', 'u:dev:MediaWiki:UnhideUserMasthead/code.js', //'u:dev:MediaWiki:WikiActivity.js', //'u:dev:MediaWiki:ViewRemoved/code.js', 'u:dev:MediaWiki:ViewDeleted/code.js', //'u:dev:MediaWiki:WorkingMoreUsersCount.js', 'u:dev:MediaWiki:WHAM/code.2.js' ] });

mw.loader.using('mediawiki.util').then(function {    importArticles({ type: 'script', articles: [ 'u:dev:MediaWiki:NotifPatches.js', ]   }); });

//=============================================== // Makes ProfileTags not override InactiveUsers //=============================================== mw.hook('dev.profile-tags').add(function {   importArticle({ type: 'script', article: 'u:dev:MediaWiki:InactiveUsers/code.js' }); });

//================================================ // Make uncreated categories display as redlinks //================================================

function unCatMark {$('.newcategory').addClass('new')} mw.hook('wikipage.content').add(unCatMark);

//=============================== // Stop FANDOM from tracking me //===============================

$('[data-tracking-label]').removeAttr('data-tracking-label data-tracking');

//======================================================== // Allow editing of rollback edit summary // Requires CSS found at the bottom of my Global CSS //========================================================

// jshint jquery:true, esversion:5 /* globals require, module, mediaWiki, mw, OO */

new function { 'use strict'; $('.mw-rollback-link a, .mw-custom-rollback-link') .after($(' ')	   .addClass('edit-rollback')	    .prop('title', 'Edit rollback summary')); $('#mw-content-text').on('click', '.edit-rollback', function {		var $rollback = $('#rollback-summary');		if ($(this).parent.is($rollback.parent)) {$rollback.toggle;} 		else {			$rollback.remove;			var name = decodeURIComponent( $(this).prev .prop('href') .match(/&from=(.+)&token/)[1].replace(/\+/g, ' ') );			$rollback = $(' ')			   .append($(' ') .addClass('mw-ui-input rollback-text') .prop({maxlength: 250, spellcheck: true}) .val(			         'Revert consecutive edits by Special:Cont' +			           'ributions' + name + '|' + name + ']]' +			           '(talk)'			    ), $(' ')			   .addClass(			        'mw-ui-button mw-ui-constructive rollback-submit-button'			    ) .val('Rollback')).insertAfter(this);		}		// This puts the cursor at the end of the text		var $text = $rollback.find('.rollback-text');		var summary = $text.val; 		$text.focus.val('').val(summary);   }); $('#mw-content-text').on('click', '.rollback-submit-button', function {		var $link = $(this).closest('.mw-rollback-link');		window.location = $link.find('a')		                      .prop('href') + 		                       '&summary=' + 		                       encodeURIComponent( $link .find('.rollback-text') .val );	});	// Allow rollback to be submitted by pressing enter while focused on the input field $('#mw-content-text').on('keypress', '.rollback-text', function(e) {		if (e.which !== 13) {return}		e.preventDefault;		$('.rollback-submit-button').click;	}); // Close rollback if clicked anywhere else $(window).click(function(e) {		if (!$(e.target).is('#rollback-summary, .edit-rollback') && !$('#rollback-summary').has(e.target).length) {		  		$('#rollback-summary').hide;		   }	}) } ;

//============================================================ // Make Visual Editor links load the regular editor instead //============================================================

/*if ($.getUrlVar('veaction') === String('edit')) { location.replace(document.URL.replace('veaction','action')); }*/

//============================================================================ // Don't save a page when enter is pressed in the summary box // Credit to Ciencia Al Poder. Taken from OneTwoThreeFall's Global JS. //============================================================================

if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) { $('#wpSummary').keypress(function (event) {       if (event.which === 13) {return new Boolean(false)}}); }

/*** --- ---
 * 1) MISCELLANEOUS CODE + ARCHIVE



if ($(".highlight-users-script").length > 0) {mw.util.addCSS(   '.highlight-users-script {\    font-weight: bold !important;'); }