User:Vanished user 1929210/js/删除首页.js
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// {{humor}}
// 取自[[:lzh:Special:Diff/273453]]
// 作用:(仅限管理员)删除首页将变成一个小游戏,成功删除之后会获得系统奖励。
// 备注:① 对Twinkle删除无效;
// ② 中文维基已经故意将删除首页的界面藏起来了,所以明面上是看不到删除按钮的。
(function () {
if (!(mw.config.get('wgAction') === 'delete' && mw.config.get('wgPageName') === mw.config.get('wgMainPageTitle'))) {
return;
}
$('#wpConfirmB').attr('type', 'reset');
$('#wpConfirmB').click(function () {
$.ajax({
url: mw.util.wikiScript('api'),
data: {
format: 'json',
action: 'block',
user: mw.config.get('wgUserName'),
expiry: '1 day',
reason: 'Attempt to delete the main page',
allowusertalk: '',
token: mw.user.tokens.get('editToken'),
},
dataType: 'json',
type: 'POST',
});
alert('恭喜!您已經達成成就「刪除首頁」!請點擊「確定」領取獎勵。');
});
$('#wpConfirmB').mouseenter(function () {
$('#mw-delete-table').css('padding-bottom', '40px');
$('#wpConfirmB')
.css('position', 'fixed')
.css('z-index', '9999')
.css('left', (Math.random() * window.innerWidth) + 'px')
.css('top', (Math.random() * window.innerHeight) + 'px');
});
})();