mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Implement countdown timer
This commit is contained in:
		@@ -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
 | 
			
		||||
		else {
 | 
			
		||||
			//Log error
 | 
			
		||||
@@ -244,7 +264,6 @@ ComunicWeb.components.posts.ui = {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		//Add bottom elements container
 | 
			
		||||
		var bottomArea = createElem2({
 | 
			
		||||
			appendTo: postRoot,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user