User:ASMCHK/common.js

/** * ChangeModelButton.js * @author MonkeysHK  * @license CC-BY-SA 3.0 */ (function {   var config = mw.config.get([ 'wgCanonicalSpecialPageName', 'wgPageName', 'wgUserGroups', ]);

if (       config.wgCanonicalSpecialPageName ||        window.ChangeModelButtonLoaded ||        !/sysop|vanguard|content-volunteer|soap|helper|wiki-specialist|wiki-representative|staff/.test(config.wgUserGroups.join('\n'))    ) { return; }

window.ChangeModelButtonLoaded = true;

function getLink { return '/wiki/Special:ChangeContentModel?pagetitle=' + config.wgPageName; }

function init { $('.page-header__contribution-buttons .wds-list, .page-header__actions .wds-list').first.append(           $('').append( $('', {                   css: {                        cursor: 'pointer'                    },                    text: 'Ch\'ge Model',                    href: getLink,                }) )       );    }

init;

});