User:LightHouse38/global.js

window.AutoCreateUserPagesConfig = { content: '', summary: 'Automated userpage or message greeting created by myself 😜' }; importArticles({   type: 'script',    articles: [        'u:kocka:User:KockaAdmiralac/AutoCreateUserPages.javascript'        ] }); importArticles({   type: 'script',    articles: [        // ...        'u:kocka:MediaWiki:AjaxThreadDelete/code.js',        // ...    ] }); window.AjaxThreadDeleteConfig = { fastDelete: true, reason: 'Deleting comment' }; window.category = ['Candidates for deletion', 'Unused images']; window.reason = 'Housekeeping'; window.quickDeleteDelay = '800'; window.nukeDeleteReason = "Cleanup junk"; window.nukeDelay = 1000; /* Any JavaScript here will be loaded for all users on every page load. See w:c:dev:AjaxRC for info & attribution */ AjaxRCRefreshText = 'Auto-Refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = ["Special:RecentChanges","Special:WikiActivity","Special:UncategorizedPages","Special:AllPages"]; importScriptPage('AjaxRC/code.js', 'dev'); window.pageNames = [ 'PAGENAMEWITHOUTPREFIX', 'ANOTHERPAGENAMEWITHOUTPREFIX' ]; window.pageData = [ 'DATAFORFIRSTPAGEINABOVELIST', 'DATAFORSECONDPAGEINABOVELIST' ]; window.pagePurpose = [ 'PURPOSEOFFIRSTPAGE', 'PURPOSEOFSECONDPAGE' ]; // Display 12 hour time followed by day, month (English, full name) // and year with "(UTC)" at the end window.DisplayClockJS = { format: '%2I:%2M:%2S %p %2d %{January;Febuary;March;April;May;June;July;August;September;October;November;December}m %Y (UTC)', location: 'header', hoverText: 'This is what the user sees when they hover their mouse over the link', interval: 500, /* How often the timer updates in milliseconds (1000=1 second) */ monofonts: 'Rubik', /* The font the clock uses by default */ offset: 480 /* Time offset from UTC in minutes - 480 changes the clock from UTC to CST (China Standard Time) */ }; importArticle({type:'script', article:'w:c:dev:DisplayClock/code.js'}); window.fdButtons = [ {       summary: 'Housekeeping', label: 'HK' },   {        summary: 'Vandalism', label: 'V'   }, {       summary: 'Spam', label: 'S'   }, {       summary: 'Cleanup', label: 'C'   }, {       summary: 'Violation of the ToU', label: 'ToU' } ]; /* Installed scripts */ importArticles({	type: 'script',	articles: [		// ...		'u:dev:DisplayClock/code.js',		'u:dev:MediaWiki:SearchEnhancements.js',		'u:dev:MediaWiki:AjaxThreadDelete/code.js',		'u:dev:MediaWiki:PurgeButton/code.js',		'u:dev:MediaWiki:Status/code.js',		'u:dev:MediaWiki:TemplateTypeButtons/code.js',		'u:dev:MediaWik:CategoryQuickRemov/code.js',		'u:dev:MediaWiki:AutoPurge/code.js',		'u:dev:MediaWiki:MinimalJSPages.js',		'u:dev:MediaWiki:WHAM/code.2.js',		'u:dev:MediaWiki:EasyUserTags/code.js',		'u:dev:MediaWiki:MassNullEdit/code.js',		'u:dev:MediaWiki:AjaxThreadDelete/code.js',		'u:dev:MediaWiki:AjaxEdit.js',		'u:dev:MediaWiki:FastDelete/code.js',		'u:dev:MediaWiki:QuickDelete/code.js',		'u:dev:MediaWiki:QuickDelete/code.js',		'u:dev:MediaWiki:Quick Management/code.js',		'u:dev:MediaWiki:AjaxUndo/code.js',		'u:dev:RevealAnonIP/usercode.js',		'u:dev:MediaWiki:DateInserter/code.js',		'u:dev:MediaWiki:QuickThreads/code.js', 'u:dev:MediaWiki:ReplyBottom/code.js', 'u:dev:MediaWiki:UTCClock/code.js', 'u:dev:MediaWiki:MisspelledPage/code.js', 'u:dev:MediaWiki:EditorFilter/code.js', 'u:dev:MediaWiki:AjaxDelete/code.js', 'u:dev:MediaWiki:FixEditorTooltips.js', 'u:dev:MediaWiki:NewImages.js', 'u:dev:MediaWiki:AjaxThreadUnfollow/code.js', 'u:dev:MediaWiki:AjaxThreadDelete/code.js', 'u:dev:MediaWiki:QuickComments/advanced.js', 'u:dev:MediaWiki:MercuryPreview.js', 'u:dev:MediaWiki:DiscussionsRailModule/code.js', 'u:dev:MediaWiki:Sine/code.js', 'u:dev:MediaWiki:WikiPlus/code.js', 'u:dev:MediaWiki:FasterBanModule/code.js', 'u:dev:MediaWiki:CreateSpecialPage/code.js', 'u:dev:MediaWiki:UsefulDropdown/code.js', 'u:dev:MediaWiki:HoverEditCount/code.js', 'u:dev:MediaWiki:MassRenameRevert/code.js', 'u:dev:MediaWiki:CopyCodeButton.js', 'u:dev:MediaWiki:AddNukeLink.js', 'u:dev:MediaWiki:PageCreator/code2.js', 'u:dev:MediaWiki:StickySummary.js', 'u:dev:MediaWiki:EditBio/code.js', 'u:dev:MediaWiki:QuickDelete/code.js', 'u:dev:MediaWiki:ImprovedFooter/code.js', 'u:dev:MediaWiki:SearchEnhancements.js', 'u:dev:DisplayTimer/code.js', 'u:dev:MediaWiki:RevealAnonIP/usercode.js', 'u:dev:MediaWiki:ListAdmins/code.js', 'u:dev:MediaWiki:FastDelete/code.js', 'u:dev:MediaWiki:CacheCheck/code.js', 'u:dev:MediaWiki:MassEdit/code.js', 'u:dev:MediaWiki:HighlightUsers/code.js', 'u:dev:MediaWiki:AbuseLogRC.js', 'u:dev:MediaWiki:UserAccountAge/code2.js', 'u:dev:MediaWiki:ClearSandbox/code.js', 'u:dev:MediaWiki:View Source/code.js', 'u:dev:MediaWiki:SearchSuggest/code.js', 'u:dev:MediaWiki:CollapseMessage.js', 'u:dev:MediaWiki:AvatarLink.js', 'u:dev:MediaWiki:MobileEditor.js', 'u:dev:MediaWiki:PageMakerPro/code.js', 'u:dev:MediaWiki:Nuke/code.js', 'u:dev:MediaWiki:AnchoredRollback/code.js', 'u:dev:MediaWiki:Discussions Delete All/code.js', 'u:dev:MediaWiki:AtUsername/code.js', 'u:dev:MediaWiki:AddSectionButton/code.js', 'u:dev:MediaWiki:RollbackSpamUserContribs/code.js', 'u:dev:MediaWiki:PiniginsUserInfo/code.js', 'u:dev:MediaWiki:MassBlock/code.js', 'u:dev:MediaWiki:SeeMoreActivityButton/code.js', 'u:dev:MediaWiki:GlobalEditcount/code.js', 'u:dev:MediaWiki:WallGreetingButton/code.js', 'u:dev:MediaWiki:RandomPageShortcut/code.js', 'u:dev:MediaWiki:VSTFReport.js', 'u:dev:MediaWiki:VSTF Report Menu/code.js', 'u:dev:MediaWiki:MarkForDeletion/code.js', 'u:dev:MessageWallUserTags/code.js', 'u:dev:MediaWiki:ColorPreview/code.js', 'u:dev:MediaWiki:Standard Edit Summary/code.js', 'u:dev:MediaWiki:SandboxTab/code.js', 'u:dev:MediaWiki:AdminDashboard JS-Button/code.js', 'u:dev:BackToTopButton/code.js', 'u:dev:LastEdited/code.js', 'u:dev:MediaWiki:RevertOldGlobalNav/code.js', 'u:dev:MediaWiki:BlogLink/code.js', 'u:dev:MediaWiki:SourceEditButton.js', 'u:dev:MediaWiki:NullEditButton/code.js', 'u:dev:MediaWiki:EditIntroButton/code.js', 'u:dev:MediaWiki:ModernButtons/code.js', 'u:dev:MediaWiki:SimilarArticles/code.js', 'u:dev:MediaWiki:PurgeButton/code.js', 'u:dev:MediaWiki:ChatOptions/code.js', 'u:dev:MediaWiki:EditIntroButton/code.js', 'u:dev:MediaWiki:SourceEditButton.js', 'u:dev:MediaWiki:BlockedByChatUsers/code.js', 'u:dev:MediaWiki:RecentChangesMultiple/code.2.js', 'u:dev:MediaWiki:LinkPreview/code.js', 'u:dev:MediaWiki:AdminDashboard JS-Button/code.js', 'u:dev:MediaWiki:EditBio/code.js', 'u:dev:MediaWiki:Translator/Translator.js', 'u:dev:MediaWiki:PurgeButton/code.js', 'u:dev:MediaWiki:MassProtect/code.js', 'u:dev:MediaWiki:BackToTopButton/code.js', 'u:dev:InputUsername/code.js', 'u:dev:BackToTopButton/code.js' // ...	] }); /* mw.loader.using('mediawiki.api', function { //Exit if normal rollback links are present if ($('.mw-rollback-link').length) return; var conf = mw.config.get([		'wgAction',		'wgCanonicalSpecialPageName',		'wgContentLanguage',		'wgPageName',		'wgUserLanguage',		'skin'	]), i18n = { en: { rollback: "rollback", description: "&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click", summary: "Reverted edits by $1 (talk | block) to last version by $2 (script)", summaryShort: "Reverted edits by $1 (talk) to last version by $2 (script)", editConflict: "Unable to rollback (edit conflict)", contentFail: "Unable to rollback (failed to get page content)", singleEditor: "Unable to rollback (no different editor found)", revisionFail: "Unable to rollback (failed to get revisions)", editFail: "Unable to rollback (failed to publish edit)", success: "Rollback successful" }	};	i18n = i18n[conf.wgUserLanguage] || i18n[conf.wgUserLanguage.split('-')[0]] || i18n[conf.wgContentLanguage] || i18n[conf.wgContentLanguage.split('-')[0]] || i18n.en; conf.API = new mw.Api; conf.token = mw.user.tokens.values.editToken; //History if (conf.wgAction == "history" && $('#pagehistory li').length > 1) $('#pagehistory li:first .mw-history-undo a').before(' ' + i18n.rollback + ' | '); //Contributions else if (conf.wgCanonicalSpecialPageName == "Contributions") { $('#mw-content-text ul').find('li').each(function {			if ($(this).find('.mw-uctop').length)				$(this).append(' [' + i18n.rollback + '] ');		}); }	//Diffs else if (($.getUrlVar('diff') || $.getUrlVar('oldid')) && $('#differences-nextlink').length === 0) $('.mw-usertoollinks:last').after('   [' + i18n.rollback + '] '); else return; mw.util.addCSS('.mw-custom-rollback-link a { cursor: pointer; }'); $('.mw-custom-rollback-link a').click(function {		getRevisionIdAndContent($(this).data('id'),$(this).data('user').replace(/_/g, " "));		$(this).parent.remove;	}); window.AjaxBlock = { blockReasons: { 'Vandalism': 'Vandalism', 'Spam': 'Spam', 'Repeated policy violations': 'Repeated violations', 'Sockpuppetry/Ban Evasion': 'Sockpuppetry', 'Moved to a new account': 'Moved', 'Removing content/blanking pages': 'Page blanking', 'Inserting false information or nonsense': 'Gibberish', 'Intimidating behaviour/harassment/trolling': 'Troll/Harassment', 'Unacceptable username, avatar, or global masthead': 'Name/avatar', 'Under the legal age': 'COPPA', 'Failing to comply with the File Policy': 'File Policy', 'Posting/Discussing leaked content': 'Leaks' },   check: { creation: true, talk: true, autoBlock: true, override: true } };	function getRevisionIdAndContent(title,target) { conf.API.get({		action: 'query',		prop: 'revisions',		titles: title,		rvprop: 'user|ids',		rvlimit: 9000,		cb: new Date.getTime		}) .done(function(d) {			if (!d.error) {				var revisions;				for (var i in d.query.pages) {					revisions = d.query.pages[i].revisions;				}				var lastUser,				revId;				for (var j in revisions) {					if (revisions[j].user != target) {						lastUser = revisions[j].user; //remember last author						revId = revisions[j].revid; //get revision to revert to						break;					}				}				if (lastUser) {					conf.API.get({ action: 'query', prop: 'revisions', rvprop: 'content', revids: revId, cb: new Date.getTime })					.done(function(d) { if (!d.error) { var content = ""; //can be no content on page for (var i in d.query.pages) { if (d.query.pages[i].revisions) content = d.query.pages[i].revisions[0]["*"]; }							performRollback(title,content,target,lastUser); }						else outputError(i18n.contentFail + ': ' + d.error.code); })					.fail(function { outputError(i18n.contentFail); });				}				else					outputError(i18n.singleEditor);			}			else				outputError(i18n.revisionFail + ': ' + d.error.code);		}) .fail(function {			outputError(i18n.revisionFail);		}); }	function performRollback(page,text,user,user2) { var summary = i18n.summary.replace(/\$1/g,user).replace(/\$2/g,user2); conf.API.post({		action: 'edit',		title: page,		text: text,		summary: summary,		minor: true,		token: conf.token		}) .done(function(d) {			if (!d.error) {				new BannerNotification(i18n.success,'confirm').show;							}			else				outputError(i18n.editFail + ': ' + d.error.code);		}) .fail(function {			outputError(i18n.editFail);		}); }	function outputError(text) { switch (conf.skin) { case 'oasis': case 'wikia': new BannerNotification(text,'error').show; break; default: alert(text); break; }		} }); /* Clock */ window.DisplayClockJS = '%X %x [%{Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday}w] (UTC)'; /* Last edit header */ window.lastEdited = {   avatar: true,    size: false,    diff: true,    comment: true,    time: 'timeago',    namespaces: {        include: [],        exclude: []    },    pages: [] };
 * Rollback
 * @description Perform rollbacks without needing to be in the usergroup
 * @author Ozank