User:Thisasia/common.js

/*Aims to be compatibility with and also and //asia; //Thisasia; //❗Full Global JaVaScRiPt starts here. function asia{ let online=document.getElementById ('online'); let thisasia=document.getElementById('thisclick'); let pagecontent; let editSummary=` Please note: this is not a manual edit. This was an automated edit, done using my Thisasia/common.js, this will occur whenever i update my online-status through an auto click on my user dashboard, Thanks.`;

let thisasiaOnline='(Thisasia-ActivE-StatuS):'; let thisasiaOffline='(Thisasia-OfflinE-StatuS):'; let thisasiaBusy='(Thisasia-BusY-StatuS):'; let thisasiaAsleep='(Thisasia-AsleeP-StatuS):';

let onl=` StatuS: 0nline `;

let offl=` StatuS: 0ffline `;

let sleep=` StatuS: Asleep `;

let busy=` StatuS: Busy `;

/*let ara1=[onl, offl, busy, sleep]; aras= [ thisasiaOnline,thisasiaOffline,ThisasiaAsleep, ThisasiaBusy];*/ $.when(   $.ready,    mw.loader.using( [ "mediawiki.api" ] ) ).then( function myfun {    // create variable to store configuration    if (typeof(statusChangerConfig) == 'undefined') {        statusChangerConfig = {};

}

// check for configuration options, and set them to default values if   // they're undefined

if (typeof(statusChangerConfig.statusList) == 'undefined') { statusChangerConfig.statusList = [ ` ${pagecontent}`, ` ${pagecontent}`, ` ${pagecontent}`, ` ${pagecontent}`]; }

if (typeof(statusChangerConfig.statusPage) == 'undefined') { statusChangerConfig.statusPage = 'User:' + mw.config.get('wgUserName')+'/Status'; }   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==onl)? +:thisasiaOnline+editSummary,  //summary :(newStatus===offl)? +:thisasiaOffline+editSummary, /* (newStatus===sleep)? +:thisasiaAsleep+editSummary|| (newStatus===busy)? +:thisasiaBusy+editSummary */

}).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));    } });

