diff --git a/script.js b/script.js index 7f6d72f..e78a649 100644 --- a/script.js +++ b/script.js @@ -1,27 +1,6 @@ -document.addEventListener("onload", Init()); - -function Init() { - aggiungiDefault(); - impostaImmagine(); -} - -const segniZodiacali = [ - "Ariete", - "Toro", - "Gemelli", - "Cancro", - "Leone", - "Vergine", - "Bilancia", - "Scorpione", - "Sagittario", - "Capricorno", - "Acquario", - "Pesci", -]; /***********************************************Sezione Stats*******************************************************************************************/ -stats = { +let stats = { contatore: [ "conteggioTotale", "conteggioAriete", @@ -41,10 +20,52 @@ stats = { document.getElementById(this.contatore[segno]).innerHTML = parseInt(document.getElementById(this.contatore[segno]).innerHTML) + 1; }, + statsDefault() { + document.getElementById('stats').style.display = "none"; + document.getElementsByClassName('nomeRiquadro1')[0].style.display = "none"; + document.getElementsByClassName('nomeRiquadro3')[0].style.gridArea = "3 / 1 / 4 / 2"; + document.getElementsByClassName("segno")[0].style.gridArea = "4 / 1 / 5 / 2"; + + document.getElementsByClassName('nomeRiquadro2')[0].style.display = "none"; + document.getElementsByClassName('nomi')[0].style.display = "none"; + + }, + display() { + document.getElementById('stats').style.display = "block"; + document.getElementsByClassName('nomeRiquadro1')[0].style.display = "block"; + document.getElementsByClassName('nomeRiquadro3')[0].style.gridArea = "5 / 1 / 6 / 2"; + document.getElementsByClassName("segno")[0].style.gridArea = "6 / 1 / 7 / 2"; + + document.getElementsByClassName('nomeRiquadro2')[0].style.display = "block"; + document.getElementsByClassName('nomi')[0].style.display = "block"; + } }; /*******************************************************************************************************************************************************/ +document.addEventListener("onload", Init()); + +function Init() { + aggiungiDefault(); + impostaImmagine(); + stats.statsDefault(); +} + +const segniZodiacali = [ + "Ariete", + "Toro", + "Gemelli", + "Cancro", + "Leone", + "Vergine", + "Bilancia", + "Scorpione", + "Sagittario", + "Capricorno", + "Acquario", + "Pesci", +]; + /***********************************************Sezione Content*****************************************************************************************/ function Oroscopo() { @@ -133,6 +154,7 @@ function Oroscopo() { `conteggio${document.getElementById("segno").value}` ) ); + stats.display(); aggiungiNome();