1. Stefan Scherfke
  2. Tea Timer

Commits

Stefan Scherfke  committed 65e65cd

Replaced tabs with spaces.

  • Participants
  • Parent commits add131e
  • Branches default

Comments (0)

Files changed (10)

File Tea Timer.wdgt/Info.plist

View file
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
-<dict>	
-	<key>CFBundleDisplayName</key>
-	<string>Tea Timer</string>
-	<key>CFBundleIdentifier</key>
-	<string>org.sofa-rockers.widget.TeaTimer</string>
-	<key>CFBundleName</key>
-	<string>Tea Timer</string>
-	<key>CFBundleVersion</key>
-	<string>1.7.1</string>
-	<key>MainHTML</key>
-	<string>TeaTimer.html</string>
-	<key>CloseBoxInsetX</key>
-	<integer>15</integer>
-	<key>CloseBoxInsetY</key>
-	<integer>15</integer>
-	<key>Width</key>
-	<string>320</string>
-	<key>Height</key>
-	<string>150</string>
-	<key>AllowSystem</key>
-	<true/>
-	<key>AllowNetworkAccess</key>
-	<true/>
-	<key>AllowInternetPlugins</key>
-	<true/>
+<dict>
+    <key>CFBundleDisplayName</key>
+    <string>Tea Timer</string>
+    <key>CFBundleIdentifier</key>
+    <string>org.sofa-rockers.widget.TeaTimer</string>
+    <key>CFBundleName</key>
+    <string>Tea Timer</string>
+    <key>CFBundleVersion</key>
+    <string>1.7.1</string>
+    <key>MainHTML</key>
+    <string>TeaTimer.html</string>
+    <key>CloseBoxInsetX</key>
+    <integer>15</integer>
+    <key>CloseBoxInsetY</key>
+    <integer>15</integer>
+    <key>Width</key>
+    <string>320</string>
+    <key>Height</key>
+    <string>150</string>
+    <key>AllowSystem</key>
+    <true/>
+    <key>AllowNetworkAccess</key>
+    <true/>
+    <key>AllowInternetPlugins</key>
+    <true/>
 </dict>
 </plist>

File Tea Timer.wdgt/Scripts/Back.js

View file
  * This class encapsules all functions for the front side of the widget.
  */
 function Back() {
-	this.designTab = null;
-	this.alarmTab = null;
-	this.currentPrefs = null;
-	this.imgPrefix = 'Images/button';
-	this.inactiveTabFontColor = '#CCC';
-	this.prefBodyHeights = {
-		'Design': 45.,
-		'Alarm': 70.
-	}
-	this._init();
+    this.designTab = null;
+    this.alarmTab = null;
+    this.currentPrefs = null;
+    this.imgPrefix = 'Images/button';
+    this.inactiveTabFontColor = '#CCC';
+    this.prefBodyHeights = {
+        'Design': 45.,
+        'Alarm': 70.
+    }
+    this._init();
 }
 
 /**
  * Init the tab bar and setup event handling.
  */
 Back.prototype._init = function() {
-	this.createDesignTabButtons();
-	this.createAlarmTabButtons();
-	$('#tabDesign_active').css('display', 'inline');
-	$('#tabAlarm').css('display', 'inline');
-	$('#prefsDesign').css({'display': 'block', 'opacity': '1.0'});
-	this.currentPrefs = 'Design';
+    this.createDesignTabButtons();
+    this.createAlarmTabButtons();
+    $('#tabDesign_active').css('display', 'inline');
+    $('#tabAlarm').css('display', 'inline');
+    $('#prefsDesign').css({'display': 'block', 'opacity': '1.0'});
+    this.currentPrefs = 'Design';
 
     $('#version').text(updater.getVersion());
-	$('#homeLink').click(function(event) {
-		widget.openURL('http://stefan.sofa-rockers.org');
-	});
-	$('#backgroundColor').change(function(event) {
-		$('#front').css('background', 'url(Images/Front_' + event.target.value
-			+ '.png) no-repeat');
-		setPrefForKey(event.target.value, widget.identifier, 'background');
-	});
-	$('#alarmSound').change(function(event) {
-		alarm.sound = event.target.value;
-		timer.alarm('sound');
-		setPrefForKey(event.target.value, widget.identifier, 'alarm.sound');
-	});
-	$('#alarmVoice').change(function(event) {
-		alarm.voice = event.target.value;
-		timer.alarm('voice');
-		setPrefForKey(event.target.value, widget.identifier, 'alarm.voice');
-	});
-	$('#alarmGrowl').change(function(event) {
-		alarm.growl = event.target.value;
-		timer.alarm('growl');
-		setPrefForKey(event.target.value, widget.identifier, 'alarm.growl');
-	});
-	$('#alarmKeepAlarming').change(function(event) {
-		alarm.keepAlarming = event.target.value;
-		setPrefForKey(event.target.value, widget.identifier,
-		        'alarm.keepAlarming');
-	});
+    $('#homeLink').click(function(event) {
+        widget.openURL('http://stefan.sofa-rockers.org');
+    });
+    $('#backgroundColor').change(function(event) {
+        $('#front').css('background', 'url(Images/Front_' + event.target.value
+            + '.png) no-repeat');
+        setPrefForKey(event.target.value, widget.identifier, 'background');
+    });
+    $('#alarmSound').change(function(event) {
+        alarm.sound = event.target.value;
+        timer.alarm('sound');
+        setPrefForKey(event.target.value, widget.identifier, 'alarm.sound');
+    });
+    $('#alarmVoice').change(function(event) {
+        alarm.voice = event.target.value;
+        timer.alarm('voice');
+        setPrefForKey(event.target.value, widget.identifier, 'alarm.voice');
+    });
+    $('#alarmGrowl').change(function(event) {
+        alarm.growl = event.target.value;
+        timer.alarm('growl');
+        setPrefForKey(event.target.value, widget.identifier, 'alarm.growl');
+    });
+    $('#alarmKeepAlarming').change(function(event) {
+        alarm.keepAlarming = event.target.value;
+        setPrefForKey(event.target.value, widget.identifier,
+                'alarm.keepAlarming');
+    });
 };
 
 /**
  * and parses its output.
  */
 Back.prototype._getItemList = function(what, elemId) {
-	var cmd = '/usr/bin/python2.7 util.py ' + what
-	var output = widget.system(cmd, null).outputString;
-	var items = $.trim(output).split(',');
-	sel = $('#' + elemId);
-	for (var i in items) {
-		sel.append('<option value="' + items[i] + '">' + items[i] +
-				'</option>');
-	}
+    var cmd = '/usr/bin/python2.7 util.py ' + what
+    var output = widget.system(cmd, null).outputString;
+    var items = $.trim(output).split(',');
+    sel = $('#' + elemId);
+    for (var i in items) {
+        sel.append('<option value="' + items[i] + '">' + items[i] +
+                '</option>');
+    }
 };
 
 /**
  * @param event: The js event.
  */
 Back.prototype.onDesignTabClicked = function(event) {
-	back.switchToPrefs('Design');
+    back.switchToPrefs('Design');
 };
 
 /**
  * @param event: The js event.
  */
 Back.prototype.onAlarmTabClicked = function(event) {
-	back.switchToPrefs('Alarm');
+    back.switchToPrefs('Alarm');
 };
 
 /**
  * @param prefs: The new prefs to show
  */
 Back.prototype.switchToPrefs = function(prefs) {
-	if (prefs == back.currentPrefs)
-		return;
+    if (prefs == back.currentPrefs)
+        return;
 
-	$('#tab' + back.currentPrefs + '_active').css('display', 'none');
-	$('#tab' + back.currentPrefs).css('display', 'inline');
-	back.fadeOutPanel = '#prefs' + back.currentPrefs;
+    $('#tab' + back.currentPrefs + '_active').css('display', 'none');
+    $('#tab' + back.currentPrefs).css('display', 'inline');
+    back.fadeOutPanel = '#prefs' + back.currentPrefs;
 
-	$('#tab' + prefs).css('display', 'none');
-	$('#tab' + prefs + '_active').css('display', 'inline');
-	$('#prefs' + prefs).css('display', 'block');
-	back.fadeInPanel = '#prefs' + prefs;
+    $('#tab' + prefs).css('display', 'none');
+    $('#tab' + prefs + '_active').css('display', 'inline');
+    $('#prefs' + prefs).css('display', 'block');
+    back.fadeInPanel = '#prefs' + prefs;
 
-	var animator = new AppleAnimator(300, 10);
-	var fadeAni = new AppleAnimation(1.0, 0.0,
-		function(animation, current, start, finish) {
-			$(back.fadeOutPanel).css('opacity', '' + current);
-			$(back.fadeInPanel).css('opacity', '' + (1 - current));
-			if (finish)
-				$(back.fadeOutPanel).css('display', 'none');
-		});
-	var oldHeight = $('#prefBody').css('height');
-	oldHeight = parseFloat(oldHeight.substr(0, oldHeight.length - 2));
-	var newHeight = back.prefBodyHeights[prefs];
-	var resizeAni = new AppleAnimation(oldHeight, newHeight,
-		function(animation, current, start, finish) {
-			$('#prefBody').css('height', current + 'px');
-		});
-	animator.addAnimation(fadeAni);
-	animator.addAnimation(resizeAni);
-	animator.start();
+    var animator = new AppleAnimator(300, 10);
+    var fadeAni = new AppleAnimation(1.0, 0.0,
+        function(animation, current, start, finish) {
+            $(back.fadeOutPanel).css('opacity', '' + current);
+            $(back.fadeInPanel).css('opacity', '' + (1 - current));
+            if (finish)
+                $(back.fadeOutPanel).css('display', 'none');
+        });
+    var oldHeight = $('#prefBody').css('height');
+    oldHeight = parseFloat(oldHeight.substr(0, oldHeight.length - 2));
+    var newHeight = back.prefBodyHeights[prefs];
+    var resizeAni = new AppleAnimation(oldHeight, newHeight,
+        function(animation, current, start, finish) {
+            $('#prefBody').css('height', current + 'px');
+        });
+    animator.addAnimation(fadeAni);
+    animator.addAnimation(resizeAni);
+    animator.start();
 
-	back.currentPrefs = prefs;
+    back.currentPrefs = prefs;
 };
 
 /**
  * css:display is set to none.
  */
 Back.prototype.createDesignTabButtons = function() {
-	for (i = 0; i < 2; i ++) {
-		active = (i == 1) ? '_active' : '';
-		$('#tabDesign' + active).css('display', 'none');
-		this.designTab = new AppleButton($('#tabDesign' + active).get(0),
-			getLocalizedString('Design'), 20,
-			this.imgPrefix + 'Left' + active + '_left.png',
-			this.imgPrefix + 'Left' + active + '_left_clicked.png', 10,
-			this.imgPrefix + 'Left' + active + '_middle.png',
-			this.imgPrefix + 'Left' + active + '_middle_clicked.png',
-			this.imgPrefix + 'Left' + active + '_right.png',
-			this.imgPrefix + 'Left' + active + '_right_clicked.png', 1,
-			this.onDesignTabClicked);
-		if (!active)
-			this.designTab.textElement.style.color = this.inactiveTabFontColor;
-	}
+    for (i = 0; i < 2; i ++) {
+        active = (i == 1) ? '_active' : '';
+        $('#tabDesign' + active).css('display', 'none');
+        this.designTab = new AppleButton($('#tabDesign' + active).get(0),
+            getLocalizedString('Design'), 20,
+            this.imgPrefix + 'Left' + active + '_left.png',
+            this.imgPrefix + 'Left' + active + '_left_clicked.png', 10,
+            this.imgPrefix + 'Left' + active + '_middle.png',
+            this.imgPrefix + 'Left' + active + '_middle_clicked.png',
+            this.imgPrefix + 'Left' + active + '_right.png',
+            this.imgPrefix + 'Left' + active + '_right_clicked.png', 1,
+            this.onDesignTabClicked);
+        if (!active)
+            this.designTab.textElement.style.color = this.inactiveTabFontColor;
+    }
 };
 
 /**
  * css:display is set to none.
  */
 Back.prototype.createAlarmTabButtons = function(active) {
-	for (i = 0; i < 2; i ++) {
-		active = (i == 1) ? '_active' : '';
-		$('#tabAlarm' + active).css('display', 'none');
-		this.alarmTab = new AppleButton($('#tabAlarm' + active).get(0),
-			getLocalizedString('Alarm'), 20,
-			this.imgPrefix + 'Right' + active + '_left.png',
-			this.imgPrefix + 'Right' + active + '_left_clicked.png', 0,
-			this.imgPrefix + 'Right' + active + '_middle.png',
-			this.imgPrefix + 'Right' + active + '_middle_clicked.png',
-			this.imgPrefix + 'Right' + active + '_right.png',
-			this.imgPrefix + 'Right' + active + '_right_clicked.png', 10,
-			this.onAlarmTabClicked);
-		if (!active)
-			this.alarmTab.textElement.style.color = this.inactiveTabFontColor;
-	}
+    for (i = 0; i < 2; i ++) {
+        active = (i == 1) ? '_active' : '';
+        $('#tabAlarm' + active).css('display', 'none');
+        this.alarmTab = new AppleButton($('#tabAlarm' + active).get(0),
+            getLocalizedString('Alarm'), 20,
+            this.imgPrefix + 'Right' + active + '_left.png',
+            this.imgPrefix + 'Right' + active + '_left_clicked.png', 0,
+            this.imgPrefix + 'Right' + active + '_middle.png',
+            this.imgPrefix + 'Right' + active + '_middle_clicked.png',
+            this.imgPrefix + 'Right' + active + '_right.png',
+            this.imgPrefix + 'Right' + active + '_right_clicked.png', 10,
+            this.onAlarmTabClicked);
+        if (!active)
+            this.alarmTab.textElement.style.color = this.inactiveTabFontColor;
+    }
 };

