Commit 81070f6d authored by Clark's avatar Clark

Adding sessionStorage for tracking theme preference

parent 1b6ea693
......@@ -282,6 +282,18 @@ Publishing settings for bytecache blog.
<script src=\"site.js\"></script>
<script defer src=\"https://commento.bytecache.io/js/commento.js\"></script>"
:html-preamble "
<!-- Web storage for theme preference -->
<script>
var theme = sessionStorage.getItem(\"theme\");
var element = document.body;
if (theme && theme === \"light\") {
element.classList.add(\"light\");
} else {
element.classList.remove(\"light\");
}
</script>
</div>
......@@ -295,8 +307,8 @@ Publishing settings for bytecache blog.
<div class=\"row\">
<div class=\"col-md-12\">
<div class=\"btn-group d-flex\">
<button type=\"button\" class=\"btn w-100 theme-buttons btn-outline-light light-button\" data-toggle=\"tooltop\" title=\"Light Theme\" onclick=\"lightToggle()\">&#127774;</button>
<button type=\"button\" class=\"btn w-100 theme-buttons btn-outline-dark dark-button\" data-toggle=\"tooltop\" title=\"Dark Theme\" onclick=\"darkToggle()\">&#127770;</button>
<button type=\"button\" class=\"btn w-100 theme-buttons btn-outline-light light-button\" data-toggle=\"tooltip\" title=\"Light Theme\" onclick=\"lightToggle()\">&#127774;</button>
<button type=\"button\" class=\"btn w-100 theme-buttons btn-outline-dark dark-button\" data-toggle=\"tooltip\" title=\"Dark Theme\" onclick=\"darkToggle()\">&#127770;</button>
</div>
</div>
</div>
......@@ -332,9 +344,9 @@ Publishing settings for bytecache blog.
<ul class=\"list-unstyled components\">
<li id=\"theme-box\">
<button type=\"button\" class=\"btn w-100 theme-buttons btn-outline-light light-button-small\" data-toggle=\"tooltop\" title=\"Light Theme\" onclick=\"lightToggle()\">&#127774;</button>
<button type=\"button\" class=\"btn w-100 theme-buttons btn-outline-dark dark-button-small d-none\" data-toggle=\"tooltop\" title=\"Dark Theme\" onclick=\"darkToggle()\">&#127770;</button>
<li id=\"theme-box\" class=\"d-none\">
<button type=\"button\" class=\"btn w-100 theme-buttons btn-outline-light light-button-small\" data-toggle=\"tooltip\" title=\"Light Theme\" onclick=\"lightToggle()\">&#127774;</button>
<button type=\"button\" class=\"btn w-100 theme-buttons btn-outline-dark dark-button-small d-none\" data-toggle=\"tooltip\" title=\"Dark Theme\" onclick=\"darkToggle()\">&#127770;</button>
</li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment