User:Caburum/global.js

// Hello and welcome to my global JS page window.dev = window.dev || {}; window.caburum = { shouldRunGlobal: window.location.search.indexOf('useglobaljs') === -1 && window.location.search.indexOf('usecabjs') === -1, // return true if the global script should run, shouldRunLocal: window.location.search.indexOf('uselocaljs') === -1 && window.location.search.indexOf('usecabjs') === -1, // return true if the local script should run ranGlobal: false, ranLocal: false, init: function { if (!this.shouldRunGlobal) { this.log('Did not execute global.js from Community Central, disabled'); } else if (!window.caburum.ranGlobal) { this.exec; this.ranGlobal = true; this.log('Executed global.js from Community Central'); }	},	exec: function { $.extend(window, { // Script config			AjaxRename: { // w:c:dev:AjaxRename				check: {					leaveredirect: false,					watch: false,					movetalk: true				},				renameReasons: {					'Normal': {						'Misnamed': 'Misnamed',						'Better name': 'Better name',						'Fixing capitalization': 'Fixing capitalization'					},					'Other': {						'Page does not belong in namespace': 'Page does not belong in namespace',					}				}			},			andrewds1021: {				view_notifications_users: { // w:c:dev:ViewNotificationsUsers					all_types: true,					content: 'name'				},				ignore_notifications: { // w:c:dev:IgnoreNotifications					ignore_errors: true,					filters: [						{							types: 'discussion-upvote'						},						{							wiki_ids: [								2078067,								2411433,								2417668,								2386902							],							types: 'announcement-target'						}					]				}			},			AutoCreateUserPagesConfig: { // w:c:dev:MediaWiki:AutoCreateUserPages.js content: { 2: '',					3: false, 1202: false },				summary:'Automated user page creation' },			dev: { i18n: {overrides: { // i18n overrides Rollback: { summary: 'Reverted edits by $1 (talk) to last version by $2' }				}}			},			FCButtons: [ // w:c:dev:FastCreate /*{					label: 'Create userpage', target: 'User:Caburum', summary: 'Creating userpage', content: '', alwaysDisplay: true, placement: '.wds-global-navigation__user-menu .wds-list' },*/				{					label: 'Create bot userpage', target: 'User:CaburumBot', summary: 'Creating my bot\'s userpage', content: '', alwaysDisplay: true, placement: '.wds-global-navigation__user-menu .wds-list' }			],			fdButtons: [ // w:c:dev:FastDelete {					summary: 'Housekeeping', label: 'HK' },				{					summary: 'Vandalism', label: 'V'				}, {					summary: 'Spam', label: 'S'				}, {					summary: 'Duplicate', label: 'Dp' }			],			MessageBlock: { // w:c:dev:MessageBlock title : 'Blocked', message : 'You have received a $2 block for the reason: \'$1\'. Unless otherwise stated, you may appeal your block on my message wall at Community Central.', autocheck : true }		});

