MediaWiki:FixCascadingProtectionEditButton.js

mw.hook('dev.wds').add(function (wds) {   if (window.FixCascadingProtectionEditButtonLoaded) {        return;    }    window.FixCascadingProtectionEditButtonLoaded = true;    new mw.Api.get({ action: 'query', prop: 'info', inprop: 'protection', titles: mw.config.get('wgPageName'), format: 'json' }).done(function (d) { if (d.query.pages[mw.config.get('wgArticleId')].protection[0] && d.query.pages[mw.config.get('wgArticleId')].protection[0].source) { new mw.Api.get({               action: 'query',                meta: 'userinfo|allmessages',                uiprop: 'rights',                ammessages: 'edit',                format: 'json'            }).done(function (d_) {                if (d_.query.userinfo.rights.includes('protect') || d_.query.userinfo.rights.includes('autoconfirmed')) {                    $('#ca-edit').html(wds.icon('pencil-small').outerHTML + '  ' + d_.query.allmessages[0]["*"]);                }            }); }   }); }); importArticle({    type: 'script',    article: 'u:dev:MediaWiki:WDSIcons/code.js' });