mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Implement countdown timer
This commit is contained in:
parent
6f46799a6f
commit
c01f081135
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user