From aec7a6d22754a024c73db0ebceb7bb5bc30f51bb Mon Sep 17 00:00:00 2001 From: Lewis Dale Date: Wed, 27 Sep 2023 19:07:35 +0100 Subject: [PATCH] Simplify code a bit --- src/_includes/base.njk | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/_includes/base.njk b/src/_includes/base.njk index 8db9eb0..15bd190 100644 --- a/src/_includes/base.njk +++ b/src/_includes/base.njk @@ -71,9 +71,6 @@ set: (obj, key, value) => { obj[key] = value; localStorage.setItem(key, value); - document.querySelectorAll(`[type="radio"][name="${key}"]`).forEach(radio => { - radio.checked = radio.value === value; - }); document.body.setAttribute(`data-${key}`, value); return true; @@ -88,7 +85,7 @@ radio.addEventListener('change', onRadioChange); radio.checked = data[radio.name] == radio.value; }); - document.body.setAttribute(`data-color-scheme`, data['color-scheme']); + document.body.setAttribute(`data-color-scheme`, localStorage.getItem('color-scheme'));