Commits

Stefan Scherfke committed 6c7b54d

Initial Import

Comments (0)

Files changed (7)

Added
New image
Added
New image
+<?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>CFBundleIdentifier</key>
+	<string>org.sofa-rockers.widget.TeaTimer</string>
+	<key>CFBundleName</key>
+	<string>TeaTimer</string>
+	<key>CFBundleDisplayName</key>
+	<string>Tea Timer</string>
+	<key>CFBundleVersion</key>
+	<string>0.1</string>
+	<key>MainHTML</key>
+	<string>TeaTimer.html</string>
+	<key>CloseBoxInsetX</key>
+	<integer>16</integer>
+	<key>CloseBoxInsetY</key>
+	<integer>14</integer>
+	<key>Width</key>
+	<string>150</string>
+	<key>Height</key>
+	<string>50</string>
+</dict>
+</plist>
+• Up/Down Arrows for time inputs
+• Info-Button
+• Back side
+• Input fields
+• Countdown
+• Action after countdown
+  • Sound
+  • Growl
+  • Voice
+  • Dialog
+• Bling bling
+• Auto-update
+• I18N
+body {
+	margin: 0px;
+	background: url(Default.png) no-repeat;
+}
+
+.editable {
+	cursor: text;
+}
+
+#time {
+	position: absolute;
+	left: 20px;
+	top: 20px;
+	font-family: "Lucida Grande";
+	font-size: 16pt;
+	color: #FFFFFF;
+}
+
+#timerTargetInput {
+	position: absolute;
+	left: 20px;
+	top: 20px;
+	visibility: hidden;
+	width: 50px;
+}
+
+#hoursInput, #minutesInput, #secondsInput {
+	position: absolute;
+	top: 50px;
+	visibility: hidden;
+	width: 20px;
+}
+
+#hoursInput {
+	left: 20px;
+}
+
+#minutesInput {
+	left: 65px;
+}
+
+#secondsInput {
+	left: 110px;
+}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<title>Tea Timer</title>
+
+<style type="text/css">
+@import "TeaTimer.css";
+</style>
+<script type="text/javascript" src="TeaTimer.js"></script>
+
+</head>
+
+
+<body>
+
+<div id="front">
+	<div id="time">
+		<span id="timerTarget" class="editable" onClick="showEdit('timerTargetInput', 'timerTarget')">Tee</span><br />
+		<small>fertig in:</small><br />
+		<span id="hours" class="editable" onClick="showEdit('hoursInput', 'hours')">00</span>
+		<small>:</small>
+		<span id="minutes" class="editable" onClick="showEdit('minutesInput', 'minutes')">00</span>
+		<small>:</small>
+		<span id="seconds" class="editable" onClick="showEdit('secondsInput', 'seconds')">00</span>
+		<span id="start" onClick="checkForAlarm()">Start</span>
+	</div>
+	<input type="text" id="timerTargetInput" maxlength="10" onBlur="setText('timerTargetInput', 'timerTarget')" />
+	<input type="text" id="hoursInput" maxlength="2" value="00" onBlur="setText('hoursInput', 'hours')" />
+	<input type="text" id="minutesInput" maxlength="2" value="00" onBlur="setText('minutesInput', 'minutes')" />
+	<input type="text" id="secondsInput" maxlength="2" value="00" onBlur="setText('secondsInput', 'seconds')" />
+</div>
+
+<div id="back">
+</div>
+
+</body>
+
+</html>
+var targetTime = null;
+var remainingSeconds = -1;
+var isTargetReached = false;
+var timerInterval = null;
+
+/**
+ * Show the text input field to set an event or the time.
+ *
+ * @param editorId: The id of the input field.
+ * @param displayId: The id of the corresponding display container.
+ */
+function showEdit(editorId, displayId) {
+	editor = document.getElementById(editorId);
+	display = document.getElementById(displayId);
+	editor.style.visibility = 'visible';
+	display.style.visibility = 'hidden';
+	editor.focus();
+	editor.select();
+}
+
+/**
+ * Set the text from the input field to the display container and hide
+ * the input field.
+ *
+ * @param editorId: The id of the input field.
+ * @param displayId: The id of the corresponding display container.
+ */
+function setText(editorId, displayId) {
+	if (timerInterval)
+		clearInterval(timerInterval);
+	editor = document.getElementById(editorId);
+	display = document.getElementById(displayId);
+	if (editor.value.length < 1) {
+		if (editorId == 'timerTargetInput')
+			editor.value = 'Irgendwas';
+		else
+			editor.value = '00';
+	}
+	display.firstChild.data = editor.value;
+	display.style.visibility = 'visible';
+	editor.style.visibility = 'hidden';
+}
+
+//function startNewTimer() {
+//	// set targetTime
+//	// start runTimer()
+//	isTargetReached = false
+//}
+//
+//function runTimer() {
+//    calculateRemainingTime();
+//    updateTimerDisplay();
+//    checkForAlarm();
+//}
+//
+//function calculateRemainingTime() {
+//}
+
+/**
+ * Update the timer display with the currently remaining time.
+ */
+function updateTimerDisplay() {
+	elemH = document.getElementById('hours');
+	elemM = document.getElementById('minutes');
+	elemS = document.getElementById('seconds');
+	h = parseInt(elemH.firstChild.data);
+	m = parseInt(elemM.firstChild.data);
+	s = parseInt(elemS.firstChild.data);
+}
+
+/**
+ * The data of the specified element.
+ *
+ * @param elementId: The element's id.
+ * @param elementValue: The new data.
+ */
+function setElementText(elementId, elementValue) {
+	document.getElementById(elementId).firstChild.data = elementValue;
+}
+
+/**
+ * Formats a number to to digits with leading zero.
+ *
+ * @param number: The number to format.
+ * @return: The formatted number.
+ */
+function formatTwoDigits(number) {
+	number = number.toString(10);
+	if (number.length == 1)
+		number = '0' + number;
+	return number;
+}
+
+/**
+ * Check if the target time is reach and alarm the user.
+ */
+function checkForAlarm() {
+	if (remainingSeconds <= 0 && !isTargetReached) {
+		isTargetReached = true;
+		timerTarget = document.getElementById('timerTarget').firstChild.data;
+		alert(timerTarget + ' ist fertig!');
+	}
+}