diff options
author | Jinwei Zhao <[email protected]> | 2015-12-19 22:24:42 +0900 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2017-01-13 15:07:45 +0800 |
commit | dbcebe1def5c355120c61b575390d1d9ac355f67 (patch) | |
tree | 70e61cc34a690c63ff80962e9ef883fe69dba6d3 /Code/Blocks/time/script.js | |
parent | 7e473afdca63f0ceed5d895c3be3b43f213ca136 (diff) | |
download | jinwei.me-dbcebe1def5c355120c61b575390d1d9ac355f67.tar.gz |
clear up
Diffstat (limited to 'Code/Blocks/time/script.js')
-rw-r--r-- | Code/Blocks/time/script.js | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/Code/Blocks/time/script.js b/Code/Blocks/time/script.js deleted file mode 100644 index fb8ba69..0000000 --- a/Code/Blocks/time/script.js +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | |||
2 | var update = function() { | ||
3 | |||
4 | // initialise screen | ||
5 | // selects all elements with class on and removes it | ||
6 | $('.on').removeClass("on"); | ||
7 | $("#its").addClass('on'); | ||
8 | |||
9 | // initialise date variables | ||
10 | current = new Date(); | ||
11 | var hour = current.getHours(); | ||
12 | if (hour > 12) {hour -= 12}; | ||
13 | var minutes = current.getMinutes(); | ||
14 | |||
15 | // set modifier | ||
16 | if (minutes < 3){ | ||
17 | $("#oclock").addClass('on'); | ||
18 | }else if (minutes < 33){ | ||
19 | $("#past").addClass('on'); | ||
20 | $("#minutes").addClass('on'); | ||
21 | }else if (minutes <= 57){ | ||
22 | $("#to").addClass('on'); | ||
23 | $("#minutes").addClass('on'); | ||
24 | hour === 12 ? hour = 1: hour += 1; | ||
25 | minutes = 60 - minutes; | ||
26 | }else{ | ||
27 | $("#oclock").addClass('on'); | ||
28 | hour === 12 ? hour = 1: hour += 1; | ||
29 | minutes = 60 - minutes; | ||
30 | } | ||
31 | |||
32 | //set minutes | ||
33 | if (minutes >= 3){ | ||
34 | if(minutes < 7){ | ||
35 | $("#fiveMod").addClass('on'); | ||
36 | }else if (minutes < 13){ | ||
37 | $("#tenMod").addClass('on'); | ||
38 | }else if (minutes < 17){ | ||
39 | $("#quarter").addClass('on'); | ||
40 | $("#minutes").removeClass('on'); | ||
41 | }else if (minutes < 23){ | ||
42 | $("#twenty").addClass('on'); | ||
43 | }else if (minutes < 27){ | ||
44 | $("#twenty").addClass('on'); | ||
45 | $("#fiveMod").addClass('on'); | ||
46 | }else if (minutes < 33){ | ||
47 | $("#half").addClass('on'); | ||
48 | $("#minutes").removeClass('on'); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | //set hours | ||
53 | switch (hour){ | ||
54 | case 1 : | ||
55 | $("#one").addClass('on'); | ||
56 | break; | ||
57 | case 2 : | ||
58 | $("#two").addClass('on'); | ||
59 | break; | ||
60 | case 3 : | ||
61 | $("#three").addClass('on'); | ||
62 | break; | ||
63 | case 4 : | ||
64 | $("#four").addClass('on'); | ||
65 | break; | ||
66 | case 5 : | ||
67 | $("#five").addClass('on'); | ||
68 | break; | ||
69 | case 6 : | ||
70 | $("#six").addClass('on'); | ||
71 | break; | ||
72 | case 7 : | ||
73 | $("#seven").addClass('on'); | ||
74 | break; | ||
75 | case 8 : | ||
76 | $("#eight").addClass('on'); | ||
77 | break; | ||
78 | case 9 : | ||
79 | $("#nine").addClass('on'); | ||
80 | break; | ||
81 | case 10 : | ||
82 | $("#ten").addClass('on'); | ||
83 | break; | ||
84 | case 11 : | ||
85 | $("#eleven").addClass('on'); | ||
86 | break; | ||
87 | case 12 : | ||
88 | $("#twelve").addClass('on'); | ||
89 | break; | ||
90 | } | ||
91 | |||
92 | } | ||
93 | |||
94 | // run update on load and repeat every 30 seconds afterwards | ||
95 | $(document).ready(function(){ | ||
96 | update(); | ||
97 | setInterval(update,30000); | ||
98 | }); \ No newline at end of file | ||