File Tea Timer.wdgt/Scripts/Front.js

View file
  * This class encapsules all functions for the front side of the widget.
  */
 function Front() {
-	this._init();
+    this._init();
 }
 
 Front.prototype._init = function() {
         $(button[0]).bind(mouse_events, {button: button[0]}, this.toggleButton);
     }
 
-	fields = Array(
-		'#timerTarget',
-		'#readyIn',
-		'#hours',
-		'#minutes',
-		'#seconds'
-	);
-	len = fields.length;
-	for (var i in fields) {
+    fields = Array(
+        '#timerTarget',
+        '#readyIn',
+        '#hours',
+        '#minutes',
+        '#seconds'
+    );
+    len = fields.length;
+    for (var i in fields) {
         // If I don’t do parseInt(i), the expressions "(i + len - 1) % len"
         // and "(i + 1) % len" won’t be evaluated each iteration, but be
         // cached instead. :-X
         i = parseInt(i);
 
-	    field = fields[i];
-	    input = field + 'Input';
+        field = fields[i];
+        input = field + 'Input';
 
-	    $(field).bind('click', {editor: input}, this.showEdit);
-		$(input).bind('blur keypress', {display: field}, this.setText);
-		$(input).bind('keypress', {
-		    pre: fields[(i + len - 1) % len], // i - 1 would not always be > 0!
-		    next: fields[(i + 1) % len]}, this.cycleInputs);
+        $(field).bind('click', {editor: input}, this.showEdit);
+        $(input).bind('blur keypress', {display: field}, this.setText);
+        $(input).bind('keypress', {
+            pre: fields[(i + len - 1) % len], // i - 1 would not always be > 0!
+            next: fields[(i + 1) % len]}, this.cycleInputs);
 
-		if (i > 1)
-			$(input).keypress(this.raiseOrLowerValue);
-	}
+        if (i > 1)
+            $(input).keypress(this.raiseOrLowerValue);
+    }
 };
 
 /**
  * @param event: The js event.
  */
 Front.prototype.showEdit = function(event) {
-	var display = $(event.target);
-	var editor = $(event.data.editor);
+    var display = $(event.target);
+    var editor = $(event.data.editor);
 
-	editor.attr('value', display.text());
-	editor.css('visibility', 'visible');
-	display.css('visiblity', 'hidden');
-	editor.get(0).focus();
+    editor.attr('value', display.text());
+    editor.css('visibility', 'visible');
+    display.css('visiblity', 'hidden');
+    editor.get(0).focus();
 
-	if (display.attr('id') != 'readyIn')
-		editor.get(0).select();
+    if (display.attr('id') != 'readyIn')
+        editor.get(0).select();
 };
 
 /**
  * @param event: The js event.
  */
 Front.prototype.setText = function(event) {
-	if (event.type == 'keypress' && event.keyCode != 13)
-		return;
+    if (event.type == 'keypress' && event.keyCode != 13)
+        return;
 
     var timeFields = ['hours', 'minutes', 'seconds'];
-	var editor = $(event.target);
-	var display = $(event.data.display);
+    var editor = $(event.target);
+    var display = $(event.data.display);
 
-	if (editor.css('visibility') == 'visible') {
+    if (editor.css('visibility') == 'visible') {
         // Stop timer if the time fields are modified
-		if ($.inArray(display.attr('id'), timeFields) > -1 &&
+        if ($.inArray(display.attr('id'), timeFields) > -1 &&
                 timer.timerInterval)
-			clearInterval(timer.timerInterval);
+            clearInterval(timer.timerInterval);
 
         // Set default values
-		if (editor.val().length < 1) {
-			if (editor.attr('id') == 'timerTargetInput')
-				editor.val(getLocalizedString('Something'));
-			else
-				editor.val('00');
-		}
+        if (editor.val().length < 1) {
+            if (editor.attr('id') == 'timerTargetInput')
+                editor.val(getLocalizedString('Something'));
+            else
+                editor.val('00');
+        }
 
         // Check inputs
-		if (display.attr('id') == 'timerTarget' ||
-		        display.attr('id') == 'readyIn')
-			display.text(editor.val());
-		else {
-		    var val = Math.min(Math.max(editor.val(), 0), 59);
-		    display.text(front.formatTwoDigits(val));
-		}
+        if (display.attr('id') == 'timerTarget' ||
+                display.attr('id') == 'readyIn')
+            display.text(editor.val());
+        else {
+            var val = Math.min(Math.max(editor.val(), 0), 59);
+            display.text(front.formatTwoDigits(val));
+        }
 
 
         // Update preferences
-		if (display.attr('id') == 'timerTarget' && window.widget)
-			setPrefForKey(editor.val(), widget.identifier, 'timerTarget');
-		if (display.attr('id') == 'readyIn' && window.widget)
-			setPrefForKey(editor.val(), widget.identifier, 'readyIn');
-		if (display.attr('id') == 'hours' && window.widget)
-			setPrefForKey(editor.val(), widget.identifier, 'hours');
-		if (display.attr('id') == 'minutes' && window.widget)
-			setPrefForKey(editor.val(), widget.identifier, 'minutes');
-		if (display.attr('id') == 'seconds' && window.widget)
-			setPrefForKey(editor.val(), widget.identifier, 'seconds');
+        if (display.attr('id') == 'timerTarget' && window.widget)
+            setPrefForKey(editor.val(), widget.identifier, 'timerTarget');
+        if (display.attr('id') == 'readyIn' && window.widget)
+            setPrefForKey(editor.val(), widget.identifier, 'readyIn');
+        if (display.attr('id') == 'hours' && window.widget)
+            setPrefForKey(editor.val(), widget.identifier, 'hours');
+        if (display.attr('id') == 'minutes' && window.widget)
+            setPrefForKey(editor.val(), widget.identifier, 'minutes');
+        if (display.attr('id') == 'seconds' && window.widget)
+            setPrefForKey(editor.val(), widget.identifier, 'seconds');
 
         if ($.inArray(display.attr('id'), timeFields) > -1)
-		    timer.isPaused = false; // Timer will read the inputs again.
+            timer.isPaused = false; // Timer will read the inputs again.
 
-		display.css('visibility', 'visible');
-		editor.css('visibility', 'hidden');
-	}
+        display.css('visibility', 'visible');
+        editor.css('visibility', 'hidden');
+    }
 
-	// Start the timer if the user pressed enter and if the timer was not
+    // Start the timer if the user pressed enter and if the timer was not
     // running or the time was changed.
-	if (event.keyCode == 13 && (!timer.timerInterval ||
+    if (event.keyCode == 13 && (!timer.timerInterval ||
                 $.inArray(display.attr('id'), timeFields) > -1))
-		$('#start').click();
+        $('#start').click();
 };
 
 /**
  * @param event: The js event.
  */
 Front.prototype.raiseOrLowerValue = function(event) {
-	if (event.keyCode != 38 && event.keyCode != 40
-			&& event.keyCode != 63232 && event.keyCode != 63233)
-		return;
+    if (event.keyCode != 38 && event.keyCode != 40
+            && event.keyCode != 63232 && event.keyCode != 63233)
+        return;
 
-	if (event.keyCode == 63232) event.keyCode = 38;
-	if (event.keyCode == 63233) event.keyCode = 40;
+    if (event.keyCode == 63232) event.keyCode = 38;
+    if (event.keyCode == 63233) event.keyCode = 40;
 
-	event.preventDefault();
-	e = event.target;
-	val = parseInt(e.value, 10);
-	if (event.keyCode == 38 && val < 59)
-		e.value = val + 1;
-	else if (event.keyCode == 40 && val > 0)
-		e.value = val -1;
+    event.preventDefault();
+    e = event.target;
+    val = parseInt(e.value, 10);
+    if (event.keyCode == 38 && val < 59)
+        e.value = val + 1;
+    else if (event.keyCode == 40 && val > 0)
+        e.value = val -1;
 };
 
 /**
  * @param event: The js event.
  */
 Front.prototype.cycleInputs = function(event) {
-	if (event.keyCode != 9)
-		return;
-	event.preventDefault();
-	if (event.shiftKey)
-		$(event.data.pre).click();
-	else
-		$(event.data.next).click();
-	$(event.target).blur();
+    if (event.keyCode != 9)
+        return;
+    event.preventDefault();
+    if (event.shiftKey)
+        $(event.data.pre).click();
+    else
+        $(event.data.next).click();
+    $(event.target).blur();
 };
 
 /**
  * Update the timer display with the currently remaining time.
  */
 Front.prototype.updateTimerDisplay = function() {
-	$('#hours').text(front.formatTwoDigits(timer.remainingHours));
-	$('#minutes').text(front.formatTwoDigits(timer.remainingMinutes));
-	$('#seconds').text(front.formatTwoDigits(timer.remainingSeconds));
+    $('#hours').text(front.formatTwoDigits(timer.remainingHours));
+    $('#minutes').text(front.formatTwoDigits(timer.remainingMinutes));
+    $('#seconds').text(front.formatTwoDigits(timer.remainingSeconds));
 };
 
 /**
  * @return: The formatted number.
  */
 Front.prototype.formatTwoDigits = function(number) {
-	number = parseInt(number, 10);
-	if (number < 0 || isNaN(number)) number = 0;
+    number = parseInt(number, 10);
+    if (number < 0 || isNaN(number)) number = 0;
 
-	number = number.toString(10);
-	if (number.length == 1)
-		number = '0' + number;
-	return number;
+    number = number.toString(10);
+    if (number.length == 1)
+        number = '0' + number;
+    return number;
 };
 
 /**
  * Resets the display to 00:00:00.
  */
 Front.prototype.resetDisplay = function() {
-	front.resetDisplayTo('00', '00', '00');
+    front.resetDisplayTo('00', '00', '00');
 };
 
 /**
 Front.prototype.resetDisplayTo = function(hours, minutes, seconds) {
     front.toggleVisibility('#pause', '#start');
     front.toggleVisibility('#rewind', '#icon');
-	$('#hours').text(hours);
-	$('#minutes').text(minutes);
-	$('#seconds').text(seconds);
+    $('#hours').text(hours);
+    $('#minutes').text(minutes);
+    $('#seconds').text(seconds);
 };

File Tea Timer.wdgt/Scripts/Timer.js

View file
  * timer class implements the countdown timer and the alarm function.
  */
 function Timer() {
-	this._targetTime = null;
-	this._isTargetReached = false;
-	this.isPaused = false;
-	this.hours = -1;
-	this.minutes = -1;
-	this.seconds = -1;
-	this.remainingHours = -1;
-	this.remainingMinutes = -1;
-	this.remainingSeconds = -1;
-	this.timerInterval = null;
-	this.stopClicked = false;
-	this._msCounter = 0;
+    this._targetTime = null;
+    this._isTargetReached = false;
+    this.isPaused = false;
+    this.hours = -1;
+    this.minutes = -1;
+    this.seconds = -1;
+    this.remainingHours = -1;
+    this.remainingMinutes = -1;
+    this.remainingSeconds = -1;
+    this.timerInterval = null;
+    this.stopClicked = false;
+    this._msCounter = 0;
 }
 
 /**
     var h, m, s;
 
     if (!timer.isPaused) {
-		timer.hours = $('#hours').text()
-		timer.minutes = $('#minutes').text()
-		timer.seconds = $('#seconds').text()
-		h = parseInt(timer.hours, 10);
-		m = parseInt(timer.minutes, 10);
-		s = parseInt(timer.seconds, 10);
+        timer.hours = $('#hours').text()
+        timer.minutes = $('#minutes').text()
+        timer.seconds = $('#seconds').text()
+        h = parseInt(timer.hours, 10);
+        m = parseInt(timer.minutes, 10);
+        s = parseInt(timer.seconds, 10);
     }
     else {
         timer.isPaused = false;
         m = timer.remainingMinutes;
         s = timer.remainingSeconds;
     }
-	m += h * 60;
-	s += m * 60;
-	timer._targetTime = Date.parse(new Date()) + s * 1000;
-	timer._isTargetReached = false;
+    m += h * 60;
+    s += m * 60;
+    timer._targetTime = Date.parse(new Date()) + s * 1000;
+    timer._isTargetReached = false;
 
-	// Check if target time has already been passed.
-	if (timer._targetTime > Date.parse(new Date())) {
-		timer.timerInterval = setInterval('timer.runTimer()', 1000);
-	}
-	else {
-		front.resetDisplay();
-	}
+    // Check if target time has already been passed.
+    if (timer._targetTime > Date.parse(new Date())) {
+        timer.timerInterval = setInterval('timer.runTimer()', 1000);
+    }
+    else {
+        front.resetDisplay();
+    }
 };
 
 /**
  * Pause the countdown.
  */
 Timer.prototype.pause = function() {
-	clearInterval(timer.timerInterval);
-	timer.timerInterval = null;
-	timer.isPaused = true
+    clearInterval(timer.timerInterval);
+    timer.timerInterval = null;
+    timer.isPaused = true
 };
 
 /**
  * Rewind the countdown – set it back to it initial value.
  */
 Timer.prototype.rewind = function() {
-	clearInterval(timer.timerInterval);
-	timer.timerInterval = null;
-	timer._isTargetReached = false;
-	timer.isPaused = false;
-	front.resetDisplayTo(timer.hours, timer.minutes, timer.seconds);
+    clearInterval(timer.timerInterval);
+    timer.timerInterval = null;
+    timer._isTargetReached = false;
+    timer.isPaused = false;
+    front.resetDisplayTo(timer.hours, timer.minutes, timer.seconds);
 };
 
 /**
  * corresponding global vars.
  */
 Timer.prototype.calculateRemainingTime = function() {
-	currentTime = Date.parse(new Date());
-	timer.remainingSeconds = (timer._targetTime - currentTime) / 1000;
-	timer.remainingMinutes = parseInt(timer.remainingSeconds / 60);
-	timer.remainingHours = parseInt(timer.remainingMinutes / 60);
-	timer.remainingSeconds %= 60;
-	timer.remainingMinutes %= 60;
+    currentTime = Date.parse(new Date());
+    timer.remainingSeconds = (timer._targetTime - currentTime) / 1000;
+    timer.remainingMinutes = parseInt(timer.remainingSeconds / 60);
+    timer.remainingHours = parseInt(timer.remainingMinutes / 60);
+    timer.remainingSeconds %= 60;
+    timer.remainingMinutes %= 60;
 };
 
 /**
  * Check if the target time is reached and alarm the user.
  */
 Timer.prototype.checkForAlarm = function() {
-	if (timer.remainingSeconds <= 0 && timer.remainingMinutes <= 0
-			&& timer.remainingHours <= 0 && !timer._isTargetReached) {
-		clearInterval(timer.timerInterval);
-		timer.timerInterval = null;
-		timer._isTargetReached = true;
-		timer.isPaused = false;
-		front.resetDisplayTo(timer.hours, timer.minutes, timer.seconds);
-		if (alarm.keepAlarming)
-			front.showStopAlarmButton();
-			timer.stopClicked = false;
+    if (timer.remainingSeconds <= 0 && timer.remainingMinutes <= 0
+            && timer.remainingHours <= 0 && !timer._isTargetReached) {
+        clearInterval(timer.timerInterval);
+        timer.timerInterval = null;
+        timer._isTargetReached = true;
+        timer.isPaused = false;
+        front.resetDisplayTo(timer.hours, timer.minutes, timer.seconds);
+        if (alarm.keepAlarming)
+            front.showStopAlarmButton();
+            timer.stopClicked = false;
         timer.alarm();
-	}
+    }
 };
 
 /**
  *              be used.
  */
 Timer.prototype.alarm = function(type, isRepeating) {
-	var title = getLocalizedString('Tea Timer');
-	var message = $('#timerTarget').text();
+    var title = getLocalizedString('Tea Timer');
+    var message = $('#timerTarget').text();
 
-	if ($('#readyIn').text() == getLocalizedString('ready in'))
-	 	message += ' ' + getLocalizedString('is ready.');
+    if ($('#readyIn').text() == getLocalizedString('ready in'))
+         message += ' ' + getLocalizedString('is ready.');
 
-	if ((!type || type == 'sound') && alarm.sound != 'none') {
-		$('#soundPlayer').remove();
-		$('#alarm').append('<embed name="soundPlayer" id="soundPlayer" '
-				+ 'src="/System/Library/Sounds/' + alarm.sound + '.aiff" '
-				+ 'autostart="false" hidden="true" enablejavascript="true" />');
+    if ((!type || type == 'sound') && alarm.sound != 'none') {
+        $('#soundPlayer').remove();
+        $('#alarm').append('<embed name="soundPlayer" id="soundPlayer" '
+                + 'src="/System/Library/Sounds/' + alarm.sound + '.aiff" '
+                + 'autostart="false" hidden="true" enablejavascript="true" />');
         $('#soundPlayer').get(0).Play();
-	}
-	if (window.widget && (!type || type == 'growl') && alarm.growl) {
-		var sticky = false;
-		if (alarm.keepAlarming)
-			sticky = true;
+    }
+    if (window.widget && (!type || type == 'growl') && alarm.growl) {
+        var sticky = false;
+        if (alarm.keepAlarming)
+            sticky = true;
 
         if (!isRepeating) {
             widget.system('/usr/bin/env python growl.py "' + title + '" "'
-				+ message + '" ' + sticky, function(){});
+                + message + '" ' + sticky, function(){});
         }
-	}
-	if (window.widget && (!type || type == 'voice') && alarm.voice != 'none') {
-		widget.system('/usr/bin/osascript -e \'say "' + message
-						+ '" using "' + alarm.voice + '"\'', function(){});
-	}
+    }
+    if (window.widget && (!type || type == 'voice') && alarm.voice != 'none') {
+        widget.system('/usr/bin/osascript -e \'say "' + message
+                        + '" using "' + alarm.voice + '"\'', function(){});
+    }
 
-	if (window.widget && alarm.keepAlarming && !type && !timer.stopClicked) {
-		timer.repeatAlarm();
-	}
+    if (window.widget && alarm.keepAlarming && !type && !timer.stopClicked) {
+        timer.repeatAlarm();
+    }
 };
 
 /**
  *
  */
 Timer.prototype.repeatAlarm = function() {
-	if (timer.stopClicked) {
-		timer._msCounter == 0;
-		return;
-	}
-	timer._msCounter = (timer._msCounter + 10) % 5000;
-	if (timer._msCounter == 0)
-		timer.alarm(false, true);
-	else
-		setTimeout('timer.repeatAlarm()', 10);
+    if (timer.stopClicked) {
+        timer._msCounter == 0;
+        return;
+    }
+    timer._msCounter = (timer._msCounter + 10) % 5000;
+    if (timer._msCounter == 0)
+        timer.alarm(false, true);
+    else
+        setTimeout('timer.repeatAlarm()', 10);
 };
 

File Tea Timer.wdgt/Scripts/Updater.js

View file
  * Everything needed for the auto update function and the update panel.
  */
 function Updater() {
-	this.clientVersion = null;
-	this.availableVersion = null;
-	this.updateCheck = true;
-	this.lastChecked = null;
-	this.url = 'http://update.sofa-rockers.org/check/1/';
-	
-	$('#no').bind('mouseover mousedown', function(event) {
-		$(event.target).attr('src', 'Images/cancelUpdate_clicked.png');});
-	$('#no').bind('mouseout mouseup', function(event) {
-		$(event.target).attr('src', 'Images/cancelUpdate.png');});
-	$('#no').click(function(event) {
-		$('#update').css('display', 'none');
-		if (window.widget)
-		    widget.setPreferenceForKey(updater.availableVersion,
-		            'noupdate.version');
-	});
-	$('#yes').bind('mouseover mousedown', function(event) {
-		$(event.target).attr('src', 'Images/doUpdate_clicked.png');});
-	$('#yes').bind('mouseout mouseup', function(event) {
-		$(event.target).attr('src', 'Images/doUpdate.png');});
-	$('#yes').click(function(event) {
-		if (window.widget)
-			widget.openURL('http://stefan.sofa-rockers.org');
-			widget.setPreferenceForKey(null, 'noupdate.version');
-		$('#update').css('display', 'none');
-	});
+    this.clientVersion = null;
+    this.availableVersion = null;
+    this.updateCheck = true;
+    this.lastChecked = null;
+    this.url = 'http://update.sofa-rockers.org/check/1/';
+
+    $('#no').bind('mouseover mousedown', function(event) {
+        $(event.target).attr('src', 'Images/cancelUpdate_clicked.png');});
+    $('#no').bind('mouseout mouseup', function(event) {
+        $(event.target).attr('src', 'Images/cancelUpdate.png');});
+    $('#no').click(function(event) {
+        $('#update').css('display', 'none');
+        if (window.widget)
+            widget.setPreferenceForKey(updater.availableVersion,
+                    'noupdate.version');
+    });
+    $('#yes').bind('mouseover mousedown', function(event) {
+        $(event.target).attr('src', 'Images/doUpdate_clicked.png');});
+    $('#yes').bind('mouseout mouseup', function(event) {
+        $(event.target).attr('src', 'Images/doUpdate.png');});
+    $('#yes').click(function(event) {
+        if (window.widget)
+            widget.openURL('http://stefan.sofa-rockers.org');
+            widget.setPreferenceForKey(null, 'noupdate.version');
+        $('#update').css('display', 'none');
+    });
 }
 
 /**
  * Currently checks once a day, I have to change it in a later release ...
  */
 Updater.prototype.check = function() {
-	if (updater.updateCheck && (!updater.lastChecked
-			|| (new Date()).getDate() != updater.lastChecked.getDate())) {
-		updater.getVersion();
-		$.ajax({
-			url: updater.url,
-			type: 'GET',
-		 	dataType: 'string',
-		  	success: function(availableVersion) {
-		  	    updater.availableVersion = availableVersion;
-				if (availableVersion > updater.clientVersion) {
-				    // Check if update is not wanted
-				    var buf = widget.preferenceForKey('noupdate.version');
-                	if (buf && availableVersion == buf) {
-                	    return;
-                	}
-                	
-					$('#clientVersion').text(updater.clientVersion);
-					$('#availableVersion').text(availableVersion);
-					$('#update').css('display', 'block');
-				}
-			}
-		});
-				
-		updater.lastChecked = new Date();
-	}
+    if (updater.updateCheck && (!updater.lastChecked
+            || (new Date()).getDate() != updater.lastChecked.getDate())) {
+        updater.getVersion();
+        $.ajax({
+            url: updater.url,
+            type: 'GET',
+             dataType: 'string',
+              success: function(availableVersion) {
+                  updater.availableVersion = availableVersion;
+                if (availableVersion > updater.clientVersion) {
+                    // Check if update is not wanted
+                    var buf = widget.preferenceForKey('noupdate.version');
+                    if (buf && availableVersion == buf) {
+                        return;
+                    }
+
+                    $('#clientVersion').text(updater.clientVersion);
+                    $('#availableVersion').text(availableVersion);
+                    $('#update').css('display', 'block');
+                }
+            }
+        });
+
+        updater.lastChecked = new Date();
+    }
 };
 
 /**
  * value to updater.clientVersion.
  */
 Updater.prototype.getVersion = function() {
-	if (!updater.clientVersion) {
-		$.ajax({
-			type: "GET",
-			url: "Info.plist",
-			dataType: "xml",
-			async: false,
-			success: function(data) {
-				updater.clientVersion =
-						$('plist > dict > key:contains("CFBundleVersion")', 
-						data).next('string').text();
-			}
-		});
-	}
-	return updater.clientVersion;
+    if (!updater.clientVersion) {
+        $.ajax({
+            type: "GET",
+            url: "Info.plist",
+            dataType: "xml",
+            async: false,
+            success: function(data) {
+                updater.clientVersion =
+                        $('plist > dict > key:contains("CFBundleVersion")',
+                        data).next('string').text();
+            }
+        });
+    }
+    return updater.clientVersion;
 };
 
 

File Tea Timer.wdgt/TeaTimer.css

View file
  * Common settings and settings for front, back and update side.
  */
 body {
-	margin: 0px;
+    margin: 0px;
 }
 
 #front, #back, #update {
-	margin: 0px;
-	position: absolute;
-	top: 0px;
-	left: 0px;
-	width: 320px;
-	height: 120px;
-	font-family: "Gill Sans";
-	color: #FFFFFF;
-	text-shadow: 0px 2px 4px #000;
+    margin: 0px;
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    width: 320px;
+    height: 120px;
+    font-family: "Gill Sans";
+    color: #FFFFFF;
+    text-shadow: 0px 2px 4px #000;
 }
 #front {
-	background: url(Images/Front_default.png) no-repeat;
-	display: block;
+    background: url(Images/Front_default.png) no-repeat;
+    display: block;
 }
 #back {
