let num = document.querySelector(".numbox"),
counting;
// console.log('1');
function count() {
// console.log('2');
$.get('https://account.msi.com/api/event/2021_oct_farcry6_tr', function(data) {
$('.numbox').text(data)
// console.log(data);
data == 0 ? stopCount() : null;
});
}
count();
function keepCount() {
counting = setTimeout(() => {
count();
keepCount();
}, 60000);
}
keepCount();
function stopCount() {
clearTimeout(counting);
}
$(function() {
//----- OPEN
$("[data-pd-popup-open]").on("click", function(e) {
var targeted_popup_class = $(this).attr("data-pd-popup-open");
$('[data-pd-popup="' + targeted_popup_class + '"]').fadeIn(100);
$("body").addClass("popup-open");
e.preventDefault();
});
//----- CLOSE
$("[data-pd-popup-close]").on("click", function(e) {
var targeted_popup_class = $(this).attr("data-pd-popup-close");
$('[data-pd-popup="' + targeted_popup_class + '"]').fadeOut(200);
$("body").removeClass("popup-open");
e.preventDefault();
});
});