User:Thisasia/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*Aims to be compatibility with {{CurrentStatus}}
 and also {{UserStatus}} and {{Statustop}} 
*/
//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 [[User:Thisasia/common.js|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=` <!--Online status. ❗Full Html/Css code, please don't vandalise thanks 🙏 |  Full  automated code at my [[User:|Thisasia/common.js]] --> 
<div style='display:none; color:green;font-size:20px;font-weight:bolder; Padding-top:15px; padding-bottom:10px;'>StatuS: <strong style='color:green;'text-decoration:underline;
text-decoration-style: wavy;text-decoration-thickness: 0.1px;>[[File:Green sunny circle 04.png|25px]]0nline</strong></div>`;

let offl=` <!--Offline status. ❗Full Html/Css code, please don't vandalise thanks 🙏 |  Full  automated code at my [[User:Thisasia/common.js]] --> 
<div style='display:none; color:red;font-size:20px;font-weight:bolder; Padding-top:15px; padding-bottom:10px;'>StatuS: <strong style='color:red;text-decoration:underline;
text-decoration-style: wavy;text-decoration-thickness: 0.1px;'>[[File:red sunny circle.png|25px]]0ffline</strong></div>`;

let sleep=` <!--Asleep status. ❗Full Html/Css code, please don't vandalise thanks 🙏 |  Full automated code at my [[User:Thisasia/common.js]] --> 
<div style='display:none; color:blue;font-size:20px;font-weight:bolder; Padding-top:15px; padding-bottom:10px;'>StatuS: <strong style='color:blue;text-decoration:underline;
text-decoration-style: wavy;text-decoration-thickness: 0.1px;'>[[File:blue sunny circle.png|25px]]Asleep</strong></div>`;

let busy=` <!--Busy status. ❗Full Html/Css code, please don't vandalise thanks 🙏 |  Full automated code at my [[User:Thisasia/common.js]] --> 
<div style='display:none; color:blue;font-size:20px;font-weight:bolder; Padding-top:15px; padding-bottom:10px;'>StatuS: <strong style='color:blue;text-decoration:underline;
text-decoration-style: wavy;text-decoration-thickness: 0.1px;'>[[File:blue sunny circle.png|25px]]Busy</strong></div>`;

/*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 = [ `<!--AutoStatusChanger4--> ${pagecontent}`,
        `<!--AutoStatusChanger1--> ${pagecontent}`, `<!--AutoStatusChanger2--> ${pagecontent}`,  `<!--AutoStatusChanger3--> ${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|}}}}}} 
|{{{3|{{{3|}}}}}} {{{4|{{{4|
<!--  ❗Container div❗-->  
{{User:Thisasia/Status2|2=''|star=yes}}
<div  style=' padding:10px>
<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;
'>
<!-- ❗Introduction message section-->
<div style='text-wrap:wrap;
display:block;
Text-align:center;
flex:50%;
font-size:27px;
font-weight:bolder;
Color:;
'>
[[User talk:Thisasia|<span style='color:blue; Font-style:italic; text-shadow:red; font-size:25px; letter-spacing: 1px;'>My</span>]] [[Wikipedia:Userboxes|User boxes.]] <br/>
<span onclick="onl()" style='color:; Font-style:italic; text-shadow:; font-size:16px; text-decoration:underline; text-decoration-color:green;'>Welcome to article page creator.</br> 
I'm only a volunteered contributor. </span>
</div>
<!-- ❗My User Boxes section-->
<div class="container" style="
font-family:Helvetica, Arial, sans-serif;
font-weight:;
font-size:auto;
padding:5px;
justify-content:center;
align-items:center;
display:grid;
grid-template-columns:repeat(2, 1fr);
grid-template-rows:repeat(4, 1fr);
flex-direction:column;
border:solid 2px greenyello;
height:250px;
width:100%;
column-gap:5px;
row-gap: 5px;
box-sizing: border-box;
Background:transpaent;
box-shadow:  0 0 8px 8px  #ffffff, 0 0 16px 16px rgba(0,0,0,0.16);
">
<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;'>
[[File:Flag of Thailand.svg|58px]] </div>
I participate in [[Wikipedia:WikiProject Thailand|WikiProject]] Thai. 
</div>
<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;'>
[[File:Asia (orthographic projection).svg|51px]] </div>
I participate in [[Wikipedia:WikiProject Asia|WikiProject]] Asia
</div>
<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;'>
[[File:Flag of the People's Republic of China.svg|50px]] </div>
I participate in [[Wikipedia:WikiProject China|Wiki-P China]]
</div>
<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;'>
[[File:세계 명화가 LG 스마트 TV 속으로.jpg|48px]] </div>
I participate in [[Wikipedia:WikiProject Television|WikiProject]] TV
</div>
<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;'>
[[File:Flag of South Korea.svg|50px]] </div>
I participate in [[Wikipedia:WikiProject Korea|Wiki-P Korea]]
</div>
<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;'>
[[File:Crystal personal.svg|40px]] </div>
&nbsp;  I participate in <br>[[Wikipedia:WikiProject Biography|WP Biography]] 
</div>
<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;'>
[[File:Flag of the Philippines.svg|44px]] </div>
I'm from the [[Philippines]]
</div>
<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;'>
[[File:Nuvola apps konsole.png|55px]] </div>
I do write few [[Computer program|Comp. program]]
</div></div> 
<!-- ❗Conflict of interest (COI) section-->
<div></div>
<!-- ❗Unified Korea box section-->
<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 </br>unified Korea&#128158;</span>
<div style='width:100%;
display:grid;
Align-items:center;
Justify-content:center;
Justify-items:center;
Align-content:center;
'>
[[File:Flag of South Korea.svg|75px]]
[[File:Korea Map.svg|55px]]
[[File:North Korea flag pin.svg|70px]]
</div>
</div>
<div style='display:none'>
{{User:Thisasia/Status2|2=''}}
</div>

==Wiki Projects==
<!-- ❗HTML table 1-->
<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);
'>[[:en:Draft:Li Ziting (Mimi Lee)|Li Ziting]] </td>
<td style='
box-shadow:  0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12);
'>[[:en:Draft:Taesan|Taesan]]</td>
<td style='
box-shadow:  0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12);
'>[[:en:Draft:Leehan|Leehan]]</td>
</tr>
<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);
'>[[:en:Wonwoo|Wonwoo]]</td>
<td style='
box-shadow:  0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12);
'>[[:en:Draft:Wang Yinglu|YingLu]]</td>
<td style='
box-shadow:  0 0 3.2px 3.2px  #ffffff, 0 0 4px 4px rgba(0,0,0,0.12);
Text-align:center;
'><small>empty</small></td>
</tr>
</table>
<!-- ❗HTML table END -->
</div></div>


==Templates I create==
*[[Template:Sdoc]]  
*[[Template:CurrentStatus]] 
*[[Template:CurrentStatus/style.css]]   

<!-- ❗HTML table END 2--><br> 
}}}}}} 
}} 
}}  `;	
} 
 //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/<skin>.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 );
		}
	}
});
}*/