User:Pppery/global.js: Difference between revisions
Appearance
From Meta, a Wikimedia project coordination wiki
No edit summary
No edit summary
Line 13:
Line 13:
mw.loader.load("https://en.wikipedia.org/w/load.php?modules=ext.gadget.purgetab");
mw.loader.load("https://en.wikipedia.org/w/load.php?modules=ext.gadget.purgetab");
} else {
} else {
mw.loader.using('ext.gadget.purgetab')
mw.loader.using('ext.gadget.purgetab')(追記) ; (追記ここまで)
}
}
}
}
Line 25:
Line 25:
// no leading zeroes. (example: 9 - correct, 09 - incorrect)
// no leading zeroes. (example: 9 - correct, 09 - incorrect)
var date = { year: (削除) 2024 (削除ここまで), month: (削除) 12 (削除ここまで), day: (削除) 25 (削除ここまで)};
var date = { year: (追記) 2025 (追記ここまで), month: (追記) 1 (追記ここまで), day: (追記) 10 (追記ここまで)};
var time = { hours: 2, minutes: 0, seconds: 0 };
var time = { hours: 2, minutes: 0, seconds: 0 };
Line 33:
Line 33:
var enforcedBreakEnd = new Date(
var enforcedBreakEnd = new Date(
date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds);
date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds);
if (currentDate <= enforcedBreakEnd)
if (currentDate <= enforcedBreakEnd(追記) && mw.config.get("wgDBname") == "enwiki" (追記ここまで))
{
{
if(!confirm("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString()
if(!confirm("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString()
Revision as of 05:08, 1 January 2025
$(function(){ setTimeout(function(){ //save, not publish varsave=$("#wpSave"); if(save&&save.length){ save.attr("value",save.attr("value").replace("Publish","Save")); } },500); }); mw.loader.load("https://en.wikipedia.org/w/index.php?action=raw&title=User:Pppery/no-ooui-contribs.js&ctype=text/javascript"); if(mw.config.get("wgDBname")!=="enwiki"){ if(mw.loader.getState('ext.gadget.purgetab')===null){ mw.loader.load("https://en.wikipedia.org/w/load.php?modules=ext.gadget.purgetab"); }else{ mw.loader.using('ext.gadget.purgetab'); } } /*** BEGIN WIKIBREAK ENFORCER ***/ $(document).ready(function() { /*** Start editing here ***/ // When you want to end your break? // no leading zeroes. (example: 9 - correct, 09 - incorrect) vardate={year:2025,month:1,day:10}; vartime={hours:2,minutes:0,seconds:0}; /*** Stop editing here ***/ varcurrentDate=newDate(); varenforcedBreakEnd=newDate( date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds); if(currentDate<=enforcedBreakEnd&&mw.config.get("wgDBname")=="enwiki") { if(!confirm("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString() +"\n(now is "+currentDate.toLocaleString()+")\n\nBye!")){ return; } mw.loader.using(["mediawiki.api","mediawiki.user"]).then(function() { newmw.Api().post( { action:'logout', token:mw.user.tokens.get('csrfToken') }) }); } }); /*** END WIKIBREAK ENFORCER ***/