2018-01-28 21:22:43 +09:00
|
|
|
//テーマ適用
|
|
|
|
function themes(theme) {
|
|
|
|
if (!theme) {
|
2019-12-20 09:52:57 +09:00
|
|
|
var theme = localStorage.getItem('theme')
|
2019-05-19 16:39:30 +09:00
|
|
|
if (!theme) {
|
2019-12-20 09:52:57 +09:00
|
|
|
var theme = 'black'
|
|
|
|
localStorage.setItem('theme', 'black')
|
2018-03-13 02:41:38 +09:00
|
|
|
}
|
2018-01-28 21:22:43 +09:00
|
|
|
}
|
2019-12-20 09:52:57 +09:00
|
|
|
var el = document.getElementsByTagName('html')[0]
|
2019-08-11 02:52:32 +09:00
|
|
|
|
2019-12-20 09:52:57 +09:00
|
|
|
el.classList.remove('indigotheme')
|
|
|
|
el.classList.remove('greentheme')
|
|
|
|
el.classList.remove('browntheme')
|
|
|
|
el.classList.remove('blacktheme')
|
|
|
|
el.classList.remove('bluetheme')
|
2020-02-10 12:48:35 +09:00
|
|
|
el.classList.remove('polartheme')
|
|
|
|
el.classList.remove('snowtheme')
|
2019-12-20 09:52:57 +09:00
|
|
|
el.classList.remove('customtheme')
|
|
|
|
el.classList.add(theme + 'theme')
|
|
|
|
var font = localStorage.getItem('font')
|
2019-05-19 16:39:30 +09:00
|
|
|
if (font) {
|
2019-12-20 09:52:57 +09:00
|
|
|
font = font.replace(/"(.+)"/, '$1')
|
|
|
|
el.style.fontFamily = '"' + font + '"'
|
2019-05-19 16:39:30 +09:00
|
|
|
} else {
|
2019-12-20 09:52:57 +09:00
|
|
|
el.style.fontFamily = ''
|
2018-07-05 10:26:07 +09:00
|
|
|
}
|
2019-12-20 09:52:57 +09:00
|
|
|
if (theme == 'custom') {
|
|
|
|
if (localStorage.getItem('customtheme-id')) {
|
|
|
|
postMessage(['themeCSSRequest', localStorage.getItem('customtheme-id')], '*')
|
2019-03-08 03:19:26 +09:00
|
|
|
}
|
|
|
|
}
|
2019-12-20 09:52:57 +09:00
|
|
|
el.style.backgroundColor = 'var(--bg)'
|
2018-01-28 21:22:43 +09:00
|
|
|
}
|
2019-12-20 09:52:57 +09:00
|
|
|
themes()
|