window.globalNavButtons = [ // w:c:dev:GlobalNavButtons /* Patrolling */ window.caburum.globalNavPage('RC', 'Special:RecentChanges', {m: 'RC'}), window.caburum.globalNavPage('New files', 'Special:NewFiles', {p: 'RC'}), window.caburum.globalNavPage('New pages', 'Special:NewPages', {p: 'RC'}), window.caburum.globalNavPage('New messages', 'Special:SocialActivity', {p: 'RC', r: 'containerTypes=WALL'}), window.caburum.globalNavPage('New comments', 'Special:SocialActivity', {p: 'RC', r: 'containerTypes=ARTICLE_COMMENT'}), /* Social */ window.caburum.globalNavLink('Forum', mw.config.get('wgScriptPath') + '/f', {m: false, p: false}), /* MediaWiki */ window.caburum.globalNavPage('MediaWiki', 'Special:AllPages/MediaWiki:', {m: 'MW'}), window.caburum.globalNavPage('Common CSS', 'MediaWiki:Common.css', {p: 'MW'}), window.caburum.globalNavPage('Wikia CSS', 'MediaWiki:Wikia.css', {p: 'MW'}), window.caburum.globalNavPage('Common JavaScript', 'MediaWiki:Common.js', {p: 'MW'}), window.caburum.globalNavPage('Wikia JavaScript', 'MediaWiki:Wikia.js', {p: 'MW'}), window.caburum.globalNavPage('ImportJS', 'MediaWiki:ImportJS', {p: 'MW'}), window.caburum.globalNavPage('Wiki navigation', 'MediaWiki:Wiki-navigation', {p: 'MW'}), /* Personal */ window.caburum.globalNavLink('ME', 'https://community.fandom.com/wiki/Special:MyPage', {m: 'ME'}), window.caburum.globalNavPage('Local JavaScript', 'Special:MyPage/common.js', {p: 'ME'}), window.caburum.globalNavPage('Local CSS', 'Special:MyPage/common.css', {p: 'ME'}), window.caburum.globalNavLink('Global JavaScript', 'https://community.fandom.com/wiki/Special:MyPage/global.js', {p: 'ME'}), window.caburum.globalNavLink('Global CSS', 'https://community.fandom.com/wiki/Special:MyPage/global.css', {p: 'ME'}), /* Wikis */ window.caburum.globalNavLink('WIKIS', 'https://caburum.fandom.com/wiki/User:Caburum/RecentChanges', {m: 'W'}), window.caburum.globalNavLink('Among Us Wiki', 'https://among-us.fandom.com/wiki/', {p: 'W'}), window.caburum.globalNavLink('Community Central', 'https://community.fandom.com/wiki/', {p: 'W'}), window.caburum.globalNavLink('Dev Wiki', 'https://dev.fandom.com/wiki/', {p: 'W'}), window.caburum.globalNavLink('Discord Wiki', 'https://discord.fandom.com/wiki/', {p: 'W'}), window.caburum.globalNavLink('Test Wiki', 'https://caburum.fandom.com/wiki/', {p: 'W'}), window.caburum.globalNavLink('Customize Your Wiki', 'https://custom.fandom.com/wiki/', {p: 'W'}) ];

if (/sysop|threadmoderator/.test(mw.config.get('wgUserGroups').join)) { window.globalNavButtons.push(				window.caburum.globalNavPage('Message deletion', 'Special:SocialActivity', {p: 'RC', r: 'deleted=true&containerTypes=WALL'}),				window.caburum.globalNavLink('Reported posts', mw.config.get('wgScriptPath') + '/f/reported', {p: 'RC'})			); }

if (mw.config.get('wgNamespaceIds').gadget) { window.globalNavButtons.push(				window.caburum.globalNavPage('Gadgets', 'Special:Gadgets', {p: 'MW'})			); }

importArticles({ // Imports			type: 'script',			articles: [				// Maintenance				'u:dev:MediaWiki:AjaxBatchDelete.js',				'u:dev:MediaWiki:AjaxRename/ucp.js',				'u:dev:MediaWiki:AjaxTemplate/code.js',				'u:dev:MediaWiki:FastDelete/code.js',				'u:dev:MediaWiki:Rollback/code.js',				'u:dev:MediaWiki:AnchoredRollback/code.js',				'u:dev:MediaWiki:ListFiles/code.js',				'u:dev:MediaWiki:MassNullEdit/code.js',

// Admin //'u:dev:MediaWiki:AjaxBlock/code.js', // Conflicts with MessageBlock 'u:dev:MediaWiki:MessageBlock/code.js', 'u:dev:MediaWiki:SOAPReport.js', 'u:dev:MediaWiki:WHAM/code.2.js',

// Tools 'u:dev:MediaWiki:QuickDiff/code.js', //'u:dev:MediaWiki:MultiUpload.js', 'u:dev:MediaWiki:UploadMultipleFiles.js', 'u:dev:MediaWiki:LastEdited/code.js', 'u:dev:MediaWiki:FastCreate.js', 'u:dev:MediaWiki:QuickPurge.js', 'u:dev:MediaWiki:CopyTitle.js',

// Personal 'u:dev:MediaWiki:DisplayTimer/code.js', 'u:dev:MediaWiki:AutoCreateUserPages.js', 'u:dev:MediaWiki:GlobalNavButtons.js',

// Social 'u:dev:MediaWiki:ViewNotificationsUsers.js', 'u:dev:MediaWiki:IgnoreNotifications.js', 'u:dev:MediaWiki:UserAndIPTools.js', 'u:dev:MediaWiki:UserAccountAge/code2.js',

// Editing //'u:dev:MediaWiki:DecodeURI/code.js', 'u:dev:MediaWiki:ImageMapEdit.js' ]		});		importScriptPage('User:Caburum/MassEdit.js', 'community');	},	log: function { // Formatted console.log		console.log.apply(null, Array.prototype.concat('%c[CABURUM]', 'color: #00D6D6; background-color: #202124;', Array.prototype.slice.call(arguments)));	},	globalNavPage: function(title, page, args) { // Creates a GlobalNavButtons object for an internal page		args = {			p: args.p || undefined,			r: args.r || undefined,			m: args.m || false		};		return {			text: title,			url: mw.util.getUrl(page) + (args.r ? '?' + args.r : ''),			isMain: args.m ? true : false,			whoIsMain: args.m ? false : args.p,			shortName: args.m ? args.m : title		};	},	globalNavLink: function(title, url, args) { // Creates a GlobalNavButtons object for an external link		args = {			p: args.p || undefined,			m: args.m || false		};		return {			text: title,			url: url,			isMain: args.m ? true : false,			whoIsMain: args.m ? false : args.p,			shortName: args.m ? args.m : title		};	}, };

$(window.caburum.init.bind(window.caburum));