traxxx/assets/js/ui/state.js

15 lines
514 B
JavaScript
Executable File

const storedTagFilter = localStorage.getItem('tagFilter');
const storedBatch = localStorage.getItem('batch');
const storedSfw = localStorage.getItem('sfw');
const storedTheme = localStorage.getItem('theme');
const deviceTheme = window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
export default {
tagFilter: storedTagFilter ? storedTagFilter.split(',') : [],
range: 'latest',
batch: storedBatch || 'all',
sfw: storedSfw === 'true' || false,
theme: storedTheme || deviceTheme,
};