Initial Commit
This commit is contained in:
commit
e8529bdbee
25 changed files with 13519 additions and 0 deletions
12048
assets/css/bootstrap.css
vendored
Normal file
12048
assets/css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
3
assets/css/main.css
Normal file
3
assets/css/main.css
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.mt-50px {
|
||||
margin-top: 50px;
|
||||
}
|
||||
7
assets/js/bootstrap.min.js
vendored
Normal file
7
assets/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
29
assets/js/script.js
Normal file
29
assets/js/script.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// @description Get cookie by name
|
||||
function getCookie(name) {
|
||||
return document.cookie
|
||||
.split("; ")
|
||||
.find(row => row.startsWith(name + "="))
|
||||
?.split("=")[1];
|
||||
}
|
||||
|
||||
const DEFAULT_THEME = 'light'
|
||||
|
||||
window.addEventListener('load', (e) => {
|
||||
let theme = getCookie('theme');
|
||||
|
||||
if (theme) {
|
||||
// change theme
|
||||
document.querySelector('html').setAttribute("data-bs-theme", theme);
|
||||
// update value of input
|
||||
document.querySelector("#changeTheme").value = theme
|
||||
} else {
|
||||
document.querySelector('html').setAttribute("data-bs-theme", DEFAULT_THEME);
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector("#changeTheme").addEventListener('change', (e) => {
|
||||
// create cookie to save theme preferences
|
||||
document.cookie = `theme=${e.target.value}; path=/; max-age=31536000`;
|
||||
//change theme
|
||||
document.querySelector('html').setAttribute("data-bs-theme", e.target.value);
|
||||
});
|
||||
Loading…
Reference in a new issue