Implement countdown timer

This commit is contained in:
Pierre 2018-01-03 12:28:46 +01:00
parent 6f46799a6f
commit c01f081135

View File

@ -226,6 +226,26 @@ ComunicWeb.components.posts.ui = {
} }
//In case of countdown timer
else if (infos.kind == "countdown"){
//Create countdown target
var target = createElem2({
appendTo: postRoot,
type: "div",
class: "post-countdown"
});
//Set the date of the countdown time
var date = new Date();
date.setFullYear(infos.year_end);
date.setMonth(infos.month_end - 1); //Months starts from 0 (january) to 11 (december)
date.setDate(infos.day_end);
//Initialize countdown timer
ComunicWeb.components.countdown.init(date, target);
}
//If the kind of post was not implemented //If the kind of post was not implemented
else { else {
//Log error //Log error
@ -244,7 +264,6 @@ ComunicWeb.components.posts.ui = {
//Add bottom elements container //Add bottom elements container
var bottomArea = createElem2({ var bottomArea = createElem2({
appendTo: postRoot, appendTo: postRoot,