1
var global = new Object();
7
global.startTime = null;
9
global.siteUrl = "http://code.google.com/apis/gears/samples/running_man/step2/index.html";
16
function installShortcut() {
17
var desktop = google.gears.factory.create('beta.desktop');
18
desktop.createShortcut("RunningMan", global.siteUrl,
19
{ "48x48" : "../images/icon.png" }, "RunningMan Step2");
27
global.updateInterval = setInterval("updateTime()", 1000);
28
global.startTime = new Date();
32
clearInterval(global.updateInterval);
37
global.startTime = null;
42
* display stopwatch time value
44
function updateTime() {
46
if (global.startTime != null) {
47
time = (new Date()).getTime() - global.startTime;
50
var timeDiv = document.getElementById("timeDisplay");
51
timeDiv.innerHTML = formatTime(time);
55
* Format a time value given in seconds
57
function formatTime(aTime) {
58
var seconds = aTime % 60;
59
var minutes = ((aTime / 60) |0) % 60;
60
var hours = (aTime / 3600) |0;
63
time = seconds + " s";
66
time = minutes + " min " + time;
69
time = hours + " h " + time;
77
* Navigation functions
82
var functionName = "on_" + name;
84
if (window[functionName] != null) {
85
window[functionName]();
89
function showDiv(name) {
90
var elem = document.getElementById(name);
92
elem.style.display="block";
96
function hideDiv(name) {
97
var elem = document.getElementById(name);
99
elem.style.display="none";
103
function hideAllScreens() {
104
hideDiv('mainScreen');