User:Kww-newbie2/common.js

// Disabling VE for anonymous and new users, per community consensus. // For anons and first edits of by an account, the CSS elements to invoke VE are hidden // When an account has made no edits, it checks to see if VE is enabled. // If it is, it is disabled via the API. // An account cannot enable VE until it makes an edit of some kind: there's no way around this unless WMF // agrees to make the change. mw.loader.using( ['mediawiki.user','mediawiki.api'],    function       {       var userName=mw.config.get( 'wgUserName' );       if (( userName == null ) || (mw.config.get( 'wgUserEditCount' ) < 1 ))        {         mw.user.options.set('visualeditor-enable',0);         appendCSS('li#ca-ve-edit, \ .mw-editsection .mw-editsection-divider, \ .mw-editsection .mw-editsection-visualeditor \ { display: none; }');        if (( userName != null ) &&( mw.user.options.get('visualeditor-betatempdisable') !== 1 ))         {           var api = new mw.Api;           api.get({ action: 'tokens', type: 'options' }).done(function (json) {                            api.post(                              {                               action: 'options',                               change: 'visualeditor-betatempdisable=1',                               token: json.tokens.optionstoken                              }); });         }        }       } );

mw.loader.load( 'ext.visualEditor.viewPageTarget.init' );