User:0Michael105/global.js

/* Remove tracking data on page load. (Thundercraft5) */ var localStorageBlacklist = [ "wkch_val_recommendations_blacklist", /^silver/i, /^optimizely_data\${2}/i, ];

var cookieBlacklist = [ "wikia_beacon_id", /^sailthru/i, "Geo", "ss_galactus_enabled", /^pv_number/i, /^permutive/i, /^tracking/i, /\bbeacon\b/i, ];

var cookies = new Map(document.cookie.split(/\s*;\s*/)   .map(function(entry) { return entry.split("="); }) );

cookies.forEach(function(_, k) {   if (cookieBlacklist.find(function(v) {            return v instanceof RegExp ? k.match(v) : k === v;        }))        document.cookie = k + "=; expires=" + new Date.toISOString + "; path=/;"; });

Object.keys(localStorage).forEach(function(k) {   if (localStorageBlacklist.find(function(v) {            return v instanceof RegExp ? k.match(v) : k === v;        }))        localStorage.removeItem(k); });

window.indexedDB.deleteDatabase('silver-surfer');

$('*').attr({   'data-tracking': null,    'data-tracking-label': null, });

/* -- */ /*                          Configure JavaScript                             */ /* -- */ /* AnchoredRollback config */ window.anchoredRollbackBot = true;

