diff options
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | css/fonts.scss | 36 | ||||
-rw-r--r-- | include/initScripts.shtml | 4 | ||||
-rw-r--r-- | js/getTheme.ts | 13 | ||||
-rw-r--r-- | js/toggleTheme.ts | 3 | ||||
-rwxr-xr-x | make.sh | 1 |
6 files changed, 41 insertions, 21 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index efadf46..b12f448 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 5.1 + +* Fix fonts +* Fix themes not working with invalid local storage + ## 5.0 * Elaborate pages diff --git a/css/fonts.scss b/css/fonts.scss index 85271b5..db20257 100644 --- a/css/fonts.scss +++ b/css/fonts.scss @@ -1,104 +1,104 @@ @font-face { font-family: "Fira Mono"; - src: url("/ttf/FiraMono-Regular.ttf"); + src: url("/font/FiraMono-Regular.ttf"); } @font-face { font-family: "Fira Mono"; font-weight: bold; - src: url("/ttf/FiraMono-Bold.ttf"); + src: url("/font/FiraMono-Bold.ttf"); } @font-face { font-family: "Martian Mono"; - src: url("/ttf/MartianMono-Regular.ttf"); + src: url("/font/MartianMono-Regular.ttf"); } @font-face { font-family: "Martian Mono"; font-weight: bold; - src: url("/ttf/MartianMono-Bold.ttf"); + src: url("/font/MartianMono-Bold.ttf"); } @font-face { font-family: "Montserrat"; - src: url("/ttf/Montserrat-Regular.ttf"); + src: url("/font/Montserrat-Regular.ttf"); } @font-face { font-family: "Montserrat"; font-style: italic; - src: url("/ttf/Montserrat-Italic.ttf"); + src: url("/font/Montserrat-Italic.ttf"); } @font-face { font-family: "Montserrat"; font-weight: bold; - src: url("/ttf/Montserrat-Bold.ttf"); + src: url("/font/Montserrat-Bold.ttf"); } @font-face { font-family: "Montserrat"; font-style: italic; font-weight: bold; - src: url("/ttf/Montserrat-BoldItalic.ttf"); + src: url("/font/Montserrat-BoldItalic.ttf"); } @font-face { font-family: "Play"; - src: url("/ttf/Play-Regular.ttf"); + src: url("/font/Play-Regular.ttf"); } @font-face { font-family: "Play"; font-weight: bold; - src: url("/ttf/Play-Bold.ttf"); + src: url("/font/Play-Bold.ttf"); } @font-face { font-family: "Playfair Display"; - src: url("/ttf/PlayfairDisplay-Regular.ttf"); + src: url("/font/PlayfairDisplay-Regular.ttf"); } @font-face { font-family: "Playfair Display"; font-weight: bold; - src: url("/ttf/PlayfairDisplay-Regular.ttf"); + src: url("/font/PlayfairDisplay-Regular.ttf"); } @font-face { font-family: "Playfair Display"; font-style: italic; - src: url("/ttf/PlayfairDisplay-Italic.ttf"); + src: url("/font/PlayfairDisplay-Italic.ttf"); } @font-face { font-family: "Playfair Display"; font-style: italic; font-weight: bold; - src: url("/ttf/PlayfairDisplay-BoldItalic.ttf"); + src: url("/font/PlayfairDisplay-BoldItalic.ttf"); } @font-face { font-family: "Raleway"; - src: url("/ttf/Raleway-Regular.ttf"); + src: url("/font/Raleway-Regular.ttf"); } @font-face { font-family: "Raleway"; font-weight: bold; - src: url("/ttf/Raleway-Bold.ttf"); + src: url("/font/Raleway-Bold.ttf"); } @font-face { font-family: "Raleway"; font-style: italic; - src: url("/ttf/Raleway-Italic.ttf"); + src: url("/font/Raleway-Italic.ttf"); } @font-face { font-family: "Raleway"; font-style: italic; font-weight: bold; - src: url("/ttf/Raleway-BoldItalic.ttf"); + src: url("/font/Raleway-BoldItalic.ttf"); } diff --git a/include/initScripts.shtml b/include/initScripts.shtml index 86feb76..d39597c 100644 --- a/include/initScripts.shtml +++ b/include/initScripts.shtml @@ -1,3 +1,4 @@ +<script src="/js/getTheme.js" type="text/javascript"></script> <script src="/js/initImages.js" type="text/javascript"></script> <script src="/js/loadPage.js" type="text/javascript"></script> <script src="/js/setNavBarState.js" type="text/javascript"></script> @@ -7,8 +8,7 @@ <script type="text/javascript"> (function() { - let theme = JSON.parse(localStorage.getItem("theme")); - setTheme(theme); + setTheme(getTheme()); initImages(); })(); diff --git a/js/getTheme.ts b/js/getTheme.ts new file mode 100644 index 0000000..769ea3c --- /dev/null +++ b/js/getTheme.ts @@ -0,0 +1,13 @@ +/// <reference path="setTheme.ts" /> + +function getTheme(): Theme { + let theme = Theme.Dark; + + try { + theme = JSON.parse(localStorage.getItem("theme")!); + } catch (e: any) { + console.log("invalid theme, using dark"); + } + + return theme; +} diff --git a/js/toggleTheme.ts b/js/toggleTheme.ts index 733a0f3..b5514d2 100644 --- a/js/toggleTheme.ts +++ b/js/toggleTheme.ts @@ -1,7 +1,8 @@ +/// <reference path="getTheme.ts" /> /// <reference path="setTheme.ts" /> function toggleTheme() { - let theme: Theme = JSON.parse(localStorage.getItem("theme")!); + let theme = getTheme(); if (theme == Theme.Light) { theme = Theme.Dark; @@ -51,6 +51,7 @@ make_script() { make_stylesheet "main" make_stylesheet "noScript" +make_script "getTheme" make_script "initImages" make_script "loadPage" make_script "setNavBarState" |