-	background: url(Images/Back.png) no-repeat;
-	display: none;
-	height: 150px;
+    background: url(Images/Back.png) no-repeat;
+    display: none;
+    height: 150px;
 }
 #update {
-	background: url(Images/Update.png) no-repeat;
-	display: none;
+    background: url(Images/Update.png) no-repeat;
+    display: none;
 }
 
 /* Font sizes */
 
 /* Icon positions */
 #icon, #start, #pause, #rewind, #stop, #update #yes, #update #no {
-	margin: 0px;
-	position: absolute;
-	top: 38px;
-	left: 248px;
-	width: 44px;
-	height: 44px;
+    margin: 0px;
+    position: absolute;
+    top: 38px;
+    left: 248px;
+    width: 44px;
+    height: 44px;
 }
 #icon, #rewind, #stop, #update #no { left: 28px; }
 #pause, #rewind, #stop { visibility: hidden;}
  * Front side
  */
 #infoButton {
-	position: absolute;
-	right: 16px;
-	bottom: 16px;
-	width: 13px;
-	height: 13px;
+    position: absolute;
+    right: 16px;
+    bottom: 16px;
+    width: 13px;
+    height: 13px;
 }
 
 #timerTarget, #timerTargetInput {
-	margin: 0px;
-	position: absolute;
-	top: 16px;
-	left: 15px;
-	width: 290px;
-	text-align: center;
+    margin: 0px;
+    position: absolute;
+    top: 16px;
+    left: 15px;
+    width: 290px;
+    text-align: center;
 }
 #timerTargetInput {
