-
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
Showing
20 changed files
with
117 additions
and
78 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,64 +1,73 @@ | ||
// Hamburger Menu | ||
function toggleMenu() { | ||
const menu = document.querySelector(".menu-links"); | ||
const icon = document.querySelector(".hamburger-icon"); | ||
menu.classList.toggle("open"); | ||
icon.classList.toggle("open"); | ||
} | ||
//Splash Screen | ||
|
||
// Dark / Light Mode | ||
const btn = document.getElementById("modeToogle") | ||
const btn2 = document.getElementById("modeToogle2") | ||
const themeIcons = document.querySelectorAll(".icon"); | ||
let isSystemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; | ||
window.addEventListener('load', function () { | ||
setTimeout(function () { | ||
document.getElementById('splash-screen').style.display = 'none'; | ||
}, 2000); // 3000ms = 3s | ||
}); | ||
|
||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { | ||
isSystemDarkMode = e.matches; | ||
setTheme(); | ||
}); | ||
|
||
if(localStorage.getItem("theme") === "dark"){ | ||
setDarkMode(); | ||
}; | ||
// Hamburger Menu | ||
function toggleMenu() { | ||
const menu = document.querySelector(".menu-links"); | ||
const icon = document.querySelector(".hamburger-icon"); | ||
menu.classList.toggle("open"); | ||
icon.classList.toggle("open"); | ||
} | ||
|
||
// Dark / Light Mode | ||
const btn = document.getElementById("modeToogle") | ||
const btn2 = document.getElementById("modeToogle2") | ||
const themeIcons = document.querySelectorAll(".icon"); | ||
let isSystemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; | ||
|
||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { | ||
isSystemDarkMode = e.matches; | ||
setTheme(); | ||
}); | ||
|
||
btn.addEventListener("click" , function(){ | ||
localStorage.setItem("themeChangedManually", "true"); | ||
setTheme(); | ||
}) | ||
btn2.addEventListener("click" , function(){ | ||
localStorage.setItem("themeChangedManually", "true"); | ||
setTheme(); | ||
}) | ||
if(localStorage.getItem("theme") === "dark"){ | ||
setDarkMode(); | ||
}; | ||
|
||
function setTheme(){ | ||
let currentTheme = document.body.getAttribute("theme") | ||
let themeChangedManually = localStorage.getItem("themeChangedManually"); | ||
btn.addEventListener("click" , function(){ | ||
localStorage.setItem("themeChangedManually", "true"); | ||
setTheme(); | ||
}) | ||
btn2.addEventListener("click" , function(){ | ||
localStorage.setItem("themeChangedManually", "true"); | ||
setTheme(); | ||
}) | ||
|
||
if(themeChangedManually !== "true"){ | ||
if(isSystemDarkMode){ | ||
setDarkMode(); | ||
} else { | ||
setLightMode(); | ||
} | ||
} else if(currentTheme === "dark"){ | ||
setLightMode(); | ||
} else { | ||
setDarkMode(); | ||
} | ||
}; | ||
function setTheme(){ | ||
let currentTheme = document.body.getAttribute("theme") | ||
let themeChangedManually = localStorage.getItem("themeChangedManually"); | ||
|
||
if(themeChangedManually !== "true"){ | ||
if(isSystemDarkMode){ | ||
setDarkMode(); | ||
} else { | ||
setLightMode(); | ||
} | ||
} else if(currentTheme === "dark"){ | ||
setLightMode(); | ||
} else { | ||
setDarkMode(); | ||
} | ||
}; | ||
|
||
function setDarkMode(){ | ||
document.body.setAttribute("theme" , "dark"); | ||
localStorage.setItem("theme" , "dark"); | ||
themeIcons.forEach((icon) => ( | ||
icon.src = icon.getAttribute("src-dark") | ||
)) | ||
}; | ||
function setDarkMode(){ | ||
document.body.setAttribute("theme" , "dark"); | ||
localStorage.setItem("theme" , "dark"); | ||
themeIcons.forEach((icon) => ( | ||
icon.src = icon.getAttribute("src-dark") | ||
)) | ||
}; | ||
|
||
function setLightMode(){ | ||
document.body.removeAttribute("theme"); | ||
localStorage.setItem("theme" , "light"); | ||
themeIcons.forEach((icon) => ( | ||
icon.src = icon.getAttribute("src-light") | ||
)) | ||
}; | ||
function setLightMode(){ | ||
document.body.removeAttribute("theme"); | ||
localStorage.setItem("theme" , "light"); | ||
themeIcons.forEach((icon) => ( | ||
icon.src = icon.getAttribute("src-light") | ||
)) | ||
}; |
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