User:桐生ここ/Gadget/Wikibreak.js

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
mw.util.addPortletLink(
        'p-personal', '#',
        '假期提醒', 'kiryuu-wikibreak-button'
);

$( "#kiryuu-wikibreak-button" ).click( function() {
	OO.ui.confirm( "您是否需要维基假期提醒?" ).done( function ( confirmed ) {
        if ( confirmed ) {
            localStorage.setItem( "kiryuu-wikibreak-setting" , "true" );
        } else {
            localStorage.setItem( "kiryuu-wikibreak-setting" , "false" );
        }
    });
});

if ( localStorage.getItem( "kiryuu-wikibreak-setting" ) === "true" ){
	OO.ui.alert( "您正在放维基假期,请关闭此页。" );
}