Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 119 lines (101 sloc) 4.101 kB
3293880 let's start
dab authored
1 <!DOCTYPE html>
8328583 trying to get cache working
dab authored
2 <html manifest="timeloop.appcache">
3293880 let's start
dab authored
3
4 <head>
5 <meta charset="utf-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 <title>Time Loops</title>
5eed9fa moving all assets etc.
dab authored
8 <link rel="stylesheet" href="assets/jquery.mobile-1.0b3.min.css" >
9 <script src="assets/jquery-1.6.3.min.js"></script>
10 <script src="assets/jquery.mobile-1.0b3.min.js"></script>
11 <script type="text/javascript" src="assets/jstorage.js"></script>
12 <script type="text/javascript" src="assets/date.js"></script>
3293880 let's start
dab authored
13 <script type="text/javascript">
14 $(document).ready(function() {
15 showPreviousTasks();
16 $('#flush-storage').click( function() {
17 $.jStorage.flush();
18 console.log('All records flushed!');
19 });
20 if (findCurrentTask()) {
21 $('#task-start').hide();
22 formatRunningTaskTitle(findCurrentTask());
23 } else {
24 $('#task-stop').hide();
25 }
26
27 if ($.jStorage.storageAvailable()) {
28
29 $('#task-start').click( function() {
30 $(this).hide();
31 $('#task-stop').show();
32 rightNow = new Date.now();
33 formatRunningTaskTitle(rightNow);
34 $.jStorage.set(rightNow.toISOString(), '');
35 });
36 $('#task-stop').click(function() {
37 $(this).hide();
38 $('#task-start').show();
39 rightNow = new Date.now();
40 $('#pageTitle').html('No current task');
41 $.jStorage.set(findCurrentTask(), rightNow.toISOString());
42 var li = $('.tasks li');
43 li.fadeOut('fast', function() { li.remove(); });
44 showPreviousTasks();
45 });
46 }
47 function findCurrentTask() {
48 var currentTask = false;
49 index = $.jStorage.index();
50 $.each(index, function(n, startTime) {
51 startingDate = Date.parse(startTime);
52 console.log(startTime, startingDate);
53
54 endTime = $.jStorage.get(startTime);
55 if (endTime == '') {
56 currentTask = startTime;
57 return false;
58 }
59 });
60 return currentTask;
61 }
62
63 function formatRunningTaskTitle(timeStamp) {
64 currentTime = timeStamp.toString('HH:mm');
65
66 $('#pageTitle').html( 'Task running from <strong>' + currentTime + '</strong>.');
67 }
68 function showPreviousTasks() {
69 index = $.jStorage.index();
70 $.each(index, function(n, startTime) {
71
72 endTime = $.jStorage.get(startTime);
73 if (endTime != '') {
74 console.log(startTime);
75 $(".tasks").append('<li><strong>Start:</strong> ' + startTime.toString('HH:mm') + '. <strong>End:</strong> ' + endTime + '.</li>');
76 }
77 });
78 $('ul').listview('refresh');
79 }
80
81 });
82
83 </script>
84 </head>
85
86 <body>
87
88 <!-- Start of first page: #one -->
89 <div data-role="page" id="foo">
90
8328583 trying to get cache working
dab authored
91 <div data-role="header" class="ui-bar">
92 <select name="select-choice-0" class="ui-btn-right" id="select-choice-1">
93 <option value="en">English</option>
94 <option value="ru">Russian</option>
95 <option value="fin">Finland</option>
96 </select>
97 </div>
98 <div data-role="content" id="one">
5eed9fa moving all assets etc.
dab authored
99 <p><img src="assets/logo.png"></p>
3293880 let's start
dab authored
100
101 <h2 id="pageTitle">No current task</h2>
102
103 <a href="#" id="task-start" class="" data-role="button" data-icon="arrow-r" data-inline="true" >Start task</a>
104 <a href="#" id="task-stop" class="hidden" data-role="button" data-icon="check" data-inline="true" >Stop task</a>
105 <p>Previous tasks:</p>
106 <ul class="tasks" data-role="listview" data-inset="true">
107 </ul>
108
109 </div><!-- /content -->
110 <div data-role="footer" class="ui-bar">
111 <a href="#" id="flush-storage" data-role="button" data-icon="delete">Clear records</a>
112 <a href="#" id="flush-storage" data-role="button" data-icon="refresh">Submit records</a>
113 </div>
114
115 </div><!-- /page one -->
116
117 </body>
118 </html>
Something went wrong with that request. Please try again.