move js
This commit is contained in:
parent
05ade38f2f
commit
f8c3577a54
|
@ -1,23 +0,0 @@
|
||||||
<button type="button" class="btn btn-dark" id="toggleThemeButton">
|
|
||||||
<i id="toggleThemeIcon" class="bi bi-sun"></i>
|
|
||||||
</button>
|
|
||||||
<script>
|
|
||||||
'use strict'
|
|
||||||
let i = document.getElementById("toggleThemeIcon").className = "bi bi-sun";
|
|
||||||
const storedTheme = localStorage.getItem('theme');
|
|
||||||
if (storedTheme == null) {
|
|
||||||
localStorage.setItem("theme", "light");
|
|
||||||
document.getElementById("toggleThemeIcon").className = "bi bi-sun-fill";
|
|
||||||
setTheme("light");
|
|
||||||
}
|
|
||||||
else if (storedTheme == "dark") {
|
|
||||||
localStorage.setItem("theme", "dark");
|
|
||||||
document.getElementById("toggleThemeIcon").className = "bi bi-sun";
|
|
||||||
setTheme("dark");
|
|
||||||
}
|
|
||||||
else if (storedTheme == "light") {
|
|
||||||
localStorage.setItem("theme", "light");
|
|
||||||
document.getElementById("toggleThemeIcon").className = "bi bi-sun-fill";
|
|
||||||
setTheme("light");
|
|
||||||
}
|
|
||||||
</script>
|
|
|
@ -60,31 +60,12 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
{% include 'dark_light_switch.html' %}
|
<button type="button" class="btn btn-dark" id="toggleThemeButton">
|
||||||
|
<i id="toggleThemeIcon" class="bi bi-sun"></i>
|
||||||
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% include 'main_search_form.html' %}
|
{% include 'main_search_form.html' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
'use strict'
|
|
||||||
document.getElementById("toggleThemeButton").onclick = function () {
|
|
||||||
const storedTheme = localStorage.getItem('theme');
|
|
||||||
if (storedTheme == null) {
|
|
||||||
localStorage.setItem("theme", "dark");
|
|
||||||
document.getElementById("toggleThemeIcon").className = "bi bi-sun";
|
|
||||||
setTheme("dark");
|
|
||||||
}
|
|
||||||
else if (storedTheme == "dark") {
|
|
||||||
localStorage.setItem("theme", "light");
|
|
||||||
document.getElementById("toggleThemeIcon").className = "bi bi-sun-fill";
|
|
||||||
setTheme("light");
|
|
||||||
}
|
|
||||||
else if (storedTheme == "light") {
|
|
||||||
localStorage.setItem("theme", "dark");
|
|
||||||
document.getElementById("toggleThemeIcon").className = "bi bi-sun";
|
|
||||||
setTheme("dark");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
</nav>
|
</nav>
|
||||||
|
|
Loading…
Reference in New Issue