1
// This file was generated by Dashcode from Apple Inc.
2
// You may edit this file to customize your Dashboard widget.
6
// Called by HTML body element's onload event when the widget is ready to start
8
//window.DaliClock = undefined;
12
if (window.DaliClock) {
15
window.DaliClock.setDateStyle(widget.preferenceForKey(createInstancePreferenceKey("dateStyle")) || 0);
16
window.DaliClock.setTimeStyle(widget.preferenceForKey(createInstancePreferenceKey("timeStyle")) || 0);
17
window.DaliClock.setHourStyle(widget.preferenceForKey(createInstancePreferenceKey("hourStyle")) || 0);
20
showError ("Dali Clock widget plugin failed to load!");
26
// Called when the widget has been removed from the Dashboard
30
// Stop any timers to prevent CPU usage
31
// Remove any preferences as needed
32
// widget.setPreferenceForKey(null, createInstancePreferenceKey("your-key"));
33
if (window.DaliClock) {
34
window.DaliClock.hide();
40
// Called when the widget has been hidden
44
// Stop any timers to prevent CPU usage
45
if (window.DaliClock) {
46
window.DaliClock.hide();
52
// Called when the widget has been shown
56
// Restart any timers that were stopped on hide
57
if (window.DaliClock && front.style.display != "none") {
60
var w = document.width - (x*2);
61
var h = document.height - (y*2);
62
window.DaliClock.setFrame(new Array (x, y, w, h));
63
window.DaliClock.show();
69
// Called when the widget has been synchronized with .Mac
73
// Retrieve any preference values that you need to be synchronized here
74
// Use this for an instance key's value:
75
// instancePreferenceValue = widget.preferenceForKey(null, createInstancePreferenceKey("your-key"));
77
// Or this for global key's value:
78
// globalPreferenceValue = widget.preferenceForKey(null, "your-key");
82
// Function: showBack(event)
83
// Called when the info button is clicked to show the back of the widget
85
// event: onClick event from the info button
87
function showBack(event)
89
var front = document.getElementById("front");
90
var back = document.getElementById("back");
93
widget.prepareForTransition("ToBack");
96
front.style.display = "none";
97
back.style.display = "block";
100
setTimeout('widget.performTransition();', 0);
103
if (window.DaliClock) {
104
window.DaliClock.hide();
106
var d = window.DaliClock.dateStyle();
107
var t = window.DaliClock.timeStyle();
108
var h = window.DaliClock.hourStyle();
109
document.getElementById("dateStyleMMDDYY").checked = (d == 0);
110
document.getElementById("dateStyleDDMMYY").checked = (d == 1);
111
document.getElementById("dateStyleYYMMDD").checked = (d == 2);
112
document.getElementById("timeStyleHHMMSS").checked = (t == 0);
113
document.getElementById("timeStyleHHMM").checked = (t == 1);
114
document.getElementById("timeStyleSS").checked = (t == 2);
115
document.getElementById("hourStyle12").checked = (h == 0);
116
document.getElementById("hourStyle24").checked = (h == 1);
121
// Function: showFront(event)
122
// Called when the done button is clicked from the back of the widget
124
// event: onClick event from the done button
126
function showFront(event)
128
var front = document.getElementById("front");
129
var back = document.getElementById("back");
132
widget.prepareForTransition("ToFront");
135
front.style.display="block";
136
back.style.display="none";
139
setTimeout('widget.performTransition();', 0);
142
if (window.DaliClock) {
143
window.DaliClock.setHourStyle(document.getElementById("hourStyle24").checked ? 1 : 0);
144
window.DaliClock.setTimeStyle(document.getElementById("timeStyleSS").checked ? 2 :
145
document.getElementById("timeStyleHHMM").checked ? 1 : 0);
146
window.DaliClock.setDateStyle(document.getElementById("dateStyleYYMMDD").checked ? 2 :
147
document.getElementById("dateStyleDDMMYY").checked ? 1 : 0);
149
widget.setPreferenceForKey(window.DaliClock.dateStyle(), createInstancePreferenceKey("dateStyle"));
150
widget.setPreferenceForKey(window.DaliClock.timeStyle(), createInstancePreferenceKey("timeStyle"));
151
widget.setPreferenceForKey(window.DaliClock.hourStyle(), createInstancePreferenceKey("hourStyle"));
153
window.DaliClock.show();
157
function showError(error) {
158
var errorDiv = document.getElementById("errorDiv");
159
if (errorDiv.firstChild) {
160
errorDiv.removeChild(errorDiv.firstChild);
162
errorDiv.appendChild(document.createTextNode(error));
163
errorDiv.style.display = "block";
167
widget.onremove = remove;
168
widget.onhide = hide;
169
widget.onshow = show;
170
widget.onsync = sync;