User:Thisasia/minerva.js: Difference between revisions
Appearance
Content deleted Content added
No edit summary Tags: Mobile edit Mobile web edit Advanced mobile edit |
No edit summary Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
Line 119: | Line 119: | ||
let customEditSum = ""; |
let customEditSum = ""; |
||
statusChangerConfig.statusList.forEach(function(status) { |
|||
// Determine the custom edit summary based on the selected status |
// Determine the custom edit summary based on the selected status |
||
⚫ | |||
if (newStatus === onika && status.includes(onika)) { |
|||
customEditSum = onlinika + editSum; |
|||
⚫ | |||
⚫ | |||
customEditSum = thisasiaOfflinee + editSum; |
|||
} else if (newStatus === asika && status.includes(asika)) { |
|||
customEditSum = thisasiaAsleepp + editSum; |
|||
customEditSum = thisasiaAsleepp + editSum; |
|||
} else if (newStatus === busika && status.includes(busika)) { |
|||
customEditSum = thisasiaBusyy + editSum; |
|||
⚫ | |||
⚫ | |||
} |
|||
⚫ | |||
// edit with the custom edit summary |
// Perform the edit with the custom edit summary |
||
api.postWithEditToken({ |
api.postWithEditToken({ |
||
action: ('edit'), |
action: ('edit'), |
||
title: statusChangerConfig.statusPage, |
title: statusChangerConfig.statusPage, |
||
text: newStatus, |
text: newStatus, |
||
summary: customEditSum |
summary: customEditSum || editSum |
||
//(newStatus==onika)? +'':onlinika+editSum, |
//(newStatus==onika)? +'':onlinika+editSum, |
||
Revision as of 01:31, 8 May 2024
Thisasia();
//asia();
function Thisasia(){
let pageconta=`{{DISPLAYTITLE:<span style='
Background:transpaent;
Font-weight:bolder;
Font-size:16px;
Font-style:italic;
box-shadow: 0 0 5px 5px #ffffff, 0 0 10px 10px rgba(0,0,0,0.16);
padding:1.5px;
border-radius:6px;
margin-left:6px;
padding:2px;
'>{{FULLPAGENAME}}</span>}}`;
let editSum=`This Status edit was automatically done using [[User:Thisasia/common.js|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=`<!--0nline status -->{{#if:{{{1|{{{sub|}}}}}}| {{{1|{{{sub|}}}}}}}} {{#if: {{{2|{{{su<includeonly>|</includeonly>}}}}}} {{{3}}}
|<div style='margin-top:-20px; margin-bottom :-6px; padding-left:5px; 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.3px;><span class='ani'> <span class='ani2'>[[File:Green sunny circle 04.png|25px]]</span><span class='ani3'></span></span>0nline</strong></div>
|{{PAGENAMEBASE}}}} {{{2|<div style=' font-style:italic; margin:0; padding-left:15px;'>This is my user[[Wikipedia:User pages| Subpage]] please leave your message on my main page [[User talk:Thisasia| @User talk Thisasia]] Thanks </div>}}}
{{#if:{{{star|}}} |{{{st|<div style='
margin-bottom:30px;
margin-top:-11px;
padding-left:12px;
font-style:italic;'>
<span style='padding:5px;
box-shadow: 0 0 7px 7px #ffffff,
0 0 11px 11px rgba(0,0,0,0.16);'>
<span class='an' style='height:30px;width:30px;'>[[File:Green star.svg]] </span> Full page content [[User:Thisasia/common.js|@ my skin js]]
</span>
</div>}}} }}
<templatestyles src="Template:CurrentStatus/style.css" />`;
let ofika=`<!-- Offline status --> {{#if:{{{1|{{{sub|}}}}}}| {{{1|{{{sub|}}}}}}}} {{#if: {{{2|{{{su<includeonly>|</includeonly>}}}}}} {{{3}}}
|<div style='margin-top:-20px; margin-bottom :-6px; padding-left:5px; 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.3px;>[[File:Red sunny circle.png|26px]]0ffline</strong></div>
|{{PAGENAMEBASE}}}} {{{2|<div style=' font-style:italic; margin:0; padding-left:15px;color:darkred'>This [[Wikipedia:User pages|Wikipedian]] is unavailable at the moment please leave your message on my main page [[User talk:Thisasia| @User talk Thisasia]] Thanks</div>}}}
{{#if:{{{star|}}} |{{{st|<div style='
margin-bottom:30px;
margin-top:-11px;
padding-left:12px;
font-style:italic;'>
<span style='padding:5px;
box-shadow: 0 0 7px 7px #ffffff,
0 0 11px 11px rgba(0,0,0,0.16);'>
<span class='an' style='height:30px;width:30px;'>[[File:Red star.svg]] </span> Full page content [[User:Thisasia/common.js|@ my skin js]]
</span>
</div>}}} }}
<templatestyles src="Template:CurrentStatus/style.css" />`;
let asika=`<!--Asleep --> {{#if:{{{1|{{{sub|}}}}}}| {{{1|{{{sub|}}}}}}}} {{#if: {{{2|{{{su<includeonly>|</includeonly>}}}}}} {{{3}}}
|<div style='margin-top:-20px; margin-bottom :-6px; padding-left:5px; 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.3px;><span class='ani'> <span class='ani2'>[[File:Blue sunny circle.png|25px]]</span><span class='ani3'></span></span>Asleep</strong></div>
|{{PAGENAMEBASE}}}} {{{2|<div style=' font-style:italic; margin:0; padding-left:15px;'>welcome to my user [[Wikipedia:User pages| Subpage]], This user is currently asleep, please leave your message on my main page [[User talk:Thisasia| @User talk Thisasia]] Thanks</div>}}}
{{#if:{{{star|}}} |{{{st|<div style='
margin-bottom:30px;
margin-top:-11px;
padding-left:12px;
font-style:italic;'>
<span style='padding:5px;
box-shadow: 0 0 7px 7px #ffffff,
0 0 11px 11px rgba(0,0,0,0.16);'>
<span class='an' style='height:30px;width:30px;'>[[File:Blue star.svg]] </span> Full page content [[User:Thisasia/common.js|@ my skin js]]
</span>
</div>}}} }}
<templatestyles src="Template:CurrentStatus/style.css" />`;
let busika=`<!--Busy Status --> {{#if:{{{1|{{{sub|}}}}}}| {{{1|{{{sub|}}}}}}}} {{#if: {{{2|{{{su<includeonly>|</includeonly>}}}}}} {{{3}}}
|<div style='margin-top:-20px; margin-bottom :-6px; padding-left:5px; 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.3px;><span class='ani'> <span class='ani2'>[[File:Blue sunny circle.png|25px]]</span><span class='ani3'></span></span>Busy</strong></div>
|{{PAGENAMEBASE}}}} {{{2|<div style=' font-style:italic; margin:0; padding-left:15px;'>This is my user [[Wikipedia:User pages| Subpage]] please leave your message on my main page [[User talk:Thisasia| @User talk Thisasia]] Thanks</div>}}}
{{#if:{{{star|}}} |{{{st|<div style='
margin-bottom:30px;
margin-top:-11px;
padding-left:12px;
font-style:italic;'>
<span style='padding:5px;
box-shadow: 0 0 7px 7px #ffffff,
0 0 11px 11px rgba(0,0,0,0.16);'>
<span class='an' style='height:30px;width:30px;'>[[File:Blue star.svg]] </span> Full page content [[User:Thisasia/common.js|@ my skin js]]
</span>
</div>}}} }}
<templatestyles src="Template:CurrentStatus/style.css" />`;
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]]' } }
});
let customEditSum = "";
statusChangerConfig.statusList.forEach(function(status) {
// Determine the custom edit summary based on the selected status
if (newStatus === onika && status.includes(onika)) {
customEditSum = onlinika + editSum;
} else if (newStatus === ofika && status.includes(ofika)) {
customEditSum = thisasiaOfflinee + editSum;
} else if (newStatus === asika && status.includes(asika)) {
customEditSum = thisasiaAsleepp + editSum;
} else if (newStatus === busika && status.includes(busika)) {
customEditSum = thisasiaBusyy + editSum;
}
});
// Perform the edit with the custom edit summary
api.postWithEditToken({
action: ('edit'),
title: statusChangerConfig.statusPage,
text: newStatus,
summary: customEditSum || 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';
});*/