User:0Michael105/global.js

/* * @name           Skin Force * @author         Thundercraft5 * @description    Forces FandomDesktop skin. */ mw.loader.using('mediawiki.api', function {	if(mw.config.get('skin') !== 'fandomdesktop' && !mw.util.getParamValue('useskin')) {		new mw.Api.saveOption('skin', 'fandomdesktop').then(console.log, console.warn);		console.warn('[Skin Force] Setting skin to FandomDesktop.');		window.location.reload;	} });

/******************************************************************************/ // 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: ,		3: 	},	summary: 'Created page' };

// GlobalNavButtons configuration window.globalNavButtons = [{ text: 'Wikis', url: '', isMain: true, whoIsMain: false, shortName: 'WS' },	{		text: 'Roblox', url: 'https://roblox.fandom.com', isMain: false, whoIsMain: 'WS', shortName: 'R'	}, {		text: 'Royale High', url: 'https://royale-high.fandom.com', isMain: false, whoIsMain: 'WS', shortName: 'RH' },	{		text: 'Case Clicker', url: 'https://roblox-case-clicker.fandom.com', isMain: false, whoIsMain: 'WS', shortName: 'CC' },	{		text: 'SOAP', url: 'https://soap.fandom.com', isMain: true, whoIsMain: false, shortName: 'SOAP' },	{		text: 'Spam', url: 'https://soap.fandom.com/wiki/Report:Spam', isMain: false, whoIsMain: 'SOAP', shortName: 'S'	}, {		text: 'Vandalism', url: 'https://soap.fandom.com/wiki/Report:Vandalism', isMain: false, whoIsMain: 'SOAP', shortName: 'V'	}, {		text: 'Wiki', url: 'https://soap.fandom.com/wiki/Report:Wiki', isMain: false, whoIsMain: 'SOAP', shortName: 'W'	} ];

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

/******************************************************************************/ // Import JavaScript importArticles({	type: 'script',	articles: [		'u:dev:MediaWiki:AjaxRC.js', // Advanced auto refreshing for RecentChanges.		'u:dev:MediaWiki:AjaxUndo/code.js', // Adds an Ajax undo link on history pages and diffs.		'u:dev:MediaWiki:AllPagesHideRedirect/code.js', // Adds a link to AllPages and PrefixIndex that hides redirects.		'u:dev:MediaWiki:AnnouncementsIgnore.js', // Ignores announcements for certain wikis.		'u:dev:MediaWiki:AutoCreateUserPages.js', // Automatically creates user pages.		'u:dev:MediaWiki:ContribsLink/code.js', // Adds a link to MyContributions on the user drop-down menu on the top right.		'u:dev:MediaWiki:DedicatedTalkButton.js', // Moves talk page link from drop-down to beside edit button.		'u:dev:MediaWiki:DisableCode/code.js', // Adds buttons to disable personal and site JS/CSS for testing.		'u:dev:MediaWiki:DisableInfoboxBuilder.js', // Prevents InfoboxBuilder from loading by redirecting the template to source editor. 'u:dev:MediaWiki:EditConflictAlert/code.js', // Displays a banner notification when the page in editing is modified. 'u:dev:MediaWiki:GlobalNavButtons.js', // Replaces default global nav buttons with custom ones. 'u:dev:MediaWiki:MassCategorization/code.js', // Adds a modal to modify categories on multiple pages in a list fashion. 'u:dev:MediaWiki:MassEdit/code.js', // Adds a modal to automatically edit pages, message users, generate lists of member pages belonging to categories/namespaces, and generate pages transcluding templates. 'u:dev:MediaWiki:MarkBlocked.js', // Strikes out blocked usernames to easily identify blocked users. 'u:dev:MediaWiki:MarkForDeletion/code.js', // Adds a button to quickly mark a page for deletion. 'u:dev:MediaWiki:NoGlobalNav.js', // Removes global navigation and moves user dropdown and notifications on FandomDesktop. 'u:dev:MediaWiki:NoImageLightbox/code.js', // Kills Fandom's Lightbox loader for images and videos. 'u:dev:MediaWiki:PurgeButton/code.js', // Adds a "Purge" option to page controls. 'u:dev:MediaWiki:QuickBarPageTools.js', // Moves FandomDesktop page tool links to the QuickBar. 'u:dev:MediaWiki:Rollback/code.js', // Perform rollbacks without needing the user group. 'u:dev:MediaWiki:SOAPReport.js', // Adds buttons on Contributions for quick reporting users to the SOAP Wiki. 'u:dev:MediaWiki:Sofix.js', // Fixes bugs on Fandom. 'u:dev:MediaWiki:ThemeToggler.js', // Adds two buttons under the edit button to toggle between light and dark theme on FandomDesktop. 'u:dev:MediaWiki:UserAndIPTools.js', // Gets info and tools related to users and IP addresses. ] });

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

// Import JavaScript - sysop/content-moderator if(ug.indexOf('sysop') + ug.indexOf('content-moderator') > -2); importArticles({	type: 'script',	articles: [		'u:dev:MediaWiki:AjaxBatchDelete.js', // Adds a modal to delete and protect pages in list form.		'u:dev:MediaWiki:AjaxBatchUndelete.js', // Adds a modal to undelete pages in list form.		'u:dev:MediaWiki:AjaxDelete/code.js', // Adds a modal to delete pages/file revisions without leaving the current page.		'u:dev:MediaWiki:AnchoredRollback/code.js', // Allows for rollbacks without leaving the current page.		'u:dev:MediaWiki:Discussions Delete All/code.js', // Adds a button on Contributions to delete all of the user's Discussions posts.		'u:dev:MediaWiki:MassBlock/code.js', // Adds a modal to block listed users.		'u:dev:MediaWiki:MassProtect/code.js', // Adds a modal to protect listed pages.		'u:dev:MediaWiki:Nuke/code.js', // Mass delete pages from Contributions or RecentChanges.		'u:dev:MediaWiki:WHAM/code.2.js', // Adds "Quick Tools" menu to Contributions for cleanup functions. ] });

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

// Import JavaScript - threadmoderator elseif(ug.indexOf('threadmoderator') > -2); importArticles({	type: 'script',	articles: [		'u:dev:MediaWiki:Discussions Delete All/code.js', // Adds a button on Contributions to delete all of the user's Discussions posts.	] });

// Device-specific imports require(['wikia.browserDetect'], function(detect) {	if(detect.isMobile) {		importArticle({ type: 'script', article: 'u:dev:MediaWiki:ChromeToolbarColor.js', // Sets the mobile Chrome toolbar color to wiki's community header color. });	} else {		importArticles({ type: 'script', articles: [ 'u:dev:MediaWiki:PortableCSSPad/code.js', // Adds a pad for writing CSS with live-updating. ]		});	} });

/******************************************************************************/ // Log to console as loaded (function {	console.log('Loaded global.js in ' + (new Date - start) + 'ms'); });