User:0Michael105/global.js

// 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: ,		3: ,		1202: ''	},	summary: 'Automatically created page' };

// 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: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:AjaxRedirect/code.js', // Adds a button to the page edit drop-down menu to quickly redirect the current page. '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 quickly toggle between light and dark theme on FandomDesktop. 'u:dev:MediaWiki:UserAndIPTools.js', // Gets info and tools related to users and IP addresses. 'u:joritochip:User:0Michael105/DiscussionsTab.js' // Adds back a discussions nav tab for FandomDesktop. ] });

/* * Rollback * @author Ozank * @description Performs rollbacks without needing the user group. */ (function {	'use strict';	// Exit if normal rollback links are present or the wiki disabled the script	if($('.mw-rollback-link').length || window.RollbackWikiDisable) {		return;	}	var Rollback = $.extend(window.Rollback, { config: mw.config.get([			'wgAction',			'wgCanonicalSpecialPageName',			'wgPageName'		]), _preload: 2, getPageType: function { if(				this.config.wgAction === 'history' &&				$('#pagehistory li').length > 1			) { return 'history'; } else if(				this.config.wgCanonicalSpecialPageName === 'Contributions'			) { return 'contributions'; } else if(				mw.util.getParamValue('diff') &&				$('#differences-nextlink').length === 0			) { return 'diff'; }		},		preload: function { if(--this._preload === 0) { window.dev.i18n.loadMessages('Rollback') .then(this.init.bind(this)); }		},		init: function(i18n) { this.i18n = i18n; this.api = new mw.Api; this.performRollbackCallback = this.performRollbackCallback .bind(this); var type = this.getPageType; if(type) { this[type]; }			mw.hook('quickdiff.ready').add(this.quickDiff.bind(this)); },		getLink: function(page, user) { return $('', {				'click': this.click.bind(this),				'data-id': page,				'data-user': user,				'href': '#',				'text': this.i18n.msg('rollback').plain,				'title': this.i18n.msg('description').plain			}); },		history: function { $('#pagehistory li:first .mw-history-undo a').before(				$(' ', { 'class': 'mw-custom-rollback-link' }).append(this.getLink(					this.config.wgPageName,					$('.mw-userlink:first').text				)),				' | '			); },		contributions: function { $('#mw-content-text ul li').each(function(_, el) {				// Fix context				var $this = $(el);				if($this.find('.mw-uctop').length) {					$this.append( ' ',						$(' ', {							'class': 'mw-custom-rollback-link'						}).append(							'[',							this.getLink( $this.find('a:first').attr('title'), this.config.wgPageName.split('/')[1] ),							']'						)					);				}			}.bind(this)); },		diff: function { $('.mw-usertoollinks:last').after(				'   ',				$(' ', { 'class': 'mw-custom-rollback-link' }).append( '[',					this.getLink(						this.config.wgPageName,						$('#mw-diff-ntitle2 .mw-userlink').text					), ']'				)			);		},		quickDiff: function(modal) { // See getDiffTitle from QuickDiff. var prevTitle = modal.data.content .find('#mw-diff-otitle1 a') .attr('title'), currTitle = modal.data.content .find('#mw-diff-ntitle1 a') .attr('title'); if(prevTitle !== currTitle) { // This is a Special:ComparePages diff. return; }			modal.$content.find('.mw-usertoollinks:last').after(				'   ',				$(' ', { 'class': 'mw-custom-rollback-link' }).append( '[',					this.getLink(						currTitle,						modal.$content						.find('#mw-diff-ntitle2 .mw-userlink')						.text					), ']'				)			);		},		click: function(event) { event.preventDefault; if(this.confirm && !confirm(this.i18n.msg('confirm').plain)) { return; }			var $this = $(event.target); this.getRevisionIdAndContent(				$this.data('id'),				$this.data('user').replace(/_/g, ' ')			); $this.parent.remove; },		getRevisionIdAndContent: function(title, target) { this.api.get({				action: 'query',				cb: Date.now,				indexpageids: 1,				prop: 'revisions',				rvlimit: 'max',				rvprop: 'user|ids',				titles: title			}).done(this.getRevisionIdCallback.bind(this, target)).fail(				this.outputError.bind(this, 'revisionFail')			); },		getRevisionIdCallback: function(target, data) { if(data.error) { this.outputError('revisionFail', data.error.code); return; }			var revisions = data.query.pages[data.query.pageids[0]].revisions; // Don't rollback if the page has been edited by somebody else if(target !== revisions[0].user) { this.outputError('editConflict'); return; }			var lastUser, revId; for(var i in revisions) { if(revisions[i].user !== target) { // Remember last author lastUser = revisions[i].user; // Get revision to revert to					revId = revisions[i].revid; break; }			}			if(!lastUser) { this.outputError('singleEditor'); return; }			this.api.get({				action: 'query',				cb: Date.now,				indexpageids: 1,				prop: 'revisions',				revids: revId,				rvprop: 'content'			}).done(				this.getRevisionContentCallback.bind(this, target, lastUser)			).fail(				this.outputError.bind(this, 'contentFail', undefined)			); },		getRevisionContentCallback: function(target, lastUser, data) { if(data.error) { this.outputError('contentFail', data.error.code); return; }			// Can be no content on page var page = data.query.pages[data.query.pageids[0]], content = page.revisions ? page.revisions[0]['*'] : ''; this.performRollback(page.title, content, target, lastUser); },		performRollback: function(page, text, user, user2) { var summary = this.i18n .inContentLang .msg(user, user2) .plain; if(summary.length > 255) { summary = this.i18n .inContentLang .msg('summaryShort', user) .plain; }			this.api.post({				action: 'edit',				bot: true,				minor: true,				summary: summary,				text: text,				title: page,				token: mw.user.tokens.get('editToken')			}).done(this.performRollbackCallback).fail(				this.outputError.bind(this, 'editFail')			); },		performRollbackCallback: function(data) { if(data.error) { this.outputError('editFail', data.error.code); } else { var msg = this.i18n.msg('success'); mw.notify(msg.plain); }		},		outputError: function(message, code) { var msg = this.i18n.msg(				message,				(typeof code !== 'string' || code === 'http') ?				this.i18n.msg('ajaxError').plain :				code			); mw.notify(msg.plain, {				type: 'error'			}); }	});	mw.loader.using([ 'mediawiki.api', 'mediawiki.user', 'mediawiki.util', 'mediawiki.notification' ], Rollback.preload.bind(Rollback));	mw.hook('dev.i18n').add(Rollback.preload.bind(Rollback));	importArticle({ type: 'script', article: 'u:dev:MediaWiki:I18n-js/code.js' }); });

// 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:AjaxAbuseLog.js', // Allows for viewing of abuse log details without leaving the current page.		'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'); });