2021-04-22 17:44:23 +00:00
|
|
|
async function initUiObservers(store, _router) {
|
2020-12-27 01:15:06 +00:00
|
|
|
const body = document.querySelector('body');
|
|
|
|
|
|
|
|
body.classList.add(store.state.ui.theme);
|
|
|
|
|
|
|
|
store.watch(state => state.ui.theme, (newTheme, oldTheme) => {
|
|
|
|
body.classList.add(newTheme);
|
|
|
|
body.classList.remove(oldTheme);
|
|
|
|
});
|
|
|
|
|
2020-05-14 02:26:05 +00:00
|
|
|
document.addEventListener('keypress', (event) => {
|
|
|
|
if (event.target.tagName === 'INPUT') {
|
|
|
|
return;
|
|
|
|
}
|
2020-03-28 03:37:04 +00:00
|
|
|
|
2020-05-14 02:26:05 +00:00
|
|
|
if (event.key === 's') {
|
|
|
|
store.dispatch('setSfw', true);
|
|
|
|
}
|
2020-05-08 23:10:07 +00:00
|
|
|
|
2020-05-14 02:26:05 +00:00
|
|
|
if (event.key === 'n') {
|
|
|
|
store.dispatch('setSfw', false);
|
|
|
|
}
|
2020-05-13 00:56:20 +00:00
|
|
|
|
2020-05-14 02:26:05 +00:00
|
|
|
if (event.key === 'd') {
|
|
|
|
store.dispatch('setTheme', 'dark');
|
|
|
|
}
|
2020-05-13 00:56:20 +00:00
|
|
|
|
2020-05-14 02:26:05 +00:00
|
|
|
if (event.key === 'l') {
|
|
|
|
store.dispatch('setTheme', 'light');
|
|
|
|
}
|
|
|
|
});
|
2021-04-22 17:44:23 +00:00
|
|
|
|
|
|
|
await store.dispatch('fetchNotifications');
|
2020-03-28 03:37:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default initUiObservers;
|