-	left: 60px;
-	width: 200px;
+    left: 60px;
+    width: 200px;
 }
 
 #readyIn, #readyInInput {
-	margin: 0px;
-	position: absolute;
-	top: 38px;
-	left: 80px;
-	width: 160px;
-	text-align: center;
+    margin: 0px;
+    position: absolute;
+    top: 38px;
+    left: 80px;
+    width: 160px;
+    text-align: center;
 }
 #readyInSelect {
 
 }
 
 #remainingTime {
-	margin: 0px;
-	position: absolute;
-	top: 63px;
-	left: 80px;
-	width: 160px;
-	text-align: center;
+    margin: 0px;
+    position: absolute;
+    top: 63px;
+    left: 80px;
+    width: 160px;
+    text-align: center;
 }
 
 #hours, #hoursInput, #minutes, #minutesInput, #seconds, #secondsInput {
-	margin: 0px;
-	position: absolute;
-	top: 0px;
-	width: 20px;
-	text-align: center;
+    margin: 0px;
+    position: absolute;
+    top: 0px;
+    width: 20px;
+    text-align: center;
 }
 
 #hoursLabel, #minutesLabel, #secondsLabel {
-	margin: 0px;
-	position: absolute;
-	top: 23px;
-	width: 20px;
-	font-size: 12px;
-	font-weight: lighter;
+    margin: 0px;
+    position: absolute;
+    top: 23px;
+    width: 20px;
+    font-size: 12px;
+    font-weight: lighter;
 }
 
 #hours, #hoursInput, #hoursLabel { left: 30px; }
 #seconds, #secondsInput, #secondsLabel { left: 110px; }
 
 #colon1, #colon2 {
