|
|
Line 1: |
Line 1: |
| $(function() {
| | var today = new Date(); |
| const today = new Date();
| | var month = today.getMonth() + 1; |
| const month = today.getMonth(); // 0 = Jan, 3 = April
| | var day = today.getDate(); |
| const date = today.getDate();
| |
|
| |
|
| if (month === 9 && date === 12 && !localStorage.getItem('noAF')) {
| | var prankMonth = 10; |
| const pageName = mw.config.get('wgPageName');
| | var prankDay = 12; |
| const afPage = 'AF:' + pageName;
| |
|
| |
|
| // Only redirect if we're not already on the AF page | | if (month === prankMonth && day === prankDay) { |
| | var pageName = mw.config.get('wgPageName'); |
| | |
| if (!pageName.startsWith('AF:')) { | | if (!pageName.startsWith('AF:')) { |
| $.get(mw.util.getUrl(afPage), function(data) {
| | window.location.href = '/wiki/AF:' + pageName; |
| if (!data.includes('There is currently no text in this page')) { | |
| window.location.href = mw.util.getUrl(afPage);
| |
| }
| |
| });
| |
| } | | } |
| | | } |
| // Add goofy styles to the page
| |
| $('body').addClass('april-fools');
| |
| | |
| | |
| $('#p-personal ul').append('<li><a href="#" id="disable-af">Turn off April Fools</a></li>');
| |
| $('#disable-af').on('click', function(e) {
| |
| e.preventDefault();
| |
| localStorage.setItem('noAF', '1');
| |
| location.reload();
| |
| });
| |
| }
| |
| });
| |