jede uhr hat eine eigene id
This commit is contained in:
		
							parent
							
								
									a28dcdf836
								
							
						
					
					
						commit
						66283e3424
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		
							
								
								
									
										6
									
								
								uhr.js
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								uhr.js
									
										
									
									
									
								
							|  | @ -18,6 +18,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  * @param themeElement Das HTML-Stylesheet-Tag, das das Theme-CSS referenziert. |  * @param themeElement Das HTML-Stylesheet-Tag, das das Theme-CSS referenziert. | ||||||
|  */ |  */ | ||||||
| function Uhr(clockarea, themeElement) { | function Uhr(clockarea, themeElement) { | ||||||
|  | 	this.id = Uhr.id++; | ||||||
| 	this.clockarea = this.initClockarea(clockarea); | 	this.clockarea = this.initClockarea(clockarea); | ||||||
| 	this.toggleSwitch = this.initToggleSwitch(); | 	this.toggleSwitch = this.initToggleSwitch(); | ||||||
| 	this.letterarea = clockarea.find('.letterarea'); | 	this.letterarea = clockarea.find('.letterarea'); | ||||||
|  | @ -27,6 +28,7 @@ function Uhr(clockarea, themeElement) { | ||||||
| 	this.currentLayout = Uhr.layouts['undefined']; | 	this.currentLayout = Uhr.layouts['undefined']; | ||||||
| 	this.currentMinute = -1; | 	this.currentMinute = -1; | ||||||
| } | } | ||||||
|  | Uhr.id = 0; | ||||||
| Uhr.layouts = new Array(); | Uhr.layouts = new Array(); | ||||||
| Uhr.register = function (locale, layout) { | Uhr.register = function (locale, layout) { | ||||||
| 	Uhr.layouts[locale] = layout; | 	Uhr.layouts[locale] = layout; | ||||||
|  | @ -150,13 +152,13 @@ Uhr.prototype.initClockarea = function(clockarea) { | ||||||
| } | } | ||||||
| Uhr.prototype.initToggleSwitch = function() { | Uhr.prototype.initToggleSwitch = function() { | ||||||
| 	var toggleSwitch = $('<div class="onoffswitch"></div>'); | 	var toggleSwitch = $('<div class="onoffswitch"></div>'); | ||||||
| 	var input = $('<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="onoffswitch" checked="checked" />'); | 	var input = $('<input type="checkbox" name="onoffswitch' + this.id + '" class="onoffswitch-checkbox" id="onoffswitch' + this.id + '" checked="checked" />'); | ||||||
| 	var uhr = this; | 	var uhr = this; | ||||||
| 	input.on('click', function() { | 	input.on('click', function() { | ||||||
| 		uhr.toggle(); | 		uhr.toggle(); | ||||||
| 	}); | 	}); | ||||||
| 	toggleSwitch.append(input); | 	toggleSwitch.append(input); | ||||||
| 	toggleSwitch.append('<label class="onoffswitch-label" for="onoffswitch">' | 	toggleSwitch.append('<label class="onoffswitch-label" for="onoffswitch' + this.id + '">' | ||||||
| 		+ '<div class="onoffswitch-inner"></div>' | 		+ '<div class="onoffswitch-inner"></div>' | ||||||
| 		+ '<div class="onoffswitch-switch"></div>' | 		+ '<div class="onoffswitch-switch"></div>' | ||||||
| 		+ '</label>'); | 		+ '</label>'); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue