traxxx/assets/js/ui/state.js

15 lines
514 B
JavaScript
Raw Normal View History

2021-01-03 21:53:51 +00:00
const storedTagFilter = localStorage.getItem('tagFilter');
const storedBatch = localStorage.getItem('batch');
2020-03-23 00:43:49 +00:00
const storedSfw = localStorage.getItem('sfw');
const storedTheme = localStorage.getItem('theme');
const deviceTheme = window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
export default {
2021-01-03 21:53:51 +00:00
tagFilter: storedTagFilter ? storedTagFilter.split(',') : [],
range: 'latest',
batch: storedBatch || 'all',
sfw: storedSfw === 'true' || false,
theme: storedTheme || deviceTheme,
};