Font spacer4

This commit is contained in:
cutls 2019-12-20 09:52:57 +09:00
parent eccdee7446
commit 553abf90cb

View File

@ -1,32 +1,33 @@
//テーマ適用 //テーマ適用
function themes(theme) { function themes(theme) {
if (!theme) { if (!theme) {
var theme = localStorage.getItem("theme"); var theme = localStorage.getItem('theme')
if (!theme) { if (!theme) {
var theme = "black"; var theme = 'black'
localStorage.setItem("theme", "black"); localStorage.setItem('theme', 'black')
} }
} }
var el = document.getElementsByTagName("html")[0] var el = document.getElementsByTagName('html')[0]
el.classList.remove('indigotheme'); el.classList.remove('indigotheme')
el.classList.remove('greentheme'); el.classList.remove('greentheme')
el.classList.remove('browntheme'); el.classList.remove('browntheme')
el.classList.remove('blacktheme'); el.classList.remove('blacktheme')
el.classList.remove('bluetheme'); el.classList.remove('bluetheme')
el.classList.remove('customtheme'); el.classList.remove('customtheme')
el.classList.add(theme + "theme"); el.classList.add(theme + 'theme')
var font = localStorage.getItem("font"); var font = localStorage.getItem('font')
if (font) { if (font) {
el.style.fontFamily = font; font = font.replace(/"(.+)"/, '$1')
el.style.fontFamily = '"' + font + '"'
} else { } else {
el.style.fontFamily = ""; el.style.fontFamily = ''
} }
if (theme == "custom") { if (theme == 'custom') {
if (localStorage.getItem("customtheme-id")) { if (localStorage.getItem('customtheme-id')) {
postMessage(["themeCSSRequest", localStorage.getItem("customtheme-id")], "*") postMessage(['themeCSSRequest', localStorage.getItem('customtheme-id')], '*')
} }
} }
el.style.backgroundColor = "var(--bg)"; el.style.backgroundColor = 'var(--bg)'
} }
themes(); themes()