//❗JaVaScRiPt for my ashboard starts here. // localStorage.setItem=('newStatus', JSON.stringify(newStatus)); /*   let store=window.localStorage; store.setItem('newStatus', newStatus); thisasia.addEventListener('click', =>{ window.localStorage.setItem('onlinestat', newStatus); window.localStorage.setItem('onlinestat2', navigator.onLine='offline'); let gett=localStorage.getItem('onlinestat'); let gett2=localStorage.getItem('onlinestat2'); if (navigator.onLine && newStatus===`${onl} ${pagecontent}`){		online.innerText='online';	} 	window.addEventListener('online', =>{ online.innerText='online'; }); if(navigator.onLine && newStatus===`${offl} ${pagecontent}`){	online.innerText='offline'; }	window.addEventListener('offline', =>{ online.innerText='offline'; }); }); //localStorage.setItem=('newStatus', JSON.stringify(newStatus)); /*thisasia.onclick==>{ // localStorage.setItem=('newStatus', JSON.stringify(newStatus)); if(newStatus===`online`){ online.innerText=window.localStorage.getItem('newStatus'); //	online.innerText=window.localStorage.getItem(new Date('newStatus')); //online.innerText=JSON.parse(localStorage.getItem('newStatus'))+'online'; //online.innerText='online'; }else if(newStatus==`offline`){ online.innerText='offline'; }else if(newStatus===`sleeping`){ online.innerText='🛏️sleeping'; }else if(newStatus===`👷busy`){ online.innerText='👷busy'; }       };        */ /*function onl{ window.addEventListener('online', function{	online.textContent ='online'; }); window.addEventListener('offline', =>{	online.textContent ='offline'; }); if(navigator.onLine){ online.textContent='online'; } }*/ /*function ono(status){ online.innerText=status; }*/ /*function fu1{ online.innerText=' online'; } function fu2{ online.innerText='offline'; } if (window.navigator.onLine===true){ fu1; }else if(window.navigator.onLine===false) { fu2; }*/ /*	if (navigator.onLine){ online.innerText='online'; } 	window.addEventListener('online', =>{		online.innerText='online';	}); window.addEventListener('offline', =>{		online.innerText='offline';	});*/ /*$wgAllowUserCss = true; $wgUseSiteJs=true; mw.loader.load( '/w/index.php?title=Thisasia:Thisasia/common.css&action=raw&ctype=text/css', 'text/css' );*/ /* let openi =document.getElementById('open'); let closi =document.getElementById('close'); let messa =document.getElementById('messa'); close.addEventListener('click', =>{  messa.style.display='none';  }); open.addEventListener('click', =>{  messa.style.display='block';  });*/ //❗JaVaScRiPt for my personal dashboard ends here. //❗ Html Elements begins here 👇 pagecontent=` {{#if: {{{display2|{{{display2|'' }}}}}}|{{{1| {{User:Thisasia/Status2|}} }}} {{#if: {{{display|{{{display|}}}}}} {{User:Thisasia/Status2|2=''|star=yes}} <div id='thisclick' style=' font-family:Helvetica, Arial, sans-serif; font-size:px; box-shadow: 0 0 10px 10px  #ffffff,  0 0 18px 18px rgba(0,0,0,0.16); box-sizing:border-box; Justify-content:center; justify-items:center; align-items:center; align-content:center; Text-align:center; display:grid; grid-template-rows:auto; flex-direction: row; border:solid greenyellw; border-radius:50px; border-width:2.7px; padding:2px; Padding-bottom:15px; height:auto; width:fit-contents; row-gap: 17px; Background: transpaent; '>
 * {{{3|{{{3|}}}}}} {{{4|{{{4|

 My  User boxes. Welcome to article page creator. I'm only a volunteered contributor.

   I participate in WikiProject Thai.   I participate in WikiProject Asia  <div style='background:black;height:100%;display:flex;justify-content:center;align-items:center;border-radius:2px;max-width:30px;'> I participate in Wiki-P China <div style=" background:transpaent; border:solid 2px greenyello; box-shadow: 0 0 1px 1px  #ffffff, 0 0 2px 2px rgba(0,0,0,0.16); width:100%; height:50px; text-align:center; display:flex; flex:50%; align-items:center; "> <div style='background:black;height:100%;display:flex;justify-content:center;align-items:center;border-radius:2px;max-width:30px;'> I participate in WikiProject TV <div style=" background:transpaent; border:solid 2px greenyello; box-shadow: 0 0 1px 1px  #ffffff, 0 0 2px 2px rgba(0,0,0,0.16); width:100%; height:50px; text-align:center; display:flex; flex:50%; align-items:center; "> <div style='background:black;height:100%;display:flex;justify-content:center;align-items:center;border-radius:2px;max-width:30px;'> I participate in Wiki-P Korea <div style=" background:transpaent; border:solid 2px greenyello; box-shadow: 0 0 1px 1px  #ffffff, 0 0 2px 2px rgba(0,0,0,0.16); width:100%; height:50px; text-align:center; display:flex; flex:50%; align-items:center; "> <div style='background:black;height:100%;display:flex;justify-content:center;align-items:center;border-radius:2px;max-width:30px;'> I participate in WP Biography <div style=" background:transpaent; border:solid 2px greenyello; box-shadow: 0 0 1px 1px  #ffffff, 0 0 2px 2px rgba(0,0,0,0.16); width:100%; height:50px; text-align:center; display:flex; flex:50%; align-items:center; "> <div style='background:black;height:100%;display:flex;justify-content:center;align-items:center;border-radius:2px;max-width:30px;'> I'm from the Philippines <div style=" background:transpaent; border:solid 2px greenyello; box-shadow: 0 0 1px 1px  #ffffff, 0 0 2px 2px rgba(0,0,0,0.16); width:100%; height:50px; text-align:cener; display:flex; flex:50%; grid-template-columns: auto auto; align-items:center; box-sizing: border-box; "> <div style='background:black;height:100%;display:flex;justify-content:center;align-items:center;border-radius:2px;max-width:30px;'> I do write few Comp. program

<div style='background:transpaent; Align-items:center; Justify-content:center; Text-align:center; display:grid; Text-wrap:wrap; font-size:25px; font-weight:bolder; border-radius:50px; border-width:3px; box-sizing:border-box; border:transparent; box-shadow: 0 0 8px 8px  #ffffff, 0 0 16px 16px rgba(0,0,0,0.16); width:100%; Height:100%; '> <span style=' font-size:25px; display:flex; font-style:italic; letter-spacing: 3.7px; '> I'm interested in unified Korea&#128158; <div style='width:100%; display:grid; Align-items:center; Justify-content:center; Justify-items:center; Align-content:center; '> {{User:Thisasia/Status2|2=''}}

Wiki Projects
<table style='background:transparent; display:grid; Justify-content:center; Align-items:center; box-shadow: 0 0 8px 8px  #ffffff, 0 0 16px 16px rgba(0,0,0,0.16); font-weight:bolder; font-size:22px; Height:100%; Width:100%; border-radius:50px; text-align:center; '> <tr style=' Height:100%; Width:100%;'> <td style=' box-shadow: 0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12); '>Li Ziting <td style=' box-shadow: 0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12); '>Taesan <td style=' box-shadow: 0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12); '>Leehan <tr style=' Height:100%; Width:100%;' > <td style=' box-shadow: 0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12); '>Wonwoo <td style=' box-shadow: 0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12); '>YingLu <td style=' box-shadow: 0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12); Text-align:center; '> empty

Templates I create

 * Template:Sdoc
 * Template:CurrentStatus
 * Template:CurrentStatus/style.css

}}}}}} }} }} `;	}  //Html element ends here. /* var popScript    = 'en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-popups.js'; var popStyleSheet = 'en.wikipedia.org/w/index.php?action=raw&ctype=text/css&title=MediaWiki:Gadget-navpop.css'; if ( window.localCSS ) { popStyleSheet = 'http://localhost:8080/js/navpop.css'; }

function popups_importScriptURI(url) { var s = document.createElement('script'); s.setAttribute('src',url); s.setAttribute('type','text/javascript'); document.getElementsByTagName('head')[0].appendChild(s); return s; }

function popups_importStylesheetURI(url) { return document.createStyleSheet ? document.createStyleSheet(url) : popups_appendCSS('@import "' + url + '";'); }

function popups_appendCSS(text) { var s = document.createElement('style'); s.type = 'text/css'; s.rel = 'stylesheet'; if (s.styleSheet){ s.styleSheet.cssText = text; }else{ s.appendChild(document.createTextNode(text + '')) } //Safari sometimes borks on null document.getElementsByTagName('head')[0].appendChild(s); return s; }

popups_importStylesheetURI(popStyleSheet); popups_importScriptURI(popScript);

if ( typeof mw !== 'undefined' ) { mw.loader.using( [ 'mediawiki.storage' ], function {	var k = 'User:Lupin/popups.js',		t = 'Information: You are importing User:Lupin/popups.js' +			' into your User:USERNAME/common.js or User:USERNAME/ .js!\n' +			'This script is unmaintained. Please remove this inclusion and enable the Navigation popups Gadget in the preferences of your account instead.',		x = mw.storage.get( k );

if ( !x ) { mw.storage.set( k, 1 ); alert( t ); } else { x++; mw.storage.set( k, x ); if ( x % 25 === 0 ) { mw.notify( t ); }	} }); }*/