diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/css/themes/default.css (renamed from static/css/style.css) | 0 | ||||
-rw-r--r-- | static/css/themes/gruvbox.css (renamed from static/css/gruvbox.css) | 0 | ||||
-rw-r--r-- | static/js/themes.js | 6 | ||||
-rw-r--r-- | static/main.html | 13 |
4 files changed, 17 insertions, 2 deletions
diff --git a/static/css/style.css b/static/css/themes/default.css index fa76b50..fa76b50 100644 --- a/static/css/style.css +++ b/static/css/themes/default.css diff --git a/static/css/gruvbox.css b/static/css/themes/gruvbox.css index fb39ea4..fb39ea4 100644 --- a/static/css/gruvbox.css +++ b/static/css/themes/gruvbox.css diff --git a/static/js/themes.js b/static/js/themes.js index 0d9772f..19bdbb4 100644 --- a/static/js/themes.js +++ b/static/js/themes.js @@ -20,5 +20,11 @@ function setTheme(name) { } function applyTheme() { + // HACK: disable all of the themes first. this for some reason makes things work. + for (let i = 0, tags = document.getElementsByTagName("link"); i < tags.length; i++) { + if (tags[i].type === "text/css" && tags[i].title) { + tags[i].disabled = true; + } + } setTheme(getCookie("theme") || "default"); } diff --git a/static/main.html b/static/main.html index 3fa1b66..9a88afc 100644 --- a/static/main.html +++ b/static/main.html @@ -8,8 +8,10 @@ <meta property="og:locale" content="en_US" /> <meta property="og:type" content="website" /> <link rel="icon" type="image/png" href="/static/favicon.png"> - <link rel="stylesheet" type="text/css" href="/static/css/style.css" title="default"> - <link rel="alternate stylesheet" type="text/css" href="/static/css/gruvbox.css" title="gruvbox"> + <link rel="stylesheet" type="text/css" href="/static/css/themes/default.css" title="default"> + {{ range .Themes }} + <link rel="alternate stylesheet" type="text/css" href="/static/css/themes/{{.}}.css" title="{{.}}"> + {{ end }} {{ template "header" . }} </head> <body {{ if not .Board.Restricted }}class="nsfw"{{ end }} onload="applyTheme()"> @@ -38,6 +40,13 @@ {{ template "content" . }} {{ template "bottom" . }} + + <select onchange="setTheme(this.options[this.selectedIndex].value)"> + {{ range .Themes }} + <option value="{{.}}">{{.}}</option> + {{ end }} + </select> + <div align="center" style="width: 500px; margin:0 auto; margin-top: 50px;"> <a href="/">[Home]</a><a href="/static/rules.html">[Rules]</a><a href="/static/faq.html">[FAQ]</a> <p>All trademarks and copyrights on this page are owned by their respective parties.</p> |