mirror of
				https://github.com/flynx/Slang.git
				synced 2025-10-31 03:20:09 +00:00 
			
		
		
		
	added timer constructor...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									472061e96a
								
							
						
					
					
						commit
						d7ec86d36f
					
				| @ -69,6 +69,17 @@ | |||||||
| 	border-right: solid 10px gray; | 	border-right: solid 10px gray; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | #new_timer { | ||||||
|  | 	width: 40px; | ||||||
|  | 	height: 40px; | ||||||
|  | 	margin: 10px; | ||||||
|  | 	border: solid 1px gray; | ||||||
|  | 	border-radius: 50%; | ||||||
|  | 	color: gray; | ||||||
|  | 	font-size: 39px; | ||||||
|  | 	text-align: center; | ||||||
|  | 	cursor: hand; | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| </style> | </style> | ||||||
| 
 | 
 | ||||||
| @ -114,6 +125,15 @@ function formatSum(m){ | |||||||
| 			'<span title="Minutes">m:<span>'+ m +'</span></span>' | 			'<span title="Minutes">m:<span>'+ m +'</span></span>' | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function createTimer(parent){ | ||||||
|  | 	var timer = document.createElement('div') | ||||||
|  | 	timer.className = 'timer' | ||||||
|  | 	timer.innerHTML = '<div class="sum">0</div>' | ||||||
|  | 	parent.appendChild(timer) | ||||||
|  | 
 | ||||||
|  | 	timer.setAttribute('onclick', 'toggleTimer(this)') | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function toggleTimer(elem){ | function toggleTimer(elem){ | ||||||
| 	elem = elem | 	elem = elem | ||||||
| 	var t = elem.getAttribute('timer')*1 | 	var t = elem.getAttribute('timer')*1 | ||||||
| @ -182,18 +202,20 @@ function toggleTimer(elem){ | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | function setup(){ | ||||||
|  | 	//createTimer(document.getElementById('timers')) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| </head> | </head> | ||||||
| <body> | <body onload="setup()"> | ||||||
| 
 | 
 | ||||||
| <div class="timer" onclick="toggleTimer(this)"> | <div id="timers"></div> | ||||||
| 	<div class="sum">0</div> | <div id="new_timer" title="Add new timer" onclick="createTimer(document.getElementById('timers'))">+</div> | ||||||
| </div> |  | ||||||
| 
 | 
 | ||||||
| <div class="timer" onclick="toggleTimer(this)"> |  | ||||||
| 	<div class="sum">0</div> |  | ||||||
| </div> |  | ||||||
| 
 | 
 | ||||||
| </body> | </body> | ||||||
| <!-- vim:set ts=4 sw=4 : --> | <!-- vim:set ts=4 sw=4 : --> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user