correction de la sauvegarde des gemmes

master
adplantade 5 years ago
parent 7dd7fbbd9a
commit 18d74f6537

@ -59,6 +59,10 @@ function selectDisplay(e)
document.getElementById(e+"_di").classList.add("selected"); document.getElementById(e+"_di").classList.add("selected");
backgroundBoth(); backgroundBoth();
dispDots(); dispDots();
if(displ=="both")
{
applyBackgrounds();
}
} }
function backgroundBoth() function backgroundBoth()
@ -166,7 +170,7 @@ function drop(ev) {
target.style.backgroundColor=target.children[0].src.substring(target.children[0].src.search("/ress")+6);*/ target.style.backgroundColor=target.children[0].src.substring(target.children[0].src.search("/ress")+6);*/
applyBackgrounds(); applyBackgrounds();
} }
gemBake(); //gemBake();
} }
} }
@ -176,7 +180,12 @@ function applyBackgrounds()
{ {
var target = document.getElementById("slot"+cpt); var target = document.getElementById("slot"+cpt);
target.style.backgroundColor=target.children[0].src.substring(target.children[0].src.search("/ress")+6); target.style.backgroundColor=target.children[0].src.substring(target.children[0].src.search("/ress")+6);
console.log("cookie avant : "+getCookie("gem"+cpt));
setCookie("gem"+cpt,target.style.backgroundColor,30);
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("--------");
} }
var gemsAvailable=["green","yellow","cyan","red","purple","orange","brown","black"]; var gemsAvailable=["green","yellow","cyan","red","purple","orange","brown","black"];
@ -185,6 +194,7 @@ var gemsSelected=[];
for(var cpt=0;cpt<8;cpt++) for(var cpt=0;cpt<8;cpt++)
{ {
gemsSelected[cpt]= (getCookie("gem"+(cpt+1))=="" ? gemsAvailable[cpt] : getCookie("gem"+(cpt+1))); gemsSelected[cpt]= (getCookie("gem"+(cpt+1))=="" ? gemsAvailable[cpt] : getCookie("gem"+(cpt+1)));
console.log("get : "+gemsSelected[cpt]);
} }
for(var cpt=1;cpt<9;cpt++) for(var cpt=1;cpt<9;cpt++)
@ -209,9 +219,12 @@ function resetGems()
{ {
setCookie("gem"+cpt,"",30); setCookie("gem"+cpt,"",30);
document.getElementById("slot"+cpt).appendChild(eval("gemIcon_"+gemsAvailable[cpt-1])); document.getElementById("slot"+cpt).appendChild(eval("gemIcon_"+gemsAvailable[cpt-1]));
//console.log("sl "+"slot"+cpt+" | "+"gemIcon_"+gemsAvailable[cpt-1]);
} }
if(displ=="both") if(displ=="both")
{ {
//backgroundBoth();
applyBackgrounds(); applyBackgrounds();
} }
} }
Loading…
Cancel
Save