User:0Michael105/global.js

/* -- */ /*                                Welcome                                    */ /* -- */ /*            This code loads when I visit any Fandom wiki page. */ /*                                                                           */ /*  Feel free to take anything from here, but please be sure to attribute this*/ /* page, or the original author. See Licensing for more details. */ /*                                                                           */ /*                           Thanks, 0Michael105                              */

/* -- */ /*                          Remove tracking data                             */ /* This code snippet was written by Thundercraft5 (https://community.fandom.co*/ /* m/wiki/User:Thundercraft5) on Community Central (https://community.fandom.c*/ /* om) for User:Thundercraft5/global.js (https://community.fandom.com/wiki/Use*/ /* r:Thundercraft5/global.js) and is released under the CC-BY-SA 3.0 license. */ /* -- */ 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, });

/* -- */ /*                         Remove unwanted elements                          */ /* -- */ $('.global-navigation__bottom ul.wds-list.wds-is-linked > li > a[href*="bingebot"]').remove; // "My TV Finder" promotional button

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

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

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

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

// NoImageLightbox configuration window.NoImageLightbox = { novideo: true };

/* -- */ /*                           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:ChromeToolbarColor.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: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:PortableCSSPad/code.js', 'u:dev:MediaWiki:PortableListUsers.js', 'u:dev:MediaWiki:PurgeButton/code.js', 'u:dev:MediaWiki:QuickBarPageTools.js', 'u:dev:MediaWiki:Rollback/code.js', 'u:dev:MediaWiki:ShowWROnToolbar.js', 'u:dev:MediaWiki:SOAPReport.js', 'u:dev:MediaWiki:Sofix.js', 'u:dev:MediaWiki:ThemeToggler.js', 'u:dev:MediaWiki:UCXSearchBar.js', 'u:dev:MediaWiki:UserAndIPTools.js', 'u:joritochip:User:0Michael105/DiscussionsTab.js' ] });

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

if(ug.indexOf('sysop') + ug.indexOf('content-moderator') > -2); // Check if sysop or content-moderator importArticles({	type: 'script',	articles: [		'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:Nuke/code.js',		'u:dev:MediaWiki:PowerDelete.js',		'u:dev:MediaWiki:WHAM/code.2.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',				title: conf.wgPageName,				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'		}); } });

elseif(ug.indexOf('threadmoderator') > -2); // Check if threadmoderator importArticles({	type: 'script',	articles: [		'u:dev:MediaWiki:Discussions Delete All/code.js'	] });