Content deleted Content added
Oripaypaykim (talk | contribs) No edit summary |
Oripaypaykim (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
/*** BEGIN WIKIBREAK ENFORCER ***/ |
|||
mw.loader.load( "https://meta.wikimedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript" ); |
|||
⚫ | |||
javascript:if(typeof%20wgEnableAPI=='undefined'){alert('This%20bookmarklet%20only%20works%20on%20Wikimedia%20pages')}else{xhr=new%20XMLHttpRequest();xhr.onreadystatechange=function(){if(xhr.readyState==4){eval('pages=('+xhr.responseText+').query.pages');for(var%20page%20in%20pages)edittoken=pages[page].edittoken;if(edittoken=='+\\')if(!confirm('You%20are%20not%20logged%20in,%20continue?'))return;location.href='https://tools.wmflabs.org/refill/result.php?defaults=y&nowatch=y&wiki='+wgContentLanguage+'&page='+encodeURIComponent(wgPageName);};};xhr.open('GET',wgScriptPath+'/api.php?action=query&prop=info&intoken=edit&titles=M&format=json',true);xhr.send(null);} |
|||
/*** Start editing here ***/ |
|||
<syntaxhighlight lang="javascript"> |
|||
// When you want to end your break? |
|||
// Add [[WP:Reflinks]] launcher in the toolbox on left |
|||
// no leading zeroes. (example: 9 - correct, 09 - incorrect) |
|||
⚫ | |||
mw.util.addPortletLink( |
|||
var date = { year: 2015, month: 10, day: 1}; |
|||
"p-tb", // toolbox portlet |
|||
var time = { hours: 1, minutes: 00, seconds: 0 }; |
|||
"http://dispenser.homenet.org/~dispenser/cgi-bin/webreflinks.py/" + mw.config.get('wgPageName') |
|||
+ "?client=script&citeweb=on&overwrite=&limit=20&lang=" + mw.config.get('wgContentLanguage'), |
|||
/*** Stop editing here ***/ |
|||
"Reflinks" // link label |
|||
⚫ | |||
var currentDate = new Date(); |
|||
</syntaxhighlight> |
|||
var enforcedBreakEnd = new Date( |
|||
date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds); |
|||
if (currentDate <= enforcedBreakEnd) { |
|||
alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString() |
|||
+ "\n(now is "+currentDate.toLocaleString()+")\n\nBye!"); |
|||
location = "//"+location.host+"/w/index.php?title=" |
|||
+ "Special:Userlogout&returnto=Main_Page"; |
|||
} |
|||
⚫ | |||
/*** END WIKIBREAK ENFORCER ***/ |
Revision as of 11:16, 10 July 2015
/*** BEGIN WIKIBREAK ENFORCER ***/
$(document).ready(function() {
/*** Start editing here ***/
// When you want to end your break?
// no leading zeroes. (example: 9 - correct, 09 - incorrect)
var date = { year: 2015, month: 10, day: 1};
var time = { hours: 1, minutes: 00, seconds: 0 };
/*** Stop editing here ***/
var currentDate = new Date();
var enforcedBreakEnd = new Date(
date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds);
if (currentDate <= enforcedBreakEnd) {
alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString()
+ "\n(now is "+currentDate.toLocaleString()+")\n\nBye!");
location = "//"+location.host+"/w/index.php?title="
+ "Special:Userlogout&returnto=Main_Page";
}
});
/*** END WIKIBREAK ENFORCER ***/