User:Thisasia/minerva.js

Thisasia; //asia; function Thisasia{ let pageconta=``;

let editSum=`This Status edit was automatically done using Thisasia/common.js`; let onlinika='(Thisasia-Online-StatuS):'; let thisasiaOfflinee='(Thisasia-OfflinE-StatuS):'; let thisasiaBusyy='(Thisasia-BusY-StatuS):'; let thisasiaAsleepp='(Thisasia-AsleeP-StatuS):';

let onika=`

`;

let ofika=`

`;

let asika=`

`;

let busika=`

`;

let co1=document.getElementById('co1');

$.when(   $.ready,    mw.loader.using( [ "mediawiki.api" ] ) ).then( function myfun {

if (typeof(statusChangerConfig) == 'undefined') { statusChangerConfig = {};

}

if (typeof(statusChangerConfig.statusList) == 'undefined') { statusChangerConfig.statusList = [ `${onika} ${pageconta}`, `${ofika} ${pageconta}`, `${asika} ${pageconta}`, `${busika} ${pageconta}`]; }     if (typeof(statusChangerConfig.statusPage) == 'undefined') { //	statusChangerConfig.statusPage = co1; statusChangerConfig.statusPage = 'User:' + mw.config.get('wgUserName')+'/Status2'; }   function makeListener(newStatus) { return function ( evt ) { evt.preventDefault; var api = new mw.Api({               ajax: { headers: { 'Api-User-Agent': 'w:User:Thisasia/common.js' } }            }); api.postWithEditToken({             action: ('edit'),                title: statusChangerConfig.statusPage,                text: newStatus,                summary: (newStatus === onika) ? onlinika + editSum:                     (newStatus === ofika) ? thisasiaOfflinee + editSum:                     (newStatus === asika) ? thisasiaAsleepp + editSum:                     (newStatus === busika) ? thisasiaBusyy + editSum : editSum

//(newStatus==onika)? +'':onlinika+editSum,

}).then(function { api.post( { action: "purge", titles: 'User:' + mw.config.get('wgUserName')}); mw.notify('Done setting status!'); //summary= (newStatus===onl)? +'':thisasiaOnline +editSummary ; });           return;    };    }    for (var i=0; i<statusChangerConfig.statusList.length; i++) {        var stat = statusChangerConfig.statusList[i];        var message = (stat === "sleeping") ?  link = "asleep" : link = stat;        mw.util.addPortletLink( "p-personal", //target tab - personal links "#",           stat, //link text "pt-status-" + stat, //id of new button "I'm " + message + "!", //hover text "", // access key - no need to define one document.getElementById("pt-logout")) //add before logout button       .addEventListener('click',makeListener(stat));    } }); }

/*/ $(function gg{ let co1=document.getElementById('co1'); let co2=document.getElementById('co2'); let co3=document.getElementById('co3'); co1.addEventListener('click',=>{ co3.style.display='block'; co2.style.display='block'; }); co2.addEventListener('click',=>{ co3.style.display='none'; co2.style.display='none'; }); }); /*/ //let co1=document.getElementById('co1'); //let co2=document.getElementById('co2');

/*       if (navigator.onLine){ 'User:' +mw.config.get('wgUserName') +'/sandbox/sandbox2'+'online';

} 	window.addEventListener('online', =>{ 'User:' +mw.config.get('wgUserName') +'/sandbox/sandbox2' +'online';

});	window.addEventListener('offline', =>{ 'User:' +mw.config.get('wgUserName') +'/sandbox/sandbox2'+'offline';

});*/