mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-04-16 12:52:41 +08:00
add halloween theme
This commit is contained in:
21
src/app.js
21
src/app.js
@@ -70,7 +70,14 @@ class App{
|
||||
`);
|
||||
|
||||
// Init theme
|
||||
this.setTheme(localStorage.getItem('theme'))
|
||||
let date = new Date();
|
||||
if( date.getMonth() == 9 && date.getDate() == 31
|
||||
|| date.getMonth() == 10 && date.getDate() == 1
|
||||
){
|
||||
this.setTheme('halloween');
|
||||
} else {
|
||||
this.setTheme(localStorage.getItem('theme'))
|
||||
}
|
||||
|
||||
indexPage
|
||||
.find('#restart')
|
||||
@@ -804,10 +811,14 @@ class App{
|
||||
setTheme(theme) {
|
||||
const themeLink = $(document).find('#themeLink');
|
||||
|
||||
if(theme == 'light') {
|
||||
themeLink.attr('href', 'light.css');
|
||||
} else {
|
||||
themeLink.attr('href', 'dark.css');
|
||||
switch(theme){
|
||||
case 'dark':
|
||||
case 'light':
|
||||
case 'halloween':
|
||||
themeLink.attr('href', `${theme}.css`);
|
||||
break;
|
||||
default:
|
||||
themeLink.attr('href', 'dark.css');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user