-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (35 loc) · 1.14 KB
/
Copy pathindex.js
File metadata and controls
38 lines (35 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
if (!window.appData) {
window.appData = JSON.parse(localStorage.getItem('tv-appData') || '{}')
} else {
localStorage.setItem('tv-appData', JSON.stringify(window.appData))
}
var app = Vue.createApp({
data() {
return {
allSites: appData.sites,
theme: localStorage.getItem('user-theme') || 'light',
currentFontSize: appData.fontSizes['常规'],
};
},
mounted() {
document.body.classList.toggle('dark-mode', this.theme === 'dark');
setTimeout(() => {
document.querySelector('#' + atob('ZWRnZW9uZS' + '' + '13YXRlcm1hcms='))?.remove()
}, 1000)
},
methods: {
toggleTheme() {
this.theme = this.theme === 'light' ? 'dark' : 'light';
localStorage.setItem('user-theme', this.theme);
document.body.classList.toggle('dark-mode', this.theme === 'dark');
}
},
});
app.mount('#app');
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js')
.then(e => console.log('[SW-TV] Service Worker success:', e))
.catch(e => console.log('[SW-TV] Service Worker failed:', e));
});
}