User:ais523/wikibreakenforcer.js
// User:ais523/wikibreakenforcer.js
// An 'improved' version of Wikipedia:WikiProject User scripts/Scripts/WikiBreak Enforcer
// Can enforce semiwikibreaks (with limited editing allowed) as well as 'true' wikibreaks
// Note that this will only work perfectly if you always use the same user/browser/computer
// combination.
// Thanks to User:HG for the idea.
// Before including this script, set the following variables:
// wbeEditTime How long you can edit for at a time (in minutes); set to 0 to turn this off
// wbeWaitTime How long you have to wait before editing periods (in minutes)
// wbeEndDateY Year at which this script stops enforcing wikibreaks (e.g. 2007)
// wbeEndDateM Month number at which this script stops enforcing wikibreaks (e.g. 9 for
// September)
// wbeEndDateD Day in the month at which this script stops enforcing wikibreaks
// wbeBlockAnon Prevents you even viewing/editing Wikipedia as an anon if set to true (only do
// this if you have the 'remember me' option set); if set to false, you can view and
// edit Wikipedia as an anon.
// If you find yourself locked out by this script by mistake, or change your mind about installing
// it, you can either uninstall it during an editing period, or request an administrator to remove
// it for you.
/* An example of how to include this script in your monobook.js:
wbeEditTime=60;
wbeWaitTime=540;
wbeEndDateY=2007;
wbeEndDateM=12;
wbeEndDateD=31;
wbeBlockAnon=false;
importScript("User:ais523/wikibreakenforcer.js");
- /
//
function wbestartlogon()
{
if(!confirm("Start a temporary logged on session for up to "+wbeEditTime+" minutes (when it ends,"+
" you will be locked out for "+wbeWaitTime+" minutes)?")) return;
var d=new Date();
d.setTime(new Date().getTime()+(wbeEditTime+wbeWaitTime)*60000);
document.cookie="ais523wbest="+(new Date().toUTCString())+"; expires="+(d.toUTCString())+
"; path=/; domain=en.wikipedia.org";
location.reload(true);
}
var wbeDelayedInnerHTML;
function wbedelbodyset()
{
document.body.innerHTML=wbeDelayedInnerHTML;
}
function wbedelbodysetdelay()
{
window.setTimeout("wbedelbodyset()",1)
}
if(new Date().getTime() if(location.href.indexOf("?action=submit")==-1&&location.href.indexOf("&action=submit")==-1) { // It's still in the wikibreak period. var dc=document.cookie.split(';') var i=dc.length; var wbest=""; while(i--) if(dc[i].split('=')[0].indexOf("ais523wbest")!=-1) wbest=dc[i].split('=')[1]; // Three possibilities. if(wbest==""||new Date().getTime()-new Date(wbest).getTime()>=(wbeEditTime+wbeWaitTime)*60000) { // There isn't a blocking cookie at the moment, or it's expired. var ih; ih= " ih+=" You can log on at the moment. ih+=" Choose one of these options: if(wbeEditTime) ih+=" if(!wbeBlockAnon) ih+=" ih+=" wbeDelayedInnerHTML=ih+" hookEvent("load",wbedelbodysetdelay); // Disable all other scripts doneOnloadHook=1; addOnloadHook=function(x){}; importScript=function(x){}; window.doneOnloadHook=1; window.addOnloadHook=function(x){}; window.importScript=function(x){}; onloadFuncts=[]; window.onloadFuncts=[]; } else if(new Date().getTime()-new Date(wbest).getTime() { // Do nothing; we're in an allotted edit time. } else if(new Date().getTime()-new Date(wbest).getTime()<(wbeEditTime+wbeWaitTime)*60000) { // In a blocked period at the moment. var ih; ih= " ih+=" You're currently automatically blocked by the enforcer, to enforce your wikibreak. ih+=" Choose one of these options: if(!wbeBlockAnon) ih+=" ih+=" ih+=" wbeDelayedInnerHTML=ih+" hookEvent("load",wbedelbodysetdelay); // Disable all other scripts doneOnloadHook=1; addOnloadHook=function(x){}; importScript=function(x){}; window.doneOnloadHook=1; window.addOnloadHook=function(x){}; window.importScript=function(x){}; onloadFuncts=[]; window.onloadFuncts=[]; } } //Wikibreak Enforcer
";
";
";
Wikibreak Enforcer
";
";
";