From f6c6f6cdc3cfcbebce28b74552af02f3d8c6efb7 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 11 Sep 2023 18:43:47 +0300 Subject: (page-width,theme-changer) Updated label change to not remove the .br span --- src/scripts/page-width.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/scripts/page-width.js') 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'); } } -- cgit v1.3.1-23-gd82d