generated from fulldecent/github-pages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e36c387
commit def03b5
Showing
9 changed files
with
81 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
window.addEventListener("load", function() { | ||
fetch("/topbar.html") | ||
.then(response => response.text()) | ||
.then((data) => { | ||
document.getElementById("topbar").innerHTML = data | ||
|
||
const toggleButton = document.getElementById("mode-toggle"); | ||
if (toggleButton) { | ||
toggleButton.addEventListener("click", toggleMode); | ||
} | ||
}) | ||
}) | ||
|
||
function getCookie(name) { | ||
const value = `; ${document.cookie}`; | ||
const parts = value.split(`; ${name}=`); | ||
if (parts.length === 2) return parts.pop().split(';').shift(); | ||
} | ||
|
||
// Function to set a cookie | ||
function setCookie(name, value, days) { | ||
const date = new Date(); | ||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); | ||
const expires = `expires=${date.toUTCString()}`; | ||
document.cookie = `${name}=${value}; ${expires}; path=/`; | ||
} | ||
|
||
// Function to toggle between light and dark mode | ||
function toggleMode() { | ||
const currentMode = getCookie("theme") || "light"; | ||
const newMode = currentMode === "light" ? "dark" : "light"; | ||
setCookie("theme", newMode, 365); // Save new mode for one year | ||
location.reload(); // Reload page to apply new theme | ||
} | ||
|
||
// Apply the correct CSS based on the theme cookie | ||
function applyTheme() { | ||
const theme = getCookie("theme") || "light"; | ||
const themeCss = document.getElementById('theme-css'); | ||
|
||
console.log(`Applying theme: ${theme}`); | ||
|
||
themeCss.href = "/style/" + theme + ".css"; | ||
} | ||
|
||
applyTheme() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
h1 { | ||
text-align: center; | ||
color:palegoldenrod; | ||
} | ||
|
||
body { | ||
background-image: url("https://www.toptal.com/designers/subtlepatterns/uploads/fancy-cushion.pngflower.png"); | ||
background-image: url("https://www.toptal.com/designers/subtlepatterns/uploads/fancy-cushion.png"); | ||
background-repeat: repeat; | ||
font-family: Cambria, serif; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
<link rel="stylesheet" href="/style/topbar.css"> | ||
<div class="topbar"> | ||
<h3 class="links"> | ||
<a href="https://www.atom596.com/">Home</a> | ||
| <a href="https://www.atom596.com/devnotes/">Dev Notes</a> | ||
<a href="/">Home</a> | ||
| <a href="/devnotes/">Dev Notes</a> | ||
| <div class="dropdown"> | ||
<span>Settings</span> | ||
<div class="dropdown-content"> | ||
<button id="mode-toggle">Switch Mode</button> | ||
</div></div> | ||
</h3> | ||
</div> |