From 7cd769bfa5032d29dd21a20a649f5e39b02df3e4 Mon Sep 17 00:00:00 2001 From: Thomas Chartron Date: Sun, 14 Nov 2021 15:15:17 +0100 Subject: [PATCH] update --- deploy-github.sh | 2 +- src/js/main.js | 2 +- static/js/main.js | 2 +- templates/layout.html | 25 +++++++++++++++++-------- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/deploy-github.sh b/deploy-github.sh index f3eb9a4..a621814 100644 --- a/deploy-github.sh +++ b/deploy-github.sh @@ -20,7 +20,7 @@ rm -rf public_zola echo -e "\033[0;32mCommit change to main repository\033[0m\n" git add . -git commit -m "update" +git commit -am "update" git push origin main # Go To Public folder diff --git a/src/js/main.js b/src/js/main.js index 58fb2a0..5cb0f77 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1,6 +1,6 @@ document.addEventListener("DOMContentLoaded", function() { // ---------------- Selected Navbar Link ------------------------- - let navbar_links = document.querySelector('#nav-links').children; + let navbar_links = document.querySelector('.nav-links').children; let current_location = window.location.href; let selected_navbar_link = [...navbar_links].find((item) => { return (item.href === current_location) diff --git a/static/js/main.js b/static/js/main.js index e1843e0..c23b1cf 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1 +1 @@ -function switchTheme(){"dark"==([...document.documentElement.classList].includes("dark")?"dark":"light")?(localStorage.theme="light",document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden"),document.getElementById("dark").classList.remove("hidden")):(localStorage.theme="dark",document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden"),document.getElementById("light").classList.remove("hidden"))}function toggleSidebar(){let e=document.getElementById("sidebar");[...e.classList].includes("translate-x-0")?(document.body.style.removeProperty("overflow"),e.classList.remove("translate-x-0"),e.classList.add("-translate-x-full")):(document.body.style.setProperty("overflow","hidden"),e.classList.remove("-translate-x-full"),e.classList.add("translate-x-0"))}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelector("#nav-links").children;let t=window.location.href,d=[...e].find(e=>e.href===t);void 0!==d&&(d.className="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium"),"dark"===localStorage.theme||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden")):(document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden")),document.getElementById("switch-theme").addEventListener("click",switchTheme),document.getElementById("toggle-sidebar").addEventListener("click",toggleSidebar)}); \ No newline at end of file +function switchTheme(){"dark"==([...document.documentElement.classList].includes("dark")?"dark":"light")?(localStorage.theme="light",document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden"),document.getElementById("dark").classList.remove("hidden")):(localStorage.theme="dark",document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden"),document.getElementById("light").classList.remove("hidden"))}function toggleSidebar(){let e=document.getElementById("sidebar");[...e.classList].includes("translate-x-0")?(document.body.style.removeProperty("overflow"),e.classList.remove("translate-x-0"),e.classList.add("-translate-x-full")):(document.body.style.setProperty("overflow","hidden"),e.classList.remove("-translate-x-full"),e.classList.add("translate-x-0"))}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelector(".nav-links").children;let t=window.location.href,d=[...e].find(e=>e.href===t);void 0!==d&&(d.className="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium"),"dark"===localStorage.theme||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden")):(document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden")),document.getElementById("switch-theme").addEventListener("click",switchTheme),document.getElementById("toggle-sidebar").addEventListener("click",toggleSidebar)}); \ No newline at end of file diff --git a/templates/layout.html b/templates/layout.html index e200eb4..207f53f 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -47,7 +47,7 @@ -->