-	margin: 0px;
-	position: absolute;
-	top: 2px;
-	width: 10px;
+    margin: 0px;
+    position: absolute;
+    top: 2px;
+    width: 10px;
 }
 #colon1 { left: 55px; }
 #colon2 { left: 95px; }
 
 .input {
-	font-family: "Gill Sans";
-	font-size: 14px;
-	visibility: hidden;
+    font-family: "Gill Sans";
+    font-size: 14px;
+    visibility: hidden;
 }
 
 /*******************************************************************************
  * Back side
  */
 #back {
-	font-family: Helvetica;
-	font-weight: bold;
-	font-size: 12px;
-	color: #FFF;
+    font-family: Helvetica;
+    font-weight: bold;
+    font-size: 12px;
+    color: #FFF;
 }
 
 #doneButton {
-	position: absolute;
-	right: 21px;
-	bottom: 21px;
-	margin-left: auto;
-	margin-top: auto;
+    position: absolute;
+    right: 21px;
+    bottom: 21px;
+    margin-left: auto;
+    margin-top: auto;
 }
 
 #about {
-	position: absolute;
-	bottom: 21px;
-	left: 21px;
-	text-align: center;
+    position: absolute;
+    bottom: 21px;
+    left: 21px;
+    text-align: center;
 }
 #about a:link, #about a:visited { color: #DDD; text-decoration: none; }
 #about a:active, #about a:hover { color: #FFF; text-decoration: underline; }
 
 #tabMenu {
-	margin: 0px;
-	padding: 0px;
-	position: relative;
-	left: 15px;
-	top: 20px;
-	width: 290px;
-	height: 20px;
-	border: 0px;
-	text-align: center;
-	z-index: 3;
+    margin: 0px;
+    padding: 0px;
+    position: relative;
+    left: 15px;
+    top: 20px;
+    width: 290px;
+    height: 20px;
+    border: 0px;
+    text-align: center;
+    z-index: 3;
 }
 #tabMenu div {
-	display: inline;
-	width: 50px;
+    display: inline;
+    width: 50px;
 }
 
 #prefBody {
-	position: absolute;
-	left: 17px;
-	top: 30px;
-	width: 283px;
-	height: 45px;
-	border: 1px inset #808080;
+    position: absolute;
+    left: 17px;
+    top: 30px;
+    width: 283px;
+    height: 45px;
+    border: 1px inset #808080;
     -webkit-border-top-right-radius: 8px 8px;
     -webkit-border-top-left-radius: 8px 8px;
     -webkit-border-bottom-left-radius: 8px 8px;
     -webkit-border-bottom-right-radius: 8px 8px;
-	background-color: rgba(38, 38, 38, 0.5);
+    background-color: rgba(38, 38, 38, 0.5);
 }
 
 #prefBody table {
