factorization
All checks were successful
ci/woodpecker/push/publish Pipeline was successful

This commit is contained in:
Mylloon 2023-04-29 15:26:55 +02:00
parent fb6c9780f6
commit bc73c88562
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -21,7 +21,7 @@ window.addEventListener("load", () => {
/* Theme */ /* Theme */
const dark = "dark"; const dark = "dark";
const light = "light"; const light = "light";
const attribute = ["disabled", "disabled"]; const attribute = "disabled";
const updateTheme = (theme) => { const updateTheme = (theme) => {
{ {
const elementToEnable = document.getElementById( const elementToEnable = document.getElementById(
@ -31,10 +31,10 @@ window.addEventListener("load", () => {
`hljs-${theme.matches ? light : dark}-theme` `hljs-${theme.matches ? light : dark}-theme`
); );
if (elementToEnable.hasAttribute(attribute[0])) { if (elementToEnable.hasAttribute(attribute)) {
elementToEnable.removeAttribute(attribute[0]); elementToEnable.removeAttribute(attribute);
} }
elementToDisable.setAttribute(...attribute); elementToDisable.setAttribute(attribute, attribute);
} }
}; };