feat: add work in progress 7.0 code

Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
David Ralph
2022-04-08 14:48:36 +01:00
parent e0820c6b2a
commit 361fae7f25
136 changed files with 8631 additions and 3500 deletions

View File

@@ -34,15 +34,18 @@ export function loadSettings(hotreload) {
switch (localStorage.getItem('theme')) {
case 'dark':
document.body.classList.add('dark');
document.body.classList.remove('light');
break;
case 'auto':
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.body.classList.add('dark');
} else {
document.body.classList.remove('dark');
document.body.classList.add('light');
}
break;
default:
document.body.classList.add('light');
document.body.classList.remove('dark');
}
@@ -66,7 +69,11 @@ export function loadSettings(hotreload) {
document.body.classList.remove('no-animations');
}
if (localStorage.getItem('textBorder') === 'true') {
// technically, this is text SHADOW, and not BORDER
// however it's a mess and we'll just leave it at this for now
const textBorder = localStorage.getItem('textBorder');
// enable/disable old text border from before redesign
if (textBorder === 'true') {
const elements = ['greeting', 'clock', 'quote', 'quoteauthor', 'date'];
elements.forEach((element) => {
try {
@@ -86,6 +93,13 @@ export function loadSettings(hotreload) {
});
}
// remove actual default shadow
if (textBorder === 'none') {
document.getElementById('center').classList.add('no-textBorder');
} else {
document.getElementById('center').classList.remove('no-textBorder');
}
const css = localStorage.getItem('customcss');
if (css) {
document.head.insertAdjacentHTML('beforeend', '<style id="customcss">' + css + '</style>');