User:KockaAdmiralac/global.js

/** * Prevent users other than me from loading this (for their own safety). * @see w:User:KockaAdmiralac/Accounts * */ if (![    'KockaAdmiralac',    'Pera Pisar',    'KockaBot',    'MTT News Reporter',    'KockaLogger',    '"WhatHappensWhenYourUsernameHasQuotesInIt?"',    'КоцкаАдмиралац',    'Kocka but he\'s blocked',    '௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵௵' ].includes(mw.config.get('wgUserName'))) { throw new Error('Sorry, you\'re not a cube!'); }

/** * Script configuration. */ $.extend(window, {   // AjaxBatchDelete    batchDeleteDelay: 10,    // AjaxBlock    AjaxBlock: {        blockReasons: {            'Vandalism': 'Vandalism',            'Spam': 'Spam',            'Terms of Use violation': 'ToU',            'Abusing multiple accounts': 'Sock',            'Intimidating behavior/harassment': 'Harassment',            'Unacceptable username': 'Username',            'Creating unnecessary pages': 'Pages',            'Flooding comments/threads': 'Flood',            'Uploading unnecessary images': 'Images'        }    },    // AjaxDelete    AjaxDelete: {        deleteReasons: {            'Housekeeping': 'I\'m too lazy to find a valid reason lol',            'Help:Vandalism': 'Vandalism',            'Help:Spam': 'Spam',            'Marked for deletion': '',            'Copyright violation': 'Copyright violation', 'Author request': 'Author request', 'Unused': 'Unused', 'Policy violation': 'Policy violation' },       imageDeleteReasons: { 'Housekeeping': 'I\'m too lazy to find a valid reason lol', 'Help:Vandalism': 'Vandalism', 'Help:Spam': 'Spam', 'Marked for deletion': '', 'Unused': 'Unused', 'Bad quality': 'Quality', 'Duplicated/superseded file': 'Duplicate', 'Fanmade content': 'Fanmade content', 'Unrelated to the wiki topic': 'Unrelated' },       autoCheckWatch: false, reload: true, noOther: true },   // AjaxRC ajaxSpecialPages: ['Log', 'Newwikis', 'AbuseLog'], // AjaxUndo AjaxUndoPrompt: true, // AutoCreateUserPages AutoCreateUserPagesConfig: { content: '', summary: 'Not here' },   // CacheCheck CacheCheckRemove: true, topLevelCat: 'Browse', // CustomizeAce aceCustomSettings: { navigateWithinSoftTabs: true, theme: 'tomorrow_night', useSoftTabs: true },   // DiscussionTemplates DiscussionTemplates: { templates: { 'warning': { name: 'User:KockaAdmiralac/DiscussionsTemplates/Guidelines', title: 'Discussions guidelines', parameters: { type: 'Type of content that was in violation', action: 'Action taken', rules: 'Rules that have been broken' }           }        }    },    // LastEdited lastEdited: { diffModal: false },   // MassBlock massBlockDelay: 10, // MassProtect massProtectDelay: 10, // PageCreator pageCreatorAvatar: true, pageCreatorTimestamp: true, // Rollback Rollback: { confirm: true },   // ShowHide ShowHideDisplayWarning: true, // TokenRefresh TokenRefreshInterval: 600000 });

// List of scripts to import. var scripts = [ // Dev Wiki {       prefix: 'u:dev:MediaWiki:', scripts: { 'AjaxBatchDelete': ['content-moderator', 'sysop'], 'AjaxBlock/code': ['sysop'], 'AjaxDelete/code': ['content-moderator', 'sysop'], 'AjaxRC': ['*'], 'AjaxUndo/code': ['*'], 'AllPagesHideRedirect/code': ['*'], 'AnchoredRollback/code': ['*'], 'AutoCreateUserPages': ['*'], 'CacheCheck/code': ['*'], 'CodeSelectAll': ['*'], 'CompareLink': ['*'], 'CustomizeAce': ['*'], 'DiscussionTemplates': ['sysop'], 'DiscussionsViewer': ['*'], 'DoruDev': ['*'], 'EditConflictAlert/code': ['*'], 'FastFileDelete': ['*'], 'LastEdited/code': ['*'], 'MassCategorization/code': ['sysop'], 'MassNullEdit/code': ['*'], 'MassProtect/code': ['content-moderator', 'sysop'], 'MastheadGender/code': ['*'], 'NullEditButton/code': ['*'], 'PageCreator/code2': ['*'], 'PortableListUsers': ['*'], 'QuickDiff/code': ['*'], 'QuickLogs/code': ['*'], 'RedirectManagement/code': ['*'], 'Rollback/code': ['*'], 'TokenRefresh': ['*'], 'UserAccountAge/code2': ['*'], 'SOAPReport': ['*'], 'WHAM/code.2': ['content-moderator', 'sysop'], 'YouTubeModal/code': ['*'] }   },    // Kocka Wiki (doesn't suck in naming scheme) {       prefix: 'u:kocka:MediaWiki:', scripts: { 'Minimalism/Diffs': ['*'], 'Minimalism/Files': ['*'], 'Minimalism/Masthead': ['*'] }   },    // Kocka Wiki (personal) {       prefix: 'u:kocka:User:KockaAdmiralac/', scripts: { 'EmptyDeleteReason': ['*'], 'Keybinds': ['*'], 'LinkModifications': ['*'], 'UnhideLinks': ['*'] }   } ];

(function {   // Conditional imports system.    var groupCache = new Set(mw.config.get('wgUserGroups'));    importArticles({ articles: scripts.map(function(source) {           var suffix = source.suffix || '.js';            return $.map(source.scripts, function(v, k) { if (v.some(function(group) { return groupCache.has(group); })) {                   return source.prefix + k + suffix; }           });        }).flat }); }); //