summaryrefslogtreecommitdiff
path: root/src/js/theme.js
diff options
context:
space:
mode:
authorache <ache@ache.one>2023-04-09 05:09:57 +0200
committerache <ache@ache.one>2023-04-09 05:09:57 +0200
commitfcafc83bf4f23ee5d7b39f6f47f0030d8f6a722a (patch)
tree5a472e29330660d8d69fc2e0de2245f9b067098d /src/js/theme.js
parentReword Read the rest (diff)
Make a real Darkmode
Diffstat (limited to 'src/js/theme.js')
-rw-r--r--src/js/theme.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/js/theme.js b/src/js/theme.js
index fd0b755..4ac40ea 100644
--- a/src/js/theme.js
+++ b/src/js/theme.js
@@ -8,7 +8,11 @@ window.addEventListener('DOMContentLoaded', () => {
const html = document.querySelector('html');
const aside = document.querySelector('#side-bar');
const sidenotes = document.querySelector('.sidenotes');
+ const footnotes = document.querySelector('.footnotes');
const harr = document.querySelector('#harr');
+ const links = document.querySelectorAll('a');
+ const likes = document.querySelectorAll('.likes');
+ const tables = document.querySelectorAll('table');
if (storageTheme === 'dark' || storageTheme === 'light') {
const theme = storageTheme;
@@ -19,6 +23,24 @@ window.addEventListener('DOMContentLoaded', () => {
sidenotes.classList.add(theme);
harr.classList.add(theme);
+ if(footnotes) {
+ footnotes.classList.add(theme);
+ }
+
+ for (let link of links) {
+ link.classList.add(theme);
+ }
+ for (let likeBox of likes) {
+ likeBox.classList.add(theme);
+ }
+ for (let table of tables) {
+ table.classList.add(theme);
+ }
+
+ for (const article of document.querySelectorAll('article')) {
+ article.classList.add(theme);
+ }
+
for (const article of document.querySelectorAll('article')) {
article.classList.add(theme);
}
@@ -43,11 +65,32 @@ window.addEventListener('DOMContentLoaded', () => {
if (!sidenotes.classList.replace(...arg)) {
sidenotes.classList.add(theme);
}
+ if (footnotes && !footnotes.classList.replace(...arg)) {
+ footnotes.classList.add(theme);
+ }
+
+
if (!harr.classList.replace(...arg)) {
harr.classList.add(theme);
}
+ for (let link of links) {
+ if (!link.classList.replace(...arg)) {
+ link.classList.add(theme);
+ }
+ }
+ for (let table of tables) {
+ if (!table.classList.replace(...arg)) {
+ table.classList.add(theme);
+ }
+ }
+ for (let like of likes) {
+ if (!like.classList.replace(...arg)) {
+ like.classList.add(theme);
+ }
+ }
+
for (const article of document.querySelectorAll('article')) {
if (!article.classList.replace(...arg)) {
article.classList.add(theme);