From 7836015a6d319753e86f8f9de98976cadbe8bb4f Mon Sep 17 00:00:00 2001 From: adplantade Date: Thu, 13 Aug 2020 20:45:25 +0200 Subject: [PATCH] correction affichage "both" dans le modal --- code/options.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/code/options.js b/code/options.js index 586701d..2d729d9 100644 --- a/code/options.js +++ b/code/options.js @@ -13,6 +13,12 @@ btn.onclick = function() { document.getElementById("color_pickers").style.display= (displ!="points" ? "none" : "inline"); document.getElementById("gems_picker").style.display= (displ=="points" ? "none" : "inline"); document.getElementById(getCookie("displayMode")+"_di").classList.add(selectedTheme); + if(displ=="both") + { + applyBackgrounds(); + + backgroundBoth(); + } } // When the user clicks on (x), close the modal @@ -31,6 +37,12 @@ window.onclick = function(event) { document.getElementById("displays").addEventListener("click", function(){ document.getElementById("color_pickers").style.display= (displ!="points" ? "none" : "inline"); document.getElementById("gems_picker").style.display= (displ=="points" ? "none" : "inline"); + if(displ=="both") + { + applyBackgrounds(); + + backgroundBoth(); + } }) function saveOptions() { @@ -58,11 +70,11 @@ function selectDisplay(e) document.getElementById("both_di").classList.remove(selectedTheme); document.getElementById(e+"_di").classList.add(selectedTheme); backgroundBoth(); - dispDots(); if(displ=="both") { applyBackgrounds(); } + dispDots(); } function backgroundBoth() @@ -179,13 +191,14 @@ function applyBackgrounds() for(var cpt=1;cpt<9;cpt++) { var target = document.getElementById("slot"+cpt); + target.classList.add("dot"); target.style.backgroundColor=target.children[0].src.substring(target.children[0].src.search("/ress")+6); - console.log("cookie avant : "+getCookie("gem"+cpt)); + //console.log("cookie avant : "+getCookie("gem"+cpt)); setCookie("gem"+cpt,target.style.backgroundColor,30); - console.log("cookie après : "+getCookie("gem"+cpt)); + //console.log("cookie après : "+getCookie("gem"+cpt)); //console.log("trg : "+target.id+ "|"+target.children[0].src.substring(target.children[0].src.search("/ress")+6)); } - console.log("--------"); + //console.log("--------"); } var gemsAvailable=["green","yellow","cyan","red","purple","orange","brown","black"]; @@ -194,7 +207,7 @@ var gemsSelected=[]; for(var cpt=0;cpt<8;cpt++) { gemsSelected[cpt]= (getCookie("gem"+(cpt+1))=="" ? gemsAvailable[cpt] : getCookie("gem"+(cpt+1))); - console.log("get : "+gemsSelected[cpt]); + //console.log("get : "+gemsSelected[cpt]); } for(var cpt=1;cpt<9;cpt++)