/* AnnouncementsIgnore config */ window.announcementsIgnore = { option: 'opt-out-all', exceptWikiIds: [ 177, // community 4396, // roblox 1668557, // royale-high 1851384 // roblox-case-clicker ] };

/* AutoCreateUserPages config */ window.AutoCreateUserPagesConfig = { content: { 2: '',   },    summary: 'Creating user page (auto)' };

/* FastCreate config */ window.FCButtons = [{ label: 'Create user page', target: 'User:0Michael105', summary: 'Creating user page', content: '' }];

/* LastEdited config */ window.lastEdited = { avatarsize: 12, comment: false, mainpage: false, time: 'timestamp', timezone: 'UTC', lang: 'en', namespaces: { exclude: [] },   pages: [] };

/* NoImageLightbox config */ window.NoImageLightbox = { novideo: true };

/* Nuke config */ window.nukeDelay = 5;

/* PageCreator config */ window.pageCreatorConfig = { namespaces: Object.keys(mw.config.get("wgFormattedNamespaces")).map(Number), useUsernameAndLinks: true, useAvatar: true, useTimestamp: true, useUTC: true, useTimeago: false, avatarsize: 12 };

/* Sofix config */ window.Sofix = { enablePersonalUse: true };

/* WHAM config */ window.WHAMDelay = 5;

/* -- */ /*                           Import JavaScript                               */ /* -- */ importArticles({   type: 'script',    articles: [        /*'u:dev:MediaWiki:AjaxRC.js',*/        'u:dev:MediaWiki:AjaxRedirect/code.js',        'u:dev:MediaWiki:AjaxUndo/code.js',        'u:dev:MediaWiki:AllPagesHideRedirect/code.js',        'u:dev:MediaWiki:AnnouncementsIgnore.js',        'u:dev:MediaWiki:AutoCreateUserPages.js',        /*'u:dev:MediaWiki:BlockSummary.js',*/        'u:dev:MediaWiki:CategorizedNotifications.js',        'u:dev:MediaWiki:CategoryRedLinks.js',        'u:dev:MediaWiki:CategoryQuickRemove.js',        /*'u:dev:MediaWiki:ChromeToolbarColor.js',*/        'u:dev:MediaWiki:CopyTitle.js',        'u:dev:MediaWiki:DecodeURI/code.js',        'u:dev:MediaWiki:DedicatedTalkButton.js',        'u:dev:MediaWiki:DisableCode/code.js',        'u:dev:MediaWiki:DisableInfoboxBuilder.js',        'u:dev:MediaWiki:DoruDev.js',        'u:dev:MediaWiki:DupeArgs.js',        'u:dev:MediaWiki:DupImageList/code.js', /* */ 'u:dev:MediaWiki:EditConflictAlert/code.js', 'u:dev:MediaWiki:FastCreate.js', 'u:dev:MediaWiki:FileUsageAuto-update/code.js', 'u:dev:MediaWiki:LastEdited/code.js', 'u:dev:MediaWiki:MassCategorization/code.js', /*'u:dev:MediaWiki:MassEdit/code.js',*/ 'u:dev:MediaWiki:MarkBlocked.js', 'u:dev:MediaWiki:MarkForDeletion/code.js', 'u:dev:MediaWiki:NoGlobalNav.js', 'u:dev:MediaWiki:NoImageLightbox/code.js', 'u:dev:MediaWiki:NullEditButton/code.js', 'u:dev:MediaWiki:PageCreator/code2.js', 'u:dev:MediaWiki:PortableCSSPad/code.js', /*'u:dev:MediaWiki:PortableListUsers.js',*/ 'u:dev:MediaWiki:ProtectionIcons.js', 'u:dev:MediaWiki:PurgeButton/code.js', 'u:dev:MediaWiki:QuickBarPageTools.js', 'u:dev:MediaWiki:QuickPurge.js', 'u:dev:MediaWiki:RedirectManagement/code.js', 'u:dev:MediaWiki:RestoreRightRail.js', 'u:dev:MediaWiki:Rollback/code.js', 'u:dev:MediaWiki:SearchSuggest/code.js', 'u:dev:MediaWiki:ShowWROnToolbar.js', 'u:dev:MediaWiki:SOAPReport.js', 'u:dev:MediaWiki:Sofix.js', 'u:dev:MediaWiki:Stella.js', 'u:dev:MediaWiki:ThemeToggler.js', 'u:dev:MediaWiki:TopHiddenCategories.js', 'u:dev:MediaWiki:UndeleteBacklink.js', 'u:dev:MediaWiki:UserAndIPTools.js' ] });

importScriptPage('User:0Michael105/Sofix2.js', 'community');

var ug = mw.config.get("wgUserGroups").join(' '); /* Get wgUserGroups */

if (ug.indexOf('sysop') + ug.indexOf('content-moderator') > -2); importArticles({   type: 'script',    articles: [/* Sysop or content-moderator specific things are loaded here. */        'u:dev:MediaWiki:AjaxAbuseLog.js',        'u:dev:MediaWiki:AjaxBatchDelete.js',        'u:dev:MediaWiki:AjaxBatchUndelete.js',        'u:dev:MediaWiki:AjaxDelete/code.js',        'u:dev:MediaWiki:AnchoredRollback/code.js',        'u:dev:MediaWiki:Discussions Delete All/code.js',        'u:dev:MediaWiki:MassBlock/code.js',        'u:dev:MediaWiki:MassProtect/code.js',        'u:dev:MediaWiki:MultipleFileDelete/code.js',        'u:dev:MediaWiki:Nuke/code.js',        'u:dev:MediaWiki:PowerDelete.js',        'u:dev:MediaWiki:RevisionDelete.js',        'u:dev:MediaWiki:WHAM/code.2.js'    ] });

elseif(ug.indexOf('threadmoderator') > -2); importArticles({   type: 'script',    articles: [/* Threadmoderator specific things are loaded here. */        'u:dev:MediaWiki:Discussions Delete All/code.js'    ] });

/** * @name           FastDelete * @author         Splarka * @author         Uberfuzzy * @author         Grunny * @author         Joritochip * @description    Script for deleting pages with one click * @version        2.7 */ $(function {   const conf = mw.config.get([ 'wgNamespaceNumber', 'wgPageName', 'wgArticleId', 'skin' ]);

if (       conf.skin !== 'fandomdesktop' ||        window.FastDeleteLoaded ||        !window.fdButtons ||        conf.wgNamespaceNumber === -1 ||        conf.wgArticleId === 0 ||        (conf.wgNamespaceNumber === 2 && $('.noarticletext').length) ||        (conf.wgNamespaceNumber != 2 && !$('#ca-delete').length) ||        !/sysop|staff|helper|wiki-manager|content-team-member|content-volunteer|content-moderator|soap/.test(mw.config.get('wgUserGroups').join)    ) return;

window.FastDeleteLoaded = true;

function promptDelete(reason) { if (window.FastDeleteNoConfirm === true || confirm('Are you sure you want to delete this page? Delete reason will be "' + reason + '".') === true) { new mw.Api.postWithToken('csrf', {               action: 'delete',                pageid: conf.wgArticleId,                reason: reason,                bot: true            }).done(function(res) {                if (res.error) return alert('An error occurred while trying to delete the page: ' + res.error.code + ' - ' + res.error.info);                location.reload;            }).fail(function {                return alert('An error occurred while trying to delete the page!');            }); }   }

mw.hook('dev.wds').add(function(wds) {       var dropdown = $(' ').appendTo('.page-side-tools');

var toggle = $(' ').appendTo(dropdown); $('').append(wds.icon('trash-small')).appendTo(toggle);

var content = $('').appendTo($(' ').appendTo(dropdown));

fdButtons.forEach(function(array) {           $('' + array.label + '').appendTo(content).click(function { promptDelete(array.summary); });       });    });

if (!window.dev || !window.dev.wds) { importArticle({           type: 'script',            article: 'u:dev:MediaWiki:WDSIcons/code.js'        }); } });

/** * @name           edit-section-on-hover * @author         Enterprisey  * @source         en.wikipedia.org/wiki/User:Enterprisey/edit-section-on-hover.js */ // vim: ts=4 sw=4 et ai // (function {   if (mw.config.get("wgAction") === "view") {

// Wrap every section in its own div var editSectionSpans = document.querySelectorAll("span.mw-editsection"); if (!editSectionSpans.length) return; var headerEl, currEl, container; for (var i = 0; i < editSectionSpans.length; i++) {

headerEl = editSectionSpans[i].parentNode; if (headerEl.matches("h1.firstHeading")) continue;

// Insert container into DOM container = document.createElement("div"); container.className = "edit-section-on-hover"; container.dataset.hoverId = i;           headerEl.parentNode.insertBefore(container, headerEl);

// Insert all elements in the section into our container var currEl = headerEl.nextSibling; container.appendChild(headerEl); var nextEl; while (currEl && (currEl.nodeType !== 1 || currEl.tagName.toLowerCase.indexOf("h") !== 0)) { nextEl = currEl.nextSibling; container.appendChild(currEl); currEl = nextEl; }       }

mw.loader.addStyleTag("div.edit-section-on-hover { margin-bottom: -1.6em; padding-bottom: 1.1em }" +           "div.edit-section-on-hover .mw-editsection { display: none; }" +            "div.edit-section-on-hover:hover .mw-editsection { display: inline; }"); } }); //

/* Hide annoying fixed/sticky content in user pages, e.g. images in the corner or big popups (Joritochip) */ $(function {   var config = mw.config.get(['wgNamespaceIds', 'wgNamespaceNumber']);    var namespaces = config.wgNamespaceIds,        namespaceId = config.wgNamespaceNumber;    if (namespaceId == namespaces.user || namespaceId == namespaces.user_talk) {        $('#mw-content-text > .mw-parser-output *').filter(function { return this.style.position == 'fixed' || this.style.position == 'sticky'; }).remove;   } });