User:Evesiesta/wikibreak.js

维基百科,自由的百科全书

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。

/*** BEGIN WIKIBREAK ENFORCER ***/
/*** From [[:en:Wikipedia:WikiProject User scripts/Scripts/WikiBreak Enforcer/script]] ***/
$(function() {
	/*** 编辑此处 ***/
	// 你的假期何时结束?
	// 没有前导零,如 7 ~ 正确,但是 07 ~ 错误。
	var date = {year: 2099, month: 12, day: 31};
	var time = {hours: 23, minutes: 59, seconds: 59};

	/*** 不要编辑以下内容 ***/
	var currentDate = new Date();
	var enforcedBreakEnd = new Date(date.year, date.month - 1, date.day, time.hours, time.minutes, time.seconds);
	if (currentDate > enforcedBreakEnd) return;
	mw.loader.using(['ext.gadget.site-lib', 'mediawiki.api']).then(function() {
		window.alert(wgULS('您的维基假期将在', '您的維基假期將在') + enforcedBreakEnd.toLocaleString() + wgULS('结束\n', '結束\n') + wgULS('现在是:', '現在是:') + currentDate.toLocaleString() + '\n\n' + wgULS('再见!', '再見!'));
		new mw.Api().postWithEditToken({
			action: 'logout'
		}).done(function() {
			window.location = window.location.origin + '/w/index.php?title=Special:Userlogin&returnto=Wikipedia:首页';
		}).fail(function() {
			console.log('logout failed');
		});
	});
});
/*** END WIKIBREAK ENFORCER ***/