From e79a8bcd7d1d0c52a3db71ec0b097f0ba0b0059e Mon Sep 17 00:00:00 2001 From: Fauvet Matthis Date: Fri, 21 Jun 2024 01:28:13 +0200 Subject: [PATCH] clean code --- onzer.riot | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/onzer.riot b/onzer.riot index c48bef8..55686c6 100644 --- a/onzer.riot +++ b/onzer.riot @@ -24,12 +24,8 @@ }, click(e) { e.preventDefault(); - document.getElementById("song").style.backgroundColor = "#D1FAE5"; - document.getElementById("song").style.borderColor = "#6EE7B7"; - document.getElementById("album").style.backgroundColor = "#D1FAE5"; - document.getElementById("album").style.borderColor = "#6EE7B7"; - document.getElementById("artist").style.backgroundColor = "#D1FAE5"; - document.getElementById("artist").style.borderColor = "#6EE7B7"; + + this.clearButton(); switch (e.target.attributes.value.value) { case 'Songs': @@ -48,6 +44,14 @@ document.getElementById("album").style.borderColor = "#059669"; }; this.update(); + }, + clearButton() { + document.getElementById("song").style.backgroundColor = "#D1FAE5"; + document.getElementById("song").style.borderColor = "#6EE7B7"; + document.getElementById("album").style.backgroundColor = "#D1FAE5"; + document.getElementById("album").style.borderColor = "#6EE7B7"; + document.getElementById("artist").style.backgroundColor = "#D1FAE5"; + document.getElementById("artist").style.borderColor = "#6EE7B7"; } }