Summary Files Commits Branches @commit @diff @stats
path: root / src / scripts
diff options
context:
space:
mode:
Commitf6c6f6cdc3cfcbebce28b74552af02f3d8c6efb7 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-09-11 18:43:47 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-09-11 18:43:47 +0300
Files5c5041b19047468a3e39fb4bf67cbd776a682847 /src/scripts
syndamia.com-f6c6f6cdc3cfcbebce28b74552af02f3d8c6efb7.tar
syndamia.com-f6c6f6cdc3cfcbebce28b74552af02f3d8c6efb7.tar.gz
syndamia.com-f6c6f6cdc3cfcbebce28b74552af02f3d8c6efb7.zip
Parentbd71a7f342ed31659b5f8231cba451f8819ea574 (diff)
(page-width,theme-changer) Updated label change to not remove the .br span
2 files changed, 8 insertions, 6 deletions
-rw-r--r--src/scripts/page-width.js7
-rw-r--r--src/scripts/theme-changer.js7
diff --git a/src/scripts/page-width.js b/src/scripts/page-width.js
index c77912c..9b632df 100644
--- a/src/scripts/page-width.js
+++ b/src/scripts/page-width.js
@@ -1,8 +1,9 @@
const widthBtn = document.getElementById('changeWidthBtn');
+const widthLabel = widthBtn.childNodes[0];
const articleElem = document.getElementsByTagName('article')[0];
if (localStorage.getItem('width') === 'wide') {
- widthBtn.innerText = 'Narrow\narticle';
+ widthLabel.innerText = 'Narrow';
articleElem.classList.add('noMaxWidth');
}
@@ -10,11 +11,11 @@ widthBtn.onclick = function() {
articleElem.classList.toggle('noMaxWidth');
if (localStorage.getItem('width') !== 'norm') {
- widthBtn.innerText = 'Wide\narticle';
+ widthLabel.innerText = 'Wide';
localStorage.setItem('width', 'norm');
}
else {
- widthBtn.innerText = 'Narrow\narticle';
+ widthLabel.innerText = 'Narrow';
localStorage.setItem('width', 'wide');
}
}
diff --git a/src/scripts/theme-changer.js b/src/scripts/theme-changer.js
index e2ad47f..3632084 100644
--- a/src/scripts/theme-changer.js
+++ b/src/scripts/theme-changer.js
@@ -1,17 +1,18 @@
const themeBtn = document.getElementById('changeThemeBtn');
+const themeLabel = themeBtn.childNodes[0];
if (darkThemeStyle.disabled)
- themeBtn.innerText = 'Dark\ntheme';
+ themeLabel.innerText = 'Dark';
themeBtn.onclick = function() {
darkThemeStyle.disabled = !darkThemeStyle.disabled;
if (localStorage.getItem('theme') !== 'light') {
- themeBtn.innerText = 'Dark\ntheme';
+ themeLabel.innerText = 'Dark';
localStorage.setItem('theme', 'light');
}
else {
- themeBtn.innerText = 'Light\ntheme';
+ themeLabel.innerText = 'Light';
localStorage.setItem('theme', 'dark');
}
}