-	display: none;
-	opacity: 0.0;
-	position: absolute;
-	left: 5px;
-	top: 15px;
-	border: 0px;
-	padding: 0px;
-	border-spacing: 0px;
+    display: none;
+    opacity: 0.0;
+    position: absolute;
+    left: 5px;
+    top: 15px;
+    border: 0px;
+    padding: 0px;
+    border-spacing: 0px;
 }
 #prefBody table tr td { padding: 0px; padding-right: 5px;}
 #prefBody table tr td.rightCol { padding-left: 10px;}
  * Update panel
  */
 #update #message {
-	margin: 0px;
-	position: absolute;
-	top: 36px;
-	left: 80px;
-	width: 160px;
-	text-align: center;
+    margin: 0px;
+    position: absolute;
+    top: 36px;
+    left: 80px;
+    width: 160px;
+    text-align: center;
 }

File Tea Timer.wdgt/TeaTimer.html

View file
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 
 <head>
 
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
 <style type="text/css">
-	@import "TeaTimer.css";
+    @import "TeaTimer.css";
 </style>
 <script type='text/javascript' src='/System/Library/WidgetResources/AppleClasses/AppleInfoButton.js' charset='utf-8'></script>
 <script type='text/javascript' src='/System/Library/WidgetResources/AppleClasses/AppleAnimator.js' charset='utf-8'></script>
 <body>
 
 <div id="front">
-	<img id="icon" src="Images/alarmclock.png" />
-	<img id="start" src="Images/start.png" />
-	<img id="pause" src="Images/pause.png" />
-	<img id="rewind" src="Images/rewind.png" />
-	<img id="stop" src="Images/stop.png" />
-	<div id="timerTarget" class="editable normal">Tea</div>
-	<input type="text" id="timerTargetInput" class="input" maxlength="20" />
-	<div id="readyIn" class="small">ready in</div>
-	<select name="" id="readyInInput" class="input">
-	   <option>ready in</option>
-	   <option>in</option>
-	</select>
-	<div id="remainingTime">
-		<div id="hours" class="normal editable">00</div>
-		<div id="colon1" class="small">:</div>
-		<div id="minutes" class="normal editable">00</div>
-		<div id="colon2" class="small">:</div>
-		<div id="seconds" class="normal editableitable">00</div>
-		<div id="hoursLabel">hrs.</div>
-		<div id="minutesLabel">mins.</div>
-		<div id="secondsLabel">secs.</div>
-		<input type="text" id="hoursInput" class="input" maxlength="2" value="00" />
-		<input type="text" id="minutesInput" class="input" maxlength="2" value="00" />
-		<input type="text" id="secondsInput" class="input" maxlength="2" value="00" />
-	</div>
-	<div id='infoButton'></div>
+    <img id="icon" src="Images/alarmclock.png" />
+    <img id="start" src="Images/start.png" />
+    <img id="pause" src="Images/pause.png" />
+    <img id="rewind" src="Images/rewind.png" />
+    <img id="stop" src="Images/stop.png" />
+    <div id="timerTarget" class="editable normal">Tea</div>
+    <input type="text" id="timerTargetInput" class="input" maxlength="20" />
+    <div id="readyIn" class="small">ready in</div>
+    <select name="" id="readyInInput" class="input">
+       <option>ready in</option>
+       <option>in</option>
+    </select>
+    <div id="remainingTime">
+        <div id="hours" class="normal editable">00</div>
+        <div id="colon1" class="small">:</div>
+        <div id="minutes" class="normal editable">00</div>
+        <div id="colon2" class="small">:</div>
+        <div id="seconds" class="normal editableitable">00</div>
+        <div id="hoursLabel">hrs.</div>
+        <div id="minutesLabel">mins.</div>
+        <div id="secondsLabel">secs.</div>
+        <input type="text" id="hoursInput" class="input" maxlength="2" value="00" />
+        <input type="text" id="minutesInput" class="input" maxlength="2" value="00" />
+        <input type="text" id="secondsInput" class="input" maxlength="2" value="00" />
+    </div>
+    <div id='infoButton'></div>
 </div>
 
 <div id="back">
-	<div id="tabMenu">
-		<div id="tabDesign"></div><div id="tabDesign_active"></div><div id="tabAlarm"></div><div id="tabAlarm_active"></div>
-	</div>
-	<div id="prefBody">
-		<table id="prefsDesign">
-			<tr>
-				<td id="prefBgColorLabel">Background color:</td>
-				<td><select id="backgroundColor">
-					<option value="default">Default</option>
-					<hr />
-					<option value="cayenne">Cayenne</option>
-					<option value="graphite">Graphite</option>
-					<option value="lime">Lime</option>
-					<option value="ocean">Ocean</option>
-					<option value="orange">Orange</option>
-					<option	value="pink">Pink</option>
-					<option value="purple">Purple</option>
-					<option value="silver">Silver</option>
-				</select></td>
-			</tr>
-		</table>
-		<table id="prefsAlarm">
-			<tr>
-				<td id="alarmSoundLabel">Sound:</td>
-				<td><select id="alarmSound">
-					<option value="none">Off</option>
-					<hr />
-				</select></td>
-				<td class="rightCol"><input type="checkbox" id="alarmGrowl" /><label for="alarmGrowl" id="alarmGrowlLabel">Use Growl</label></td>
-			</tr>
-			<tr>
-				<td id="alarmVoiceLabel">Voice:</td>
-				<td><select id="alarmVoice">
-					<option value="none">Off</option>
-					<hr />
-				</select></td>
-				<td class="rightCol"><input type="checkbox" id="alarmKeepAlarming" /><label for="alarmKeepAlarming" id="alarmKeepAlarmingLabel" title="Stop it via the alarm clock on the front side.">Keep Alarming</label></td>
-			</tr>
-		</table>
-	</div>
-	<div id="about">v<span id="version"></span> – <a id="homeLink">Tea Timer Website</a></div>
-	<div id="doneButton"></div>
+    <div id="tabMenu">
+        <div id="tabDesign"></div><div id="tabDesign_active"></div><div id="tabAlarm"></div><div id="tabAlarm_active"></div>
+    </div>
+    <div id="prefBody">
+        <table id="prefsDesign">
+            <tr>
+                <td id="prefBgColorLabel">Background color:</td>
+                <td><select id="backgroundColor">
+                    <option value="default">Default</option>
+                    <hr />
+                    <option value="cayenne">Cayenne</option>
+                    <option value="graphite">Graphite</option>
+                    <option value="lime">Lime</option>
+                    <option value="ocean">Ocean</option>
+                    <option value="orange">Orange</option>
+                    <option    value="pink">Pink</option>
+                    <option value="purple">Purple</option>
+                    <option value="silver">Silver</option>
+                </select></td>
+            </tr>
+        </table>
+        <table id="prefsAlarm">
+            <tr>
+                <td id="alarmSoundLabel">Sound:</td>
+                <td><select id="alarmSound">
+                    <option value="none">Off</option>
+                    <hr />
+                </select></td>
+                <td class="rightCol"><input type="checkbox" id="alarmGrowl" /><label for="alarmGrowl" id="alarmGrowlLabel">Use Growl</label></td>
+            </tr>
+            <tr>
+                <td id="alarmVoiceLabel">Voice:</td>
+                <td><select id="alarmVoice">
+                    <option value="none">Off</option>
+                    <hr />
+                </select></td>
+                <td class="rightCol"><input type="checkbox" id="alarmKeepAlarming" /><label for="alarmKeepAlarming" id="alarmKeepAlarmingLabel" title="Stop it via the alarm clock on the front side.">Keep Alarming</label></td>
+            </tr>
+        </table>
+    </div>
+    <div id="about">v<span id="version"></span> – <a id="homeLink">Tea Timer Website</a></div>
+    <div id="doneButton"></div>
 </div>
 
 <div id="update">
-	<img id="no" src="Images/cancelUpdate.png" />
-	<img id="yes" src="Images/doUpdate.png" />
-	<div id="message"><span id="updateLabel" class="normal">Update available</span><br />
-		<span id="clientVersionLabel" class="smaller">Your version:</span>
-		<span id="clientVersion" class="smaller">0.0</span><br />
-		<span id="availableVersionLabel" class="smaller">New version:</span>
-		<span id="availableVersion" class="smaller">0.0</span>
-	</div>
+    <img id="no" src="Images/cancelUpdate.png" />
+    <img id="yes" src="Images/doUpdate.png" />
+    <div id="message"><span id="updateLabel" class="normal">Update available</span><br />
+        <span id="clientVersionLabel" class="smaller">Your version:</span>
+        <span id="clientVersion" class="smaller">0.0</span><br />
+        <span id="availableVersionLabel" class="smaller">New version:</span>
+        <span id="availableVersion" class="smaller">0.0</span>
+    </div>
 </div>
 
 <div id="alarm">
-	<embed name="soundPlayer" id="soundPlayer" src="/System/Library/Sounds/Glass.aiff" autostart="false" hidden="true" enablejavascript="true" />
+    <embed name="soundPlayer" id="soundPlayer" src="/System/Library/Sounds/Glass.aiff" autostart="false" hidden="true" enablejavascript="true" />
 </div>
 
 </body>

File Tea Timer.wdgt/TeaTimer.js

