Skip to content
Snippets Groups Projects
Commit 3424adbd authored by Millicent Billette's avatar Millicent Billette
Browse files

FIX: button qui restaait rouge quand c'est fini

parent 98ee9932
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,10 @@ function combiTested(event){
document.getElementById("resSeed").innerText = event.data.seed;
stopNow();
}
if(tested === combi) document.getElementById("percent").innerHTML = "Fini sans résultats";
if(tested === combi) {
document.getElementById("percent").innerHTML = "Fini sans résultats";
idleStateBtn();
}
}
......@@ -58,9 +61,16 @@ function updateEstimate(){
document.getElementById("combi").innerHTML = idSecList.length*passList.length;
document.getElementById("temps").innerHTML = "< "+(idSecList.length*passList.length/10)+"s";
}
function stopNow(){
function idleStateBtn(){
document.getElementById("compute").innerText = "Gsper !";
document.getElementById("compute").classList.remove("abort");
}
function workingStateBtn() {
document.getElementById("compute").innerText = "Stop !";
document.getElementById("compute").classList.add("abort");
}
function stopNow(){
idleStateBtn();
for (let i=0;i<navigator.hardwareConcurrency;i++) workers[i].terminate();
setTimeout(startWorkers,0);
tested = 0;
......@@ -71,8 +81,7 @@ document.getElementById("compute").addEventListener("click", e=>{
const passList = multiLineString2cleanArray(document.getElementById("pass").value);
combi = idSecList.length*passList.length;
if(tested<combi && tested>0) return stopNow();
document.getElementById("compute").innerText = "Stop !";
document.getElementById("compute").classList.add("abort");
workingStateBtn();
departTime = Date.now();
updateEstimate();
document.getElementById("percent").innerHTML = "0%";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment