|
@@ -1,4 +1,5 @@
|
|
|
var first = true;
|
|
|
+var uniqId = '0';
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
@@ -29,7 +30,7 @@ $(document).ready(function(){
|
|
|
return false;
|
|
|
}
|
|
|
//Envoi
|
|
|
- $.post('ajx/roll.php', {name: $("#name").val(), 'save-name': $('#save-name').val(), roll: $("#roll").val(), hide: $("#hide").val()}, function(data){
|
|
|
+ $.post('ajx/roll.php', {name: $("#name").val(), 'save-name': $('#save-name').val(), roll: $("#roll").val(), hide: $("#hide").prop('checked')}, function(data){
|
|
|
if(data.etat = 'ok'){
|
|
|
float_message(message_info('Resultat : ' + data.roll + ' / ' + data.dice));
|
|
|
reload(false);
|
|
@@ -48,10 +49,8 @@ $(document).ready(function(){
|
|
|
reload(true);
|
|
|
}
|
|
|
}).click();
|
|
|
- //Recharge toutes les minutes
|
|
|
- setTimeout(function(){
|
|
|
- reload(false);
|
|
|
- }, 30 * 1000);
|
|
|
+ //Recharge toutes les X secondes
|
|
|
+ perma_check();
|
|
|
|
|
|
//Reset
|
|
|
$('#reset').on('click', function(){
|
|
@@ -71,9 +70,29 @@ $(document).ready(function(){
|
|
|
|
|
|
});
|
|
|
|
|
|
+function check(){
|
|
|
+ console.log(uniqId);
|
|
|
+ $.post("ajx/check.php", {'id': uniqId}, function(data){
|
|
|
+ if(data.etat == 'ok'){
|
|
|
+ if(data.update){
|
|
|
+ reload(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+}
|
|
|
+
|
|
|
+function perma_check(time){
|
|
|
+ time = time || 15;
|
|
|
+ setTimeout(function(){
|
|
|
+ check();
|
|
|
+ perma_check(time);
|
|
|
+ }, time * 1000);
|
|
|
+}
|
|
|
+
|
|
|
function reload(msg){
|
|
|
$.post("ajx/score.php", null, function(data){
|
|
|
if(data.etat == 'ok'){
|
|
|
+ uniqId = data.uniqId;
|
|
|
$("#tbody").html(data.html);
|
|
|
$("#save-name").html(data.savename);
|
|
|
if(msg){
|