From 553abf90cbf5d6ea12a6d4c641867b88b1030384 Mon Sep 17 00:00:00 2001 From: cutls Date: Fri, 20 Dec 2019 09:52:57 +0900 Subject: [PATCH] Font spacer4 --- app/js/ui/theme.js | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/app/js/ui/theme.js b/app/js/ui/theme.js index bafebc4c..abcfef17 100644 --- a/app/js/ui/theme.js +++ b/app/js/ui/theme.js @@ -1,32 +1,33 @@ //テーマ適用 function themes(theme) { if (!theme) { - var theme = localStorage.getItem("theme"); + var theme = localStorage.getItem('theme') if (!theme) { - var theme = "black"; - localStorage.setItem("theme", "black"); + var 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('greentheme'); - el.classList.remove('browntheme'); - el.classList.remove('blacktheme'); - el.classList.remove('bluetheme'); - el.classList.remove('customtheme'); - el.classList.add(theme + "theme"); - var font = localStorage.getItem("font"); + el.classList.remove('indigotheme') + el.classList.remove('greentheme') + el.classList.remove('browntheme') + el.classList.remove('blacktheme') + el.classList.remove('bluetheme') + el.classList.remove('customtheme') + el.classList.add(theme + 'theme') + var font = localStorage.getItem('font') if (font) { - el.style.fontFamily = font; + font = font.replace(/"(.+)"/, '$1') + el.style.fontFamily = '"' + font + '"' } else { - el.style.fontFamily = ""; + el.style.fontFamily = '' } - if (theme == "custom") { - if (localStorage.getItem("customtheme-id")) { - postMessage(["themeCSSRequest", localStorage.getItem("customtheme-id")], "*") + if (theme == 'custom') { + if (localStorage.getItem('customtheme-id')) { + postMessage(['themeCSSRequest', localStorage.getItem('customtheme-id')], '*') } } - el.style.backgroundColor = "var(--bg)"; + el.style.backgroundColor = 'var(--bg)' } -themes(); +themes()