View file
 var infoButton = null;
 var doneButton = null;
 var alarm = {
-	'sound': 'none',
-	'voice': 'none',
-	'growl': false
+    'sound': 'none',
+    'voice': 'none',
+    'growl': false
 };
 
 /**
  * Add all event listeners when the window is loaded.
  */
 $(window).load(function() {
-	timer = new Timer();
-	updater = new Updater();
-	front = new Front();
-	back = new Back();
-	infoButton = new AppleInfoButton($('#infoButton').get(0),
-		$('#front').get(0), 'white', 'white', showBack);
-	doneButton = new AppleGlassButton($('#doneButton').get(0),
-		getLocalizedString('Done'), showFront);
+    timer = new Timer();
+    updater = new Updater();
+    front = new Front();
+    back = new Back();
+    infoButton = new AppleInfoButton($('#infoButton').get(0),
+        $('#front').get(0), 'white', 'white', showBack);
+    doneButton = new AppleGlassButton($('#doneButton').get(0),
+        getLocalizedString('Done'), showFront);
 
-	if (window.widget) {
-		widget.onremove = remove;
-		widget.onhide = hide;
-		widget.onshow = show;
-	}
-    
+    if (window.widget) {
+        widget.onremove = remove;
+        widget.onhide = hide;
+        widget.onshow = show;
+    }
+
     back.loadSounds();
     back.loadVoices();
 
-	loadLocalizedStrings();
-	loadPreferences();
+    loadLocalizedStrings();
+    loadPreferences();
 });
 
 /**
  * Load all localized strings.
  */
 function loadLocalizedStrings() {
-	// Front side
-	$('#timerTarget').text(getLocalizedString('Tea'));
-	$('#readyIn').text(getLocalizedString('ready in'));
-	$('#readyInInput > option:nth-child(1)').text(
-			getLocalizedString('ready in'));
-	$('#readyInInput > option:nth-child(2)').text(
-			getLocalizedString('in'));
-	$('#hoursLabel').text(getLocalizedString('hrs.'));
-	$('#minutesLabel').text(getLocalizedString('mins.'));
-	$('#secondsLabel').text(getLocalizedString('secs.'));
+    // Front side
+    $('#timerTarget').text(getLocalizedString('Tea'));
+    $('#readyIn').text(getLocalizedString('ready in'));
+    $('#readyInInput > option:nth-child(1)').text(
+            getLocalizedString('ready in'));
+    $('#readyInInput > option:nth-child(2)').text(
+            getLocalizedString('in'));
+    $('#hoursLabel').text(getLocalizedString('hrs.'));
+    $('#minutesLabel').text(getLocalizedString('mins.'));
+    $('#secondsLabel').text(getLocalizedString('secs.'));
 
-	// Back side
-	$('#homeLink > a').text(getLocalizedString('Tea Timer website'));
-	$('#prefBgColorLabel').text(getLocalizedString('Background color') + ':');
-	$('#backgroundColor > option[value=default]')
-			.text(getLocalizedString('Default'));
-	$('#backgroundColor > option[value=cayenne]')
-			.text(getLocalizedString('Cayenne'));
-	$('#backgroundColor > option[value=graphite]')
-			.text(getLocalizedString('Graphite'));
-	$('#backgroundColor > option[value=lime]')
-			.text(getLocalizedString('Lime'));
-	$('#backgroundColor > option[value=ocean]')
-			.text(getLocalizedString('Ocean'));
-	$('#backgroundColor > option[value=orange]')
-			.text(getLocalizedString('Orange'));
-	$('#backgroundColor > option[value=purple]')
-			.text(getLocalizedString('Purple'));
-	$('#backgroundColor > option[value=silver]')
-			.text(getLocalizedString('Silver'));
-	$('#alarmVoiceLabel').text(getLocalizedString('Voice') + ':');
-	$('#alarmVoice > option:first').text(getLocalizedString('Off'));
-	$('#alarmSoundLabel').text(getLocalizedString('Sound') + ':');
-	$('#alarmSound > option:first').text(getLocalizedString('Off'));
-	$('#alarmGrowlLabel').text(getLocalizedString('Use Growl'));
-	$('#alarmKeepAlarmingLabel').text(getLocalizedString('Keep Alarming'));
-	$('#alarmKeepAlarmingLabel').attr('title', getLocalizedString('Stop it via the alarm clock on the front side.'));
+    // Back side
+    $('#homeLink > a').text(getLocalizedString('Tea Timer website'));
+    $('#prefBgColorLabel').text(getLocalizedString('Background color') + ':');
+    $('#backgroundColor > option[value=default]')
+            .text(getLocalizedString('Default'));
+    $('#backgroundColor > option[value=cayenne]')
+            .text(getLocalizedString('Cayenne'));
+    $('#backgroundColor > option[value=graphite]')
+            .text(getLocalizedString('Graphite'));
+    $('#backgroundColor > option[value=lime]')
+            .text(getLocalizedString('Lime'));
+    $('#backgroundColor > option[value=ocean]')
+            .text(getLocalizedString('Ocean'));
+    $('#backgroundColor > option[value=orange]')
+            .text(getLocalizedString('Orange'));
+    $('#backgroundColor > option[value=purple]')
+            .text(getLocalizedString('Purple'));
+    $('#backgroundColor > option[value=silver]')
+            .text(getLocalizedString('Silver'));
+    $('#alarmVoiceLabel').text(getLocalizedString('Voice') + ':');
+    $('#alarmVoice > option:first').text(getLocalizedString('Off'));
+    $('#alarmSoundLabel').text(getLocalizedString('Sound') + ':');
+    $('#alarmSound > option:first').text(getLocalizedString('Off'));
+    $('#alarmGrowlLabel').text(getLocalizedString('Use Growl'));
+    $('#alarmKeepAlarmingLabel').text(getLocalizedString('Keep Alarming'));
+    $('#alarmKeepAlarmingLabel').attr('title', getLocalizedString('Stop it via the alarm clock on the front side.'));
 
 
-	// Update panel
-	$('#updateLabel').text(getLocalizedString('Update available'));
-	$('#clientVersionLabel').text(getLocalizedString('Your version') + ':');
-	$('#availableVersionLabel').text(getLocalizedString('New version') + ':');
+    // Update panel
+    $('#updateLabel').text(getLocalizedString('Update available'));
+    $('#clientVersionLabel').text(getLocalizedString('Your version') + ':');
+    $('#availableVersionLabel').text(getLocalizedString('New version') + ':');
 }
 
 /**
  * Load and restore the user preferences.
  */
 function loadPreferences() {
-	if (window.widget) {
-		var buf = prefForKey(widget.identifier, 'background');
-		if (buf != null) {
-			$('#front').css('background', 'url(Images/Front_' + buf
-				+ '.png) no-repeat');
-			$('#backgroundColor').attr('value', buf);
-		}
-		buf = prefForKey(widget.identifier, 'timerTarget');
-		if (buf != null) {
-			$('#timerTarget').text(buf);
-		}
-		buf = prefForKey(widget.identifier, 'readyIn');
-		if (buf != null) {
-			$('#readyIn').text(buf);
-		}
-		buf = prefForKey(widget.identifier, 'hours');
-		if (buf != null) {
-		    $('#hours').text(front.formatTwoDigits(buf));
-		}
-		buf = prefForKey(widget.identifier, 'minutes');
-		if (buf != null) {
-		    $('#minutes').text(front.formatTwoDigits(buf));
-		}
-		buf = prefForKey(widget.identifier, 'seconds');
-		if (buf != null) {
-		    $('#seconds').text(front.formatTwoDigits(buf));
-		}
-		buf = prefForKey(widget.identifier, 'alarm.sound');
-		if (buf != null) {
-			alarm.sound = buf;
-			$('#alarmSound').attr('value', buf);
-		}
-		buf = prefForKey(widget.identifier, 'alarm.voice');
-		if (buf != null) {
-			alarm.voice = buf;
-			$('#alarmVoice').attr('value', buf);
-		}
-		buf = prefForKey(widget.identifier, 'alarm.growl');
-		if (buf != null) {
-			alarm.growl = buf;
-			if (buf == 'on')
-				$('#alarmGrowl').attr('checked', 'checked');
-		}
-		buf = prefForKey(widget.identifier, 'alarm.keepAlarming');
-		if (buf != null) {
-			alarm.keepAlarming = buf;
-			if (buf == 'on')
-				$('#alarmKeepAlarming').attr('checked', 'checked');
-		}
-	}
+    if (window.widget) {
+        var buf = prefForKey(widget.identifier, 'background');
+        if (buf != null) {
+            $('#front').css('background', 'url(Images/Front_' + buf
+                + '.png) no-repeat');
+            $('#backgroundColor').attr('value', buf);
+        }
+        buf = prefForKey(widget.identifier, 'timerTarget');
+        if (buf != null) {
+            $('#timerTarget').text(buf);
+        }
+        buf = prefForKey(widget.identifier, 'readyIn');
+        if (buf != null) {
+            $('#readyIn').text(buf);
+        }
+        buf = prefForKey(widget.identifier, 'hours');
+        if (buf != null) {
+            $('#hours').text(front.formatTwoDigits(buf));
+        }
+        buf = prefForKey(widget.identifier, 'minutes');
+        if (buf != null) {
+            $('#minutes').text(front.formatTwoDigits(buf));
+        }
+        buf = prefForKey(widget.identifier, 'seconds');
+        if (buf != null) {
+            $('#seconds').text(front.formatTwoDigits(buf));
+        }
+        buf = prefForKey(widget.identifier, 'alarm.sound');
+        if (buf != null) {
+            alarm.sound = buf;
+            $('#alarmSound').attr('value', buf);
+        }
+        buf = prefForKey(widget.identifier, 'alarm.voice');
+        if (buf != null) {
+            alarm.voice = buf;
+            $('#alarmVoice').attr('value', buf);
+        }
+        buf = prefForKey(widget.identifier, 'alarm.growl');
+        if (buf != null) {
+            alarm.growl = buf;
+            if (buf == 'on')
+                $('#alarmGrowl').attr('checked', 'checked');
+        }
+        buf = prefForKey(widget.identifier, 'alarm.keepAlarming');
+        if (buf != null) {
+            alarm.keepAlarming = buf;
+            if (buf == 'on')
+                $('#alarmKeepAlarming').attr('checked', 'checked');
+        }
+    }
 }
 
 /**
  */
 function prefForKey(id, key) {
     var buf = widget.preferenceForKey(widget.identifier + '-' + key);
-	if (buf && buf.length > 0) {
-		return buf
-	}
+    if (buf && buf.length > 0) {
+        return buf
+    }
 
-	buf = widget.preferenceForKey(key);
-	if (buf && buf.length > 0) {
-	    return buf
-	}
+    buf = widget.preferenceForKey(key);
+    if (buf && buf.length > 0) {
+        return buf
+    }
 
     return null
 }
  */
 function getLocalizedString(key)
 {
-	try {
-		var ret = localizedStrings[key];
-		if (ret === undefined)
-			ret = key;
-		return ret;
-	} catch (ex) {}
-	return key;
+    try {
+        var ret = localizedStrings[key];
+        if (ret === undefined)
+            ret = key;
+        return ret;
+    } catch (ex) {}
+    return key;
 }
 
 /**
  * Called when the widget has been removed from the Dashboard.
  */
 function remove() {
-	// Stop any timers to prevent CPU usage
-	// Remove any preferences as needed
-	// widget.setPreferenceForKey(null, dashcode.createInstancePreferenceKey("your-key"));
+    // Stop any timers to prevent CPU usage
+    // Remove any preferences as needed
+    // widget.setPreferenceForKey(null, dashcode.createInstancePreferenceKey("your-key"));
 }
 
 /**
  * Called when the widget has been hidden.
  */
 function hide() {
-	// Don't stop the timer or you'll forget your tea!
+    // Don't stop the timer or you'll forget your tea!
 }
 
 /**
  * Called when the widget has been shown.
  */
 function show() {
-	updater.check();
+    updater.check();
 }
 
 /**
  *
  * @param event: onClick event from the info button
  */
-function showBack(event) {    
-	if (window.widget) {		
+function showBack(event) {
+    if (window.widget) {
         window.resizeTo(320, 150);
-		widget.prepareForTransition("ToBack");
-	}
+        widget.prepareForTransition("ToBack");
+    }
 
-	$('#front').css('display', 'none');
-	$('#back').css('display', 'block');
+    $('#front').css('display', 'none');
+    $('#back').css('display', 'block');
 
-	if (window.widget) {
-		setTimeout('widget.performTransition();', 0);
-	}
+    if (window.widget) {
+        setTimeout('widget.performTransition();', 0);
+    }
 }
 
 /**
  * @param event: onClick event from the done button
  */
 function showFront(event) {
-	if (window.widget) {
-		widget.prepareForTransition("ToFront");
-		window.resizeTo(320, 120);
-	}
+    if (window.widget) {
+        widget.prepareForTransition("ToFront");
+        window.resizeTo(320, 120);
+    }
 
-	$('#front').css('display', 'block');
-	$('#back').css('display', 'none');
+    $('#front').css('display', 'block');
+    $('#back').css('display', 'none');
 
-	if (window.widget) {
-		setTimeout('widget.performTransition();', 0);
-	}
+    if (window.widget) {
+        setTimeout('widget.performTransition();', 0);
+    }
 }

File Tea Timer.wdgt/de.lproj/LocalizedStrings.js

View file
 var localizedStrings = {
-	'Tea Timer': 'Tea Timer',
+    'Tea Timer': 'Tea Timer',
 
-	// Front side
-	'Tea': 'Tee',
-	'Something': 'Irgendwas',
-	'ready in': 'fertig in',
-	'in': 'in',
-	'hrs.': 'Std.',
-	'mins.': 'Min.',
-	'secs.': 'Sek.',
-	'is ready.': 'ist fertig!',
+    // Front side
+    'Tea': 'Tee',
+    'Something': 'Irgendwas',
+    'ready in': 'fertig in',
+    'in': 'in',
+    'hrs.': 'Std.',
+    'mins.': 'Min.',
+    'secs.': 'Sek.',
+    'is ready.': 'ist fertig!',
 
-	// Back side
-	'Done': 'Fertig',
-	'Tea Timer website': 'Tea Timer Website',
-	'Design': 'Design',
-	'Background color': 'Hintergrundfarbe',
-	'Default': 'Standard',
-	'Cayenne': 'Cayenne',
-	'Graphite': 'Graphit',
-	'Lime': 'Limette',
-	'Ocean': 'Ozean',
-	'Orange': 'Orange',
+    // Back side
+    'Done': 'Fertig',
+    'Tea Timer website': 'Tea Timer Website',
+    'Design': 'Design',
+    'Background color': 'Hintergrundfarbe',
+    'Default': 'Standard',
+    'Cayenne': 'Cayenne',
+    'Graphite': 'Graphit',
+    'Lime': 'Limette',
+    'Ocean': 'Ozean',
+    'Orange': 'Orange',
     'Pink': 'Pink',
-	'Purple': 'Violett',
-	'Silver': 'Silber',
+    'Purple': 'Violett',
+    'Silver': 'Silber',
 
-	'Alarm': 'Alarm',
-	'Off': 'Aus',
-	'Voice': 'Stimme',
-	'Sound': 'Ton',
-	'Use Growl': 'Benutze Growl',
-	'Keep Alarming': 'Daueralarm',
-	'Stop it via the alarm clock on the front side.': 'Kann über die Alarmuhr auf der Vorderseite gestoppt werden.',
+    'Alarm': 'Alarm',
+    'Off': 'Aus',
+    'Voice': 'Stimme',
+    'Sound': 'Ton',
+    'Use Growl': 'Benutze Growl',
+    'Keep Alarming': 'Daueralarm',
+    'Stop it via the alarm clock on the front side.': 'Kann über die Alarmuhr auf der Vorderseite gestoppt werden.',
 
-	// Update panel
-	'Update available': 'Update verfügbar',
-	'Your version': 'Deine Version',
-	'New version': 'Neue Version'
+    // Update panel
+    'Update available': 'Update verfügbar',
+    'Your version': 'Deine Version',
+    'New version': 'Neue Version'
 }

File Tea Timer.wdgt/en.lproj/LocalizedStrings.js

View file
 var localizedStrings = {
-	'Tea Timer': 'Tea Timer',
+    'Tea Timer': 'Tea Timer',
 
-	// Front side
-	'Tea': 'Tea',
-	'Something': 'Something',
-	'ready in': 'ready in',
-	'in': 'in',
-	'hrs.': 'hrs.',
-	'mins.': 'mins.',
-	'secs.': 'secs.',
-	'is ready.': 'is ready.',
+    // Front side
+    'Tea': 'Tea',
+    'Something': 'Something',
+    'ready in': 'ready in',
+    'in': 'in',
+    'hrs.': 'hrs.',
+    'mins.': 'mins.',
+    'secs.': 'secs.',
+    'is ready.': 'is ready.',
 
-	// Back side
-	'Done': 'Done',
-	'Tea Timer website': 'Tea Timer website',
-	'Design': 'Design',
-	'Background color': 'Background color',
-	'Default': 'Default',
-	'Cayenne': 'Cayenne',
-	'Graphite': 'Graphite',
-	'Lime': 'Lime',
-	'Ocean': 'Ocean',
-	'Orange': 'Orange',
+    // Back side
+    'Done': 'Done',
+    'Tea Timer website': 'Tea Timer website',
+    'Design': 'Design',
+    'Background color': 'Background color',
+    'Default': 'Default',
+    'Cayenne': 'Cayenne',
+    'Graphite': 'Graphite',
+    'Lime': 'Lime',
+    'Ocean': 'Ocean',
+    'Orange': 'Orange',
     'Pink': 'Pink',
-	'Purple': 'Purple',
-	'Silver': 'Silver',
+    'Purple': 'Purple',