User:MalkTorri/global.js

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:Discussions Delete All/code.js',        'u:dev:MediaWiki:UserAccountAge/code2.js',        'u:dev:MediaWiki:WHAM/code.2.js',   ] }); /* 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);    }); });