|
|
|
@ -85,7 +85,7 @@ $("#register-button").click(function (e) { |
|
|
|
}); |
|
|
|
if( $("#register-password-confirm").val() != $("#register-password").val()) { |
|
|
|
t = new TypeIt('#error-message-register', { |
|
|
|
speed: 110, |
|
|
|
speed: 100, |
|
|
|
lifeLike: true |
|
|
|
}) |
|
|
|
.type("Oups, les 2 mots de passe ne correspondent pas !") |
|
|
|
@ -598,8 +598,17 @@ function refreshListener() { |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
$(".treasure-btn-submit").click((e) => { |
|
|
|
let uid = e.target.parentNode.parentNode.id; |
|
|
|
|
|
|
|
$('.overlay').css({"opacity": 1, "visibility": "visible"}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
$('.close').click((e) => { |
|
|
|
$('.overlay').css({"opacity": 0, "visibility": "hidden"}); |
|
|
|
}); |
|
|
|
|
|
|
|
$('#demande-button').click(function () { |
|
|
|
$.ajax({ |
|
|
|
type: "POST", |
|
|
|
@ -688,12 +697,85 @@ function updateDemandes() { |
|
|
|
if (data.why == "Not authentificated") { |
|
|
|
show_page('#login-page'); |
|
|
|
} else { |
|
|
|
alert(data.why); |
|
|
|
console.alert(data.why); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
$.ajax({ |
|
|
|
type: "POST", |
|
|
|
url: base_url + "get", |
|
|
|
data: JSON.stringify({ |
|
|
|
uid: localStorage.getItem('user'), |
|
|
|
token: localStorage.getItem('token'), |
|
|
|
type: "activity" |
|
|
|
|
|
|
|
}), |
|
|
|
contentType: "application/json; charset=utf-8", |
|
|
|
dataType: "json", |
|
|
|
|
|
|
|
success: function (data) { |
|
|
|
if(data.success) { |
|
|
|
$('#treasure-list').html(''); |
|
|
|
|
|
|
|
let ad = data.activityData; |
|
|
|
|
|
|
|
for(const ad_uid in ad) { |
|
|
|
if(ad[ad_uid].type == "treasure") { |
|
|
|
$('#treasure-list').append(` |
|
|
|
<span id="${ad_uid}" class="treasure ${ad[ad_uid].treasureState == "Accepted" ? "treasure-accepted" : ""}"> |
|
|
|
<h2 class="treasure-title">${ad[ad_uid].title}</h2> |
|
|
|
<div class="treasure-desc">Indice: ${ad[ad_uid].desc}</div> |
|
|
|
<div class="treasure-status">Statue: ${ad[ad_uid].treasureState}</div> |
|
|
|
${ (ad[ad_uid].treasureState != "Accepted" && ad[ad_uid].treasureState != "Refused" ) ? |
|
|
|
`<span class="treasure-btn">
|
|
|
|
<div class="treasure-btn-submit">Soumettre sa résolution</div> |
|
|
|
</span>` |
|
|
|
: '' |
|
|
|
} |
|
|
|
</span> |
|
|
|
`)
|
|
|
|
} |
|
|
|
} |
|
|
|
refreshListener(); |
|
|
|
} |
|
|
|
else { |
|
|
|
console.alert(data.why); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
$.ajax({ |
|
|
|
type: "POST", |
|
|
|
url: base_url + "get", |
|
|
|
data: JSON.stringify({ |
|
|
|
uid: localStorage.getItem('user'), |
|
|
|
token: localStorage.getItem('token'), |
|
|
|
type: "treasure" |
|
|
|
|
|
|
|
}), |
|
|
|
contentType: "application/json; charset=utf-8", |
|
|
|
dataType: "json", |
|
|
|
|
|
|
|
success: function (data) { |
|
|
|
if(data.success) { |
|
|
|
let td = data.treasureData; |
|
|
|
|
|
|
|
for(const td_uid in td) { |
|
|
|
$elem = $('#' + td_uid); |
|
|
|
$elem.addClass('treasure-submitted'); |
|
|
|
$elem.children(".treasure-button-submit").text('Editer la soumission'); |
|
|
|
$elem.children('.treasure-desc').insertAfter(`<div class="treasure-image">Image: <a href="${base_url}images/${td[td_uid].image}.html" target="_blank"> Lien</a></div>`) |
|
|
|
|
|
|
|
} |
|
|
|
refreshListener(); |
|
|
|
} |
|
|
|
else { |
|
|
|
console.alert(data.why); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -739,7 +821,7 @@ function updateNextActivity() { |
|
|
|
let h = Math.trunc(diff / 3600) - days*24 |
|
|
|
let m = Math.trunc(diff / 60) - (h + days*24)*60 |
|
|
|
let s = diff - h*3600 - m*60 - days*24*3600 |
|
|
|
$('#timer').text(days + " jours " + (new Date('December 17, 1995 ' + [h, m, s].join(':'))).toLocaleTimeString('default', { |
|
|
|
$('#timer').text((days == 0 ? "" : days + " jours ") + (new Date('December 17, 1995 ' + [h, m, s].join(':'))).toLocaleTimeString('default', { |
|
|
|
hour: '2-digit', |
|
|
|
minute: '2-digit', |
|
|
|
second: '2-digit' |
|
|
|
@ -764,8 +846,13 @@ $(window).on("load", function() { |
|
|
|
/* load timer */ |
|
|
|
window.setInterval(function() { |
|
|
|
var b = $("#timer").text().split(' jours '); |
|
|
|
var time = b[1]; |
|
|
|
var days = b[0]; |
|
|
|
if(b.length == 2) { |
|
|
|
var time = b[1]; |
|
|
|
var days = b[0]; |
|
|
|
} else { |
|
|
|
var time = b[0]; |
|
|
|
var days = 0; |
|
|
|
} |
|
|
|
var t = time.split(":").map(t => parseInt(t)); |
|
|
|
|
|
|
|
t[2] -= 1; |
|
|
|
|