From f65b8f5f2912017fcfd7c0345143e53088988fee Mon Sep 17 00:00:00 2001 From: adplantade Date: Mon, 10 Aug 2020 18:29:23 +0200 Subject: [PATCH] =?UTF-8?q?g=C3=A9n=C3=A9ration=20apr=C3=A8s=20cliquer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/vitraux.js | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/code/vitraux.js b/code/vitraux.js index 8f1ae43..5d108e7 100644 --- a/code/vitraux.js +++ b/code/vitraux.js @@ -26,6 +26,7 @@ tabObjCmp=[]; mousePos=[]; var pause=getCookie("pause"); +var won=false; var displayType = getCookie("displayMode")=="" ? "gems" : getCookie("displayMode"); @@ -551,7 +552,7 @@ function checkAllOK(justChecking=false){ if(pause) chronoStop(); handleScore(1); - generate(); + won=true; } else if(justChecking) { @@ -578,22 +579,19 @@ function handleScore(modif) { points+=modif; document.getElementById("stats").innerHTML = points+" points"; + + document.getElementById("canvasObj").classList.add("win"); + document.getElementById("canvasTotal").classList.add("win"); + for(var cpt=1;cpt<5;cpt++) { document.getElementById("canvas"+cpt).classList.add("win"); } - - setTimeout(function() - { - for(var cpt=1;cpt<5;cpt++) - { - document.getElementById("canvas"+cpt).classList.remove("win"); - } - }, 1000); if(objPts!=null && points==objPts) { chronoStop(); + var pts = diff.getSeconds()+ (diff.getMinutes()*60) + ((diff.getHours()-1)*3600); window.location.replace("./score.php?pts="+pts+"&mode="+get['mode']+"&diff="+get['diff']+"&pseudo="+get['pseudo']); } @@ -682,6 +680,21 @@ function events() { function mdManager(e){ mousePos = [e.currentTarget.id.substring(6),compas(e.clientX,e.clientY,e.currentTarget)]; + + document.getElementById("canvasObj").classList.remove("win"); + document.getElementById("canvasTotal").classList.remove("win"); + + for(var cpt=1;cpt<5;cpt++) + { + document.getElementById("canvas"+cpt).classList.remove("win"); + } + + if(won) + { + won=!won; + generate(); + } + if(paused) chronoContinue(); document.getElementById(e.currentTarget.id).classList.add('vitrail-select');