blob: 8b8418c99ae1815d1976068251fdb44b8b48d48f [file] [log] [blame] [raw]
import $ from 'jquery';
import {Settings, SiteSettings} from './settings.js';
import {Hub} from './hub.js';
import {Themes} from './themes.js';
import * as local from './local.js';
const localKey = 'aprilfools2023';
function toggleButton() {
const theme = Settings.getStoredSettings().theme;
$('#aprilfools2023 .content').toggle(theme !== 'pink' && local.get(localKey, '') !== 'hidden');
}
export function aprilfools2023(hub: Hub) {
const eventHub = hub.createEventHub();
eventHub.on('settingsChange', () => {
toggleButton();
});
toggleButton();
$('#aprilfools2023 .content').on('click', e => {
if (e.target.classList.contains('content')) {
// A little bit of a hack:
$('#settings .theme').val('pink').trigger('change');
//Settings.setTheme('pink');
}
});
$('#aprilfools2023 .content .close').on('click', e => {
local.set(localKey, 'hidden');
toggleButton();
});
}