User:Raz Mail/global.js

/*All codes are taken from UCP wiki :P*/ /* Raz Mail's Code from the Dev Fandom. */ /*THIS CODE IS TAKEN FROM COMMUNITY FANDOM. SOME ADDONS MAY OR MAY NOT WORK.*/ /*************** JAVASCRIPT ENHANCEMENTS - LAST UPDATED 5/08/2022 ***********************/ importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:BlogLink/code.js', // Adds links to user's blog, contribs, and activity.        'u:dev:MediaWiki:Discussions Delete All/code.js', // Button on Special:Contributions that will delete all Discussions posts        'u:dev:MediaWiki:DiscussionsViewer.js', // Button on Special:Contributions that lists all posts and replies by user in a modal        'u:dev:MediaWiki:DiscussionsActivity.js', // Creates a special page for latest Discussions messages        'u:dev:MediaWiki:ImprovedFooter/code.js', // Improves the design of the global Fandom footer (added a LOOOONG time ago, not sure if it does anything anymore)        'u:dev:MediaWiki:AdminDashboard block/code.js', // Adds a button with a link to list of blocked users in admin dashboard.        'u:dev:MediaWiki:PortableCSSPad/code.js', // self explanatory, css pad for testing 'u:dev:MediaWiki:AbuseLogRC.js', // Adds a table on Special:RecentChanges showing the last triggered anti-abuse filters. 'u:dev:MediaWiki:AddBlockUserTag/code.js', // Adds a button to the user profile masthead to block that user. /*       'u:dev:MediaWiki:YouShallNotPass/code.js',*/ // not used 'u:dev:MediaWiki:UserAccountAge/code2.js', // Appends user tag to profile masthead displaying the account's age 'u:dev:MediaWiki:DiscussionTemplates.js', // Allows users to send messages containing templates (i have no idea why this is here) 'u:dev:MediaWiki:CopyCodeButton.js', // Adds a button to syntax highlight blocks for quickly copying code. 'u:dev:MediaWiki:LakeLinks.js', // Hover popup with links for user pages. 'u:dev:MediaWiki:PortableListUsers.js', // Alternative to Special:ListUsers 'u:dev:MediaWiki:ProtectionIcons.js', // Adds icons based on the page's protection. 'u:dev:MediaWiki:AvatarLink.js', // Makes clicking your avatar go straight to your userpage. 'u:dev:MediaWiki:ClickyNavigation.js', // Forces you to click wiki navigation dropdowns to open them. 'u:dev:MediaWiki:CodeLinksDropdown.js', // Adds a dropdown link linking to personal code pages. 'u:dev:MediaWiki:DisableCode/code.js', // Allows user to disable personal and site JS/CSS for testing. 'u:dev:MediaWiki:QuickCreateUserPage/code.js', // Allows creation of user page with one click 'u:dev:MediaWiki:ToDoList.js', // To do list (requires page) 'u:dev:MediaWiki:ExternalLinkWarning.js', // warns when clicking external links 'u:dev:MediaWiki:AddArticleToCategory/code.js', // Adds an "Add Article to Category" menu. 'u:dev:MediaWiki:EditConflictAlert/code.js', // Displays a banner notification when the page you are editing gets modified. 'u:dev:MediaWiki:ProtectedHighlight/code.js', // Provides an environment ideal for reading 'u:dev:MediaWiki:ReaderMode/code.js', // Provides an environment ideal for reading 'u:dev:MediaWiki:Rollback/code.js', // Perform rollbacks without needing to be in the usergroup. 'u:dev:MediaWiki:WHAM/code.2.js', // Adds "Quick Tools" menu to user contribution page for cleanup functions. 'u:dev:MediaWiki:AnchoredRollback/code.js', // Allows you to make rollbacks without changing location. 'u:dev:MediaWiki:ListFiles/code.js', // Provides a form for querying the MediaWiki API and generating extensive lists of files and file data 'u:dev:MediaWiki:Nuke/code.js', // !! ONLY USE ON USER CONTRIBS !! Mass delete pages on recent changes or from a user's contributions akin to the extension. 'u:dev:MediaWiki:QuickLogs/code.js', // Displays user logs on Special:Contributions

] }); /*************** INACTIVE CODE - useless at the moment, section last edited 31/07/2022 /*WHAM* /*********************************** WHAM ************************************* window.WHAMBotMe = true; window.WHAMBotReason = "Mass reverting edits made by vandal (w:c:dev:WHAM)"; window.WHAMDeleteReason = "Deleting unneeded pages made by vandal"; window.WHAMBlockReason = "Violation of User Conduct: Vandalising (vandal)";

/*MASS CODES*/ importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:MassProtect/code.js',        'u:dev:MediaWiki:MassEdit/code.js',        'u:dev:MediaWiki:MassCategorization/code.js',        'u:dev:MediaWiki:MassUserRights/code.js',        'u:dev:MediaWiki:MassRenameRevert/code.js',        'u:dev:MediaWiki:MassPatrol/code.js',        'u:dev:MediaWiki:AjaxBatchDelete.js', // aka MassDelete        'u:dev:MediaWiki:MassRedirect/code.1.js',        'u:dev:MediaWiki:MassRename/code.js',        'u:dev:MediaWiki:MassRollback.js',       ] }); /*************************** inactive - useless at the moment (07/31/2022) /*MassBlock importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:FastBlock.js',    ] }); window.FastBlock = [ {       label: 'NSFW Raider', expiry: 'infinite', reason: 'Violation of User_Conduct: Raider - Posting NSFW content', autoblock: 1, nocreate: 1 },   {        label: 'ScLink', expiry: 'infinite', reason: 'Violation of User_Conduct: Raider - Posting scam links to scam other wiki users', autoblock: 1, nocreate: 1 },   {        label: 'AltAcc', expiry: 'infinite', reason: 'Violation of Rules and Guidelines: Alt account', autoblock: 1, nocreate: 1 },   {        label: 'Vand (Inf)', expiry: 'infinite', reason: 'Violation of User_Conduct: Vandalism', autoblock: 1, nocreate: 1 },   {        label: 'Raid', expiry: 'infinite', reason: 'Violation of User_Conduct: Raider', autoblock: 1, nocreate: 1 }, /*Only list wikis with the rules' name "Rules and Guidelines"*/ /* /*   {        label: 'LabelToBeDisplayed', expiry: 'ExpTime', autoblock: '1 if true, 0 if false', nocreate: '1 if true, 0 if false' },
 * This will be updated if needed, since idrk if I'll like it on every wiki
 * Example table

]; ****************************************************/

/*** i have absolutely no idea if this even works anymore ***/ /*Code down taken from Karasuneth, on Adopt Me! Wikia licensed under CC BY 3.0. Thanks :P*/ /* Fixes userpage redlinks to no longer open the editor for that page. */ mw.hook("wikipage.content").add(function($content) {   var links = $('#mw-content-text a.new');    links.each(function(index, element){ if (!$(element).attr('href')) { var title = $(element).attr('title'); if (title.startsWith('User:') && title.endsWith('(page does not exist)')) { title = title.slice(0, -22); var decodedURL = mw.util.getUrl(title); $(element).removeAttr('data-uncrawlable-url'); $(element).attr('href', decodedURL); }       }    }); }); /* Restores the post button to redirect to user's Discussions posts as it did on Legacy */ mw.loader.using('mediawiki.api', function {   'use strict';    var user = mw.config.get('wgRelevantUserName');    if ( window.DiscussionPLReady || !user ) return;   window.DiscussionPLReady = true;    var api = new mw.Api,        data, id;    api.get({ action: 'query', list: 'users', ususers: user }).then(function(d) { data = d.query.users; if (!data.length) return; id = data[0].userid; var interval = setInterval(function {           if ($('#userProfileApp .user-profile-navigation').length) {                clearInterval(interval);                var identity = $('.user-identity-stats a[href^="/wiki/Special:UserProfileActivity/'+user+'"]');                if (identity.length) {                    identity.each(function { $(this).attr('href', '/f/u/'+id); });               }            }        }, 1000);    }); });