Template:Team:Paris Saclay/simbox

From 2013.igem.org

(Difference between revisions)
Line 28: Line 28:
  this.timestep= undefined;
  this.timestep= undefined;
  this.molecules= Array();
  this.molecules= Array();
 +
this.running= false;
}
}
Line 106: Line 107:
   {
   {
   reshtmlparamdiv += '<br /><br />';
   reshtmlparamdiv += '<br /><br />';
-
   reshtmlparamdiv += simulations[id].molecules[i].name + ' = <input id="simbox_ctl'+i+'" type="number" min="0" value="'+simulations[id].molecules[i].quantity+'"/>';
+
   reshtmlparamdiv += simulations[id].molecules[i].name + ' = <input id="simbox_ctl_'+id+'_'+i+'" type="number" min="0" value="'+simulations[id].molecules[i].quantity+'"/>';
   }
   }
  }
  }
  reshtmlparamdiv += '<br />';
  reshtmlparamdiv += '<br />';
  //controls
  //controls
-
  reshtmlparamdiv += '<button onclick="simbox_startclick(this,'+id+')">START</button><buttononclick="simbox_resetclick(this,'+id+')">RESET</button>'
+
  reshtmlparamdiv += '<button onclick="simbox_startclick(this,'+id+')" id="simbox_start_'+id+'">PLAY</button><button onclick="simbox_resetclick(this,'+id+')" id="simbox_stop_'+id+'">RESET</button>'
  paramdiv.innerHTML= reshtmlparamdiv;
  paramdiv.innerHTML= reshtmlparamdiv;
Line 118: Line 119:
  return true;
  return true;
 +
}
 +
 +
function simbox_startclick(btn, simid)
 +
{
 +
if(simulations[simid].running)
 +
{
 +
  //TODO PAUSE
 +
  simulations[simid].running= false;
 +
  btn.innerHTML= 'PLAY';
 +
}
 +
else
 +
{
 +
  //TODO START
 +
  simulations[simid].running= true;
 +
  btn.innerHTML= 'PAUSE';
 +
}
}
}

Revision as of 21:32, 2 August 2013