Version Description
- Add new type clock
- Code improvement
Download this release
Release Info
Developer | adamskaat |
Plugin | Countdown, Coming Soon – Countdown & Clock |
Version | 1.3.1 |
Comparing to | |
See all releases |
Code changes from version 1.3.0 to 1.3.1
- assets/css/admin.css +5 -0
- assets/img/clock1.png +0 -0
- assets/js/Admin.js +58 -0
- assets/js/clock/Clock.js +26 -0
- assets/js/clock/canvas_clock.js +1352 -0
- assets/views/main/clock1View.php +38 -0
- classes/countdown/Clock1Countdown.php +107 -0
- classes/countdown/Countdown.php +423 -418
- config/config.php +2 -1
- config/optionsConfig.php +10 -16
- config/proOptionsConfig.php +31 -0
- countdown-builder.php +1 -1
- helpers/AdminHelper.php +294 -291
- readme.txt +6 -2
assets/css/admin.css
CHANGED
@@ -38,6 +38,11 @@
|
|
38 |
background-size: 100% 100%;
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
.timer-countdown {
|
42 |
background-image: url("../img/DigtalCountdown.jpg");
|
43 |
background-size: 100% 100%;
|
38 |
background-size: 100% 100%;
|
39 |
}
|
40 |
|
41 |
+
.clock1-countdown {
|
42 |
+
background-image: url("../img/clock1.png");
|
43 |
+
background-size: 100% 100%;
|
44 |
+
}
|
45 |
+
|
46 |
.timer-countdown {
|
47 |
background-image: url("../img/DigtalCountdown.jpg");
|
48 |
background-size: 100% 100%;
|
assets/img/clock1.png
ADDED
Binary file
|
assets/js/Admin.js
CHANGED
@@ -16,6 +16,64 @@ YcdAdmin.prototype.init = function() {
|
|
16 |
this.livePreview();
|
17 |
this.redirectToProWebpage();
|
18 |
this.newsletter();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
};
|
20 |
|
21 |
YcdAdmin.prototype.getTinymceContent = function()
|
16 |
this.livePreview();
|
17 |
this.redirectToProWebpage();
|
18 |
this.newsletter();
|
19 |
+
|
20 |
+
/*clock*/
|
21 |
+
this.clockLivePreview();
|
22 |
+
};
|
23 |
+
|
24 |
+
YcdAdmin.prototype.clockLivePreview = function() {
|
25 |
+
this.changeClcokWidth();
|
26 |
+
this.changeTimeZone();
|
27 |
+
};
|
28 |
+
|
29 |
+
YcdAdmin.prototype.changeClcokWidth = function() {
|
30 |
+
var width = jQuery('#ycd-clock1-width');
|
31 |
+
|
32 |
+
if (width.length) {
|
33 |
+
var that = this;
|
34 |
+
width.bind('change', function() {
|
35 |
+
var widthVal = parseInt(jQuery(this).val())+'px';
|
36 |
+
var cnavas = jQuery('.ycdClock1');
|
37 |
+
|
38 |
+
cnavas.attr('width', widthVal);
|
39 |
+
cnavas.attr('height', widthVal);
|
40 |
+
|
41 |
+
that.reinitClock();
|
42 |
+
});
|
43 |
+
}
|
44 |
+
};
|
45 |
+
|
46 |
+
YcdAdmin.prototype.changeTimeZone = function() {
|
47 |
+
var timeZone = jQuery('.js-circle-time-zone');
|
48 |
+
|
49 |
+
if(!timeZone.length) {
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
var that = this;
|
53 |
+
|
54 |
+
timeZone.bind('change', function() {
|
55 |
+
var val = jQuery(this).val();
|
56 |
+
var options = jQuery('.ycdClock1').data('options');
|
57 |
+
options['timeZone'] = val;
|
58 |
+
jQuery('.ycdClock1').attr('data-options', options);
|
59 |
+
|
60 |
+
that.reinitClock();
|
61 |
+
});
|
62 |
+
};
|
63 |
+
|
64 |
+
YcdAdmin.prototype.reinitClock = function() {
|
65 |
+
var cnavas = jQuery('.ycdClock1');
|
66 |
+
var dataArgs = cnavas.data('args');
|
67 |
+
var dataOptions = cnavas.data('options');
|
68 |
+
|
69 |
+
var width = jQuery('.ycdClock1').width();
|
70 |
+
var height = jQuery('.ycdClock1').height();
|
71 |
+
|
72 |
+
jQuery('.ycdClock1').remove()
|
73 |
+
jQuery('.ycd-countdown-wrapper').prepend('<canvas data-args='+JSON.stringify(dataArgs)+' data-options='+JSON.stringify(dataOptions)+' class="ycdClock1" width="'+width+'px" height="'+height+'px"></canvas>');
|
74 |
+
|
75 |
+
var obj = new YcdClock();
|
76 |
+
obj.init()
|
77 |
};
|
78 |
|
79 |
YcdAdmin.prototype.getTinymceContent = function()
|
assets/js/clock/Clock.js
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function YcdClock() {
|
2 |
+
|
3 |
+
}
|
4 |
+
|
5 |
+
YcdClock.prototype.init = function() {
|
6 |
+
jQuery('.ycdClock1').each(function(index, element) {
|
7 |
+
var args = jQuery(element).data('args');
|
8 |
+
var options = jQuery(element).data('options');
|
9 |
+
|
10 |
+
if (typeof options == 'undefined' || typeof args == 'undefined') {
|
11 |
+
return '';
|
12 |
+
}
|
13 |
+
var context = element.getContext('2d');
|
14 |
+
var width = parseInt(jQuery(this).width());
|
15 |
+
var settings = {};
|
16 |
+
|
17 |
+
settings.timeZone = options['timeZone'];
|
18 |
+
|
19 |
+
ycdClockConti(width, context, args, settings);
|
20 |
+
});
|
21 |
+
};
|
22 |
+
|
23 |
+
jQuery(document).ready(function() {
|
24 |
+
var obj = new YcdClock();
|
25 |
+
obj.init();
|
26 |
+
});
|
assets/js/clock/canvas_clock.js
ADDED
@@ -0,0 +1,1352 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Name: canvas_clock.js
|
3 |
+
* Author: Michael Kruger
|
4 |
+
* Brief:
|
5 |
+
*
|
6 |
+
* This is a canvas based library with 15 different clocks that can be embedded in webpages.
|
7 |
+
* For more info please visit: www.krugaroo.com#canvasClock
|
8 |
+
*
|
9 |
+
* Copyright 2016 Krugaroo
|
10 |
+
* More Info: www.krugaroo.com#canvasClock
|
11 |
+
*
|
12 |
+
* License: MIT License
|
13 |
+
*
|
14 |
+
* Copyright (c) 2016 Michael Kruger, Krugaroo
|
15 |
+
*
|
16 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
17 |
+
* of this software and associated documentation files (the "Software"), to deal
|
18 |
+
* in the Software without restriction, including without limitation the rights
|
19 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
20 |
+
* copies of the Software, and to permit persons to whom the Software is
|
21 |
+
* furnished to do so, subject to the following conditions:
|
22 |
+
*
|
23 |
+
* The above copyright notice and this permission notice shall be included in
|
24 |
+
* all copies or substantial portions of the Software.
|
25 |
+
*
|
26 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
27 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
28 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
29 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
30 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
31 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
32 |
+
* THE SOFTWARE.
|
33 |
+
*/
|
34 |
+
|
35 |
+
day_arr=["Sunday", "Monday", "Tuesday","Wednesday","Thursday","Friday","Saturday"];
|
36 |
+
month_arr=["January","February","March","April","May","June","July","August","September","October","November","December"];
|
37 |
+
|
38 |
+
function ycdClockConti(size, cns, clockd, extraOptions)
|
39 |
+
{
|
40 |
+
cns.clearRect(0,0,size,size);
|
41 |
+
|
42 |
+
cns.beginPath();
|
43 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
44 |
+
cns.rect(0,0,size,size);
|
45 |
+
cns.fill();
|
46 |
+
cns.closePath();
|
47 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
48 |
+
|
49 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
50 |
+
{
|
51 |
+
indicator(size, cns, clockd);
|
52 |
+
}
|
53 |
+
|
54 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
55 |
+
{
|
56 |
+
ycd_time_add((size/2),size/5*3, size, cns, clockd, extraOptions);
|
57 |
+
}
|
58 |
+
|
59 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
60 |
+
{
|
61 |
+
date_add((size/2),size/5*3+size/10, size, cns, clockd);
|
62 |
+
}
|
63 |
+
|
64 |
+
var now = new Date();
|
65 |
+
|
66 |
+
if (extraOptions.timeZone) {
|
67 |
+
var now = new Date().toLocaleString('en-US', {
|
68 |
+
timeZone: extraOptions.timeZone
|
69 |
+
});
|
70 |
+
}
|
71 |
+
|
72 |
+
now = new Date(now);
|
73 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
74 |
+
now.setTime(now.getTime()+time_off*1000);
|
75 |
+
var milisec=now.getMilliseconds();
|
76 |
+
var sec=now.getSeconds();
|
77 |
+
var min=now.getMinutes();
|
78 |
+
var hour=now.getHours()%12;
|
79 |
+
|
80 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
81 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
82 |
+
cns.lineCap="round";
|
83 |
+
|
84 |
+
cns.beginPath();
|
85 |
+
cns.lineWidth=1;
|
86 |
+
cns.moveTo((size/2),(size/2));
|
87 |
+
cns.arc((size/2),(size/2),size/3,-1.57+sec*0.1046+milisec/1000*0.1046,-1.569+sec*0.1046+milisec/1000*0.1046,0);
|
88 |
+
cns.stroke();
|
89 |
+
cns.closePath();
|
90 |
+
|
91 |
+
cns.beginPath();
|
92 |
+
cns.lineWidth=1;
|
93 |
+
cns.moveTo((size/2),(size/2));
|
94 |
+
cns.arc((size/2),(size/2),size/15,1.57+sec*0.1046+milisec/1000*0.1046,1.569+sec*0.1046+milisec/1000*0.1046,1);
|
95 |
+
cns.stroke();
|
96 |
+
cns.closePath();
|
97 |
+
|
98 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
99 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
100 |
+
cns.lineCap="round";
|
101 |
+
|
102 |
+
cns.beginPath();
|
103 |
+
cns.lineWidth=2;
|
104 |
+
cns.moveTo((size/2),(size/2));
|
105 |
+
cns.arc((size/2),(size/2),size/3,-1.57+min*0.1046+sec/60*0.1046,-1.569+min*0.1046+sec/60*0.1046,0);
|
106 |
+
cns.stroke();
|
107 |
+
cns.closePath();
|
108 |
+
|
109 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
110 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
111 |
+
cns.lineCap="round";
|
112 |
+
|
113 |
+
cns.beginPath();
|
114 |
+
cns.lineWidth=3;
|
115 |
+
cns.moveTo((size/2),(size/2));
|
116 |
+
cns.arc((size/2),(size/2),size/4,-1.57+hour*0.523+min/60*0.523,-1.569+hour*0.523+min/60*0.523,0);
|
117 |
+
cns.stroke();
|
118 |
+
cns.closePath();
|
119 |
+
|
120 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
121 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
122 |
+
cns.lineCap="round";
|
123 |
+
|
124 |
+
cns.beginPath();
|
125 |
+
cns.lineWidth=2;
|
126 |
+
cns.arc((size/2),(size/2),size/80,0,6.28,0);
|
127 |
+
cns.fill();
|
128 |
+
cns.closePath();
|
129 |
+
|
130 |
+
clockd.timer=setTimeout(function(){ycdClockConti(size, cns, clockd, extraOptions)},50);
|
131 |
+
}
|
132 |
+
|
133 |
+
function clock_digital(size, cns, clockd)
|
134 |
+
{
|
135 |
+
var now=new Date();
|
136 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
137 |
+
now.setTime(now.getTime()+time_off*1000);
|
138 |
+
var milisec=now.getMilliseconds();
|
139 |
+
var sec=now.getSeconds();
|
140 |
+
var min=now.getMinutes();
|
141 |
+
var hour=now.getHours();
|
142 |
+
|
143 |
+
cns.clearRect(0,0,size,size);
|
144 |
+
|
145 |
+
cns.beginPath();
|
146 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
147 |
+
cns.rect(0,0,size,size);
|
148 |
+
cns.fill();
|
149 |
+
cns.closePath();
|
150 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
151 |
+
|
152 |
+
if(hour<10){hour="0"+hour;}
|
153 |
+
if(min<10){min="0"+min;}
|
154 |
+
if(sec<10){sec="0"+sec;}
|
155 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333";
|
156 |
+
cns.textBaseline="middle";
|
157 |
+
cns.textAlign="center";
|
158 |
+
cns.font=size/8+"px Arial";
|
159 |
+
cns.fillText(hour+":"+min+":"+sec,(size/2),size/2.5);
|
160 |
+
|
161 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
162 |
+
{
|
163 |
+
date_add((size/2),size/5*3+size/10,size,cns, clockd);
|
164 |
+
}
|
165 |
+
|
166 |
+
clockd.timer=setTimeout(function(){clock_digital(size, cns, clockd)},50);
|
167 |
+
}
|
168 |
+
|
169 |
+
function clock_reverse(size, cns, clockd)
|
170 |
+
{
|
171 |
+
cns.clearRect(0,0,size,size);
|
172 |
+
|
173 |
+
cns.beginPath();
|
174 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
175 |
+
cns.rect(0,0,size,size);
|
176 |
+
cns.fill();
|
177 |
+
cns.closePath();
|
178 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
179 |
+
|
180 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
181 |
+
{
|
182 |
+
indicator(size, cns, clockd);
|
183 |
+
}
|
184 |
+
|
185 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
186 |
+
{
|
187 |
+
ycd_time_add((size/2),size/5*3, size, cns, clockd);
|
188 |
+
}
|
189 |
+
|
190 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
191 |
+
{
|
192 |
+
date_add((size/2),size/5*3+size/10, size, cns, clockd);
|
193 |
+
}
|
194 |
+
|
195 |
+
var now=new Date();
|
196 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
197 |
+
now.setTime(now.getTime()+time_off*1000);
|
198 |
+
var milisec=now.getMilliseconds();
|
199 |
+
var sec=now.getSeconds();
|
200 |
+
var min=now.getMinutes();
|
201 |
+
var hour=now.getHours()%12;
|
202 |
+
|
203 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
204 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
205 |
+
cns.lineCap="round";
|
206 |
+
|
207 |
+
cns.beginPath();
|
208 |
+
cns.lineWidth=1;
|
209 |
+
cns.moveTo((size/2),(size/2));
|
210 |
+
cns.arc((size/2),(size/2),size/3,-1.57-sec*0.1046,-1.569-sec*0.1046,0);
|
211 |
+
cns.stroke();
|
212 |
+
cns.closePath();
|
213 |
+
|
214 |
+
cns.beginPath();
|
215 |
+
cns.lineWidth=1;
|
216 |
+
cns.moveTo((size/2),(size/2));
|
217 |
+
cns.arc((size/2),(size/2),size/15,1.57-sec*0.1046,1.569-sec*0.1046,1);
|
218 |
+
cns.stroke();
|
219 |
+
cns.closePath();
|
220 |
+
|
221 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
222 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
223 |
+
cns.lineCap="round";
|
224 |
+
|
225 |
+
cns.beginPath();
|
226 |
+
cns.lineWidth=2;
|
227 |
+
cns.moveTo((size/2),(size/2));
|
228 |
+
cns.arc((size/2),(size/2),size/3,-1.57-min*0.1046,-1.569-min*0.1046,0);
|
229 |
+
cns.stroke();
|
230 |
+
cns.closePath();
|
231 |
+
|
232 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
233 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
234 |
+
cns.lineCap="round";
|
235 |
+
|
236 |
+
cns.beginPath();
|
237 |
+
cns.lineWidth=3;
|
238 |
+
cns.moveTo((size/2),(size/2));
|
239 |
+
cns.arc((size/2),(size/2),size/4,-1.57-hour*0.523-min/60*0.523,-1.569-hour*0.523-min/60*0.523,0);
|
240 |
+
cns.stroke();
|
241 |
+
cns.closePath();
|
242 |
+
|
243 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
244 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
245 |
+
cns.lineCap="round";
|
246 |
+
|
247 |
+
cns.beginPath();
|
248 |
+
cns.lineWidth=2;
|
249 |
+
cns.arc((size/2),(size/2),size/80,0,6.28,0);
|
250 |
+
cns.fill();
|
251 |
+
cns.closePath();
|
252 |
+
|
253 |
+
clockd.timer=setTimeout(function(){clock_reverse(size, cns, clockd)},50);
|
254 |
+
}
|
255 |
+
|
256 |
+
function clock_norm(size, cns, clockd)
|
257 |
+
{
|
258 |
+
var br=[60,120,180];
|
259 |
+
var r2=[10,20,30];
|
260 |
+
var r3=[40,80,120];
|
261 |
+
var r4=[4,5,7];
|
262 |
+
|
263 |
+
cns.clearRect(0,0,size,size);
|
264 |
+
|
265 |
+
cns.beginPath();
|
266 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
267 |
+
cns.rect(0,0,size,size);
|
268 |
+
cns.fill();
|
269 |
+
cns.closePath();
|
270 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
271 |
+
|
272 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
273 |
+
{
|
274 |
+
indicator(size, cns, clockd);
|
275 |
+
}
|
276 |
+
|
277 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
278 |
+
{
|
279 |
+
ycd_time_add((size/2),size/5*3, size, cns, clockd);
|
280 |
+
}
|
281 |
+
|
282 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
283 |
+
{
|
284 |
+
date_add((size/2),size/5*3+size/10, size, cns, clockd);
|
285 |
+
}
|
286 |
+
|
287 |
+
var now=new Date();
|
288 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
289 |
+
now.setTime(now.getTime()+time_off*1000);
|
290 |
+
var milisec=now.getMilliseconds();
|
291 |
+
var sec=now.getSeconds();
|
292 |
+
var min=now.getMinutes();
|
293 |
+
var hour=now.getHours()%12;
|
294 |
+
|
295 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
296 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
297 |
+
cns.lineCap="round";
|
298 |
+
|
299 |
+
cns.beginPath();
|
300 |
+
cns.lineWidth=1;
|
301 |
+
cns.moveTo((size/2),(size/2));
|
302 |
+
cns.arc((size/2),(size/2),size/3,-1.57+sec*0.1046,-1.569+sec*0.1046,0);
|
303 |
+
cns.stroke();
|
304 |
+
cns.closePath();
|
305 |
+
|
306 |
+
cns.beginPath();
|
307 |
+
cns.lineWidth=1;
|
308 |
+
cns.moveTo((size/2),(size/2));
|
309 |
+
cns.arc((size/2),(size/2),size/15,1.57+sec*0.1046,1.569+sec*0.1046,1);
|
310 |
+
cns.stroke();
|
311 |
+
cns.closePath();
|
312 |
+
|
313 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
314 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
315 |
+
cns.lineCap="round";
|
316 |
+
|
317 |
+
cns.beginPath();
|
318 |
+
cns.lineWidth=2;
|
319 |
+
cns.moveTo((size/2),(size/2));
|
320 |
+
cns.arc((size/2),(size/2),size/3,-1.57+min*0.1046,-1.569+min*0.1046,0);
|
321 |
+
cns.stroke();
|
322 |
+
cns.closePath();
|
323 |
+
|
324 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
325 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
326 |
+
cns.lineCap="round";
|
327 |
+
|
328 |
+
cns.beginPath();
|
329 |
+
cns.lineWidth=3;
|
330 |
+
cns.moveTo((size/2),(size/2));
|
331 |
+
cns.arc((size/2),(size/2),size/4,-1.57+hour*0.523+min/60*0.523,-1.569+hour*0.523+min/60*0.523,0);
|
332 |
+
cns.stroke();
|
333 |
+
cns.closePath();
|
334 |
+
|
335 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
336 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
337 |
+
cns.lineCap="round";
|
338 |
+
|
339 |
+
cns.beginPath();
|
340 |
+
cns.lineWidth=2;
|
341 |
+
cns.arc((size/2),(size/2),size/60,0,6.28,0);
|
342 |
+
cns.fill();
|
343 |
+
cns.closePath();
|
344 |
+
|
345 |
+
clockd.timer=setTimeout(function(){clock_norm(size, cns, clockd)},50);
|
346 |
+
}
|
347 |
+
|
348 |
+
function clock_follow(size, cns, clockd)
|
349 |
+
{
|
350 |
+
cns.clearRect(0,0,size,size);
|
351 |
+
|
352 |
+
cns.beginPath();
|
353 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
354 |
+
cns.rect(0,0,size,size);
|
355 |
+
cns.fill();
|
356 |
+
cns.closePath();
|
357 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
358 |
+
|
359 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
360 |
+
{
|
361 |
+
indicator(size, cns, clockd);
|
362 |
+
}
|
363 |
+
|
364 |
+
var now=new Date();
|
365 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
366 |
+
now.setTime(now.getTime()+time_off*1000);
|
367 |
+
var milisec=now.getMilliseconds();
|
368 |
+
var sec=now.getSeconds();
|
369 |
+
var min=now.getMinutes();
|
370 |
+
var hour=now.getHours()%12;
|
371 |
+
|
372 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
373 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
374 |
+
cns.lineCap="round";
|
375 |
+
|
376 |
+
cns.beginPath();
|
377 |
+
cns.lineWidth=1;
|
378 |
+
cns.arc((size/2),(size/2),size/3,-1.57,-1.569+sec*0.1046+milisec/1000*0.1046,0);
|
379 |
+
cns.lineTo((size/2),(size/2));
|
380 |
+
cns.stroke();
|
381 |
+
cns.closePath();
|
382 |
+
|
383 |
+
cns.beginPath();
|
384 |
+
cns.lineWidth=1;
|
385 |
+
cns.moveTo((size/2),(size/2));
|
386 |
+
cns.arc((size/2),(size/2),size/17,1.57+sec*0.1046+milisec/1000*0.1046,1.569+sec*0.1046+milisec/1000*0.1046,1);
|
387 |
+
cns.stroke();
|
388 |
+
cns.closePath();
|
389 |
+
|
390 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
391 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
392 |
+
cns.beginPath();
|
393 |
+
cns.lineWidth=2;
|
394 |
+
cns.arc((size/2),(size/2),size/3.5,-1.57,-1.569+min*0.1046+sec/60*0.1046,0);
|
395 |
+
cns.lineTo((size/2),(size/2));
|
396 |
+
cns.stroke();
|
397 |
+
cns.closePath();
|
398 |
+
|
399 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
400 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
401 |
+
cns.beginPath();
|
402 |
+
cns.lineWidth=2;
|
403 |
+
cns.arc((size/2),(size/2),size/4.5,-1.57,-1.569+hour*0.523+min/60*0.523,0);
|
404 |
+
cns.lineTo((size/2),(size/2));
|
405 |
+
cns.stroke();
|
406 |
+
cns.closePath();
|
407 |
+
|
408 |
+
cns.beginPath();
|
409 |
+
cns.lineWidth=2;
|
410 |
+
cns.arc((size/2),(size/2),size/60,0,6.28,0);
|
411 |
+
cns.fill();
|
412 |
+
cns.closePath();
|
413 |
+
|
414 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
415 |
+
{
|
416 |
+
ycd_time_add((size/2),size/5*3, size, cns, clockd);
|
417 |
+
}
|
418 |
+
|
419 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
420 |
+
{
|
421 |
+
date_add((size/2),size/5*3+size/15, size, cns, clockd);
|
422 |
+
}
|
423 |
+
|
424 |
+
clockd.timer=setTimeout(function(){clock_follow(size, cns, clockd)},50);
|
425 |
+
}
|
426 |
+
|
427 |
+
function clock_circles(size, cns, clockd)
|
428 |
+
{
|
429 |
+
cns.clearRect(0,0,size,size);
|
430 |
+
|
431 |
+
cns.beginPath();
|
432 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
433 |
+
cns.rect(0,0,size,size);
|
434 |
+
cns.fill();
|
435 |
+
cns.closePath();
|
436 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
437 |
+
|
438 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
439 |
+
{
|
440 |
+
indicator(size, cns, clockd);
|
441 |
+
}
|
442 |
+
|
443 |
+
var now=new Date();
|
444 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
445 |
+
now.setTime(now.getTime()+time_off*1000);
|
446 |
+
var milisec=now.getMilliseconds();
|
447 |
+
var sec=now.getSeconds();
|
448 |
+
var min=now.getMinutes();
|
449 |
+
var hour=now.getHours()%12;
|
450 |
+
|
451 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
452 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
453 |
+
cns.lineCap="round";
|
454 |
+
cns.beginPath();
|
455 |
+
cns.moveTo((size/2),(size/2));
|
456 |
+
cns.arc((size/2),(size/2),size/3,-1.57,-1.569+sec*0.1046+milisec/1000*0.1046,0);
|
457 |
+
cns.lineTo((size/2),(size/2));
|
458 |
+
cns.fill();
|
459 |
+
cns.closePath();
|
460 |
+
|
461 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
462 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
463 |
+
cns.lineCap="round";
|
464 |
+
cns.beginPath();
|
465 |
+
cns.moveTo((size/2),(size/2));
|
466 |
+
cns.arc((size/2),(size/2),size/3.5,-1.57,-1.569+min*0.1046+sec/60*0.1046,0);
|
467 |
+
cns.lineTo((size/2),(size/2));
|
468 |
+
cns.fill();
|
469 |
+
cns.closePath();
|
470 |
+
|
471 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
472 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
473 |
+
cns.lineCap="round";
|
474 |
+
cns.beginPath();
|
475 |
+
cns.moveTo((size/2),(size/2));
|
476 |
+
cns.arc((size/2),(size/2),size/4.5,-1.57,-1.569+hour*0.523+min/60*0.523,0);
|
477 |
+
cns.lineTo((size/2),(size/2));
|
478 |
+
cns.fill();
|
479 |
+
cns.closePath();
|
480 |
+
|
481 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
482 |
+
{
|
483 |
+
ycd_time_add((size/2),size/6*3, size, cns, clockd);
|
484 |
+
}
|
485 |
+
|
486 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
487 |
+
{
|
488 |
+
date_add((size/2),size/6*3+size/10, size, cns, clockd);
|
489 |
+
}
|
490 |
+
|
491 |
+
clockd.timer=setTimeout(function(){clock_circles(size, cns, clockd)},50);
|
492 |
+
}
|
493 |
+
|
494 |
+
function clock_grow(size, cns, clockd)
|
495 |
+
{
|
496 |
+
cns.clearRect(0,0,size,size);
|
497 |
+
|
498 |
+
cns.beginPath();
|
499 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
500 |
+
cns.rect(0,0,size,size);
|
501 |
+
cns.fill();
|
502 |
+
cns.closePath();
|
503 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
504 |
+
|
505 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
506 |
+
{
|
507 |
+
indicator(size, cns, clockd);
|
508 |
+
}
|
509 |
+
|
510 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
511 |
+
{
|
512 |
+
ycd_time_add((size/2),size/5*3, size, cns, clockd);
|
513 |
+
}
|
514 |
+
|
515 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
516 |
+
{
|
517 |
+
date_add((size/2),size/5*3+size/10, size, cns, clockd);
|
518 |
+
}
|
519 |
+
|
520 |
+
var now=new Date();
|
521 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
522 |
+
now.setTime(now.getTime()+time_off*1000);
|
523 |
+
var milisec=now.getMilliseconds();
|
524 |
+
var sec=now.getSeconds();
|
525 |
+
var min=now.getMinutes();
|
526 |
+
var hour=now.getHours()%12;
|
527 |
+
|
528 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
529 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
530 |
+
cns.lineCap="round";
|
531 |
+
cns.beginPath();
|
532 |
+
cns.lineWidth=1;
|
533 |
+
cns.moveTo((size/2),(size/2));
|
534 |
+
cns.arc((size/2),(size/2),sec*size/200+size/15,-1.57+sec*0.1046+milisec/1000*0.1046,-1.569+sec*0.1046+milisec/1000*0.1046,0);
|
535 |
+
cns.stroke();
|
536 |
+
cns.closePath();
|
537 |
+
|
538 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
539 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
540 |
+
cns.lineCap="round";
|
541 |
+
cns.lineWidth=1;
|
542 |
+
cns.moveTo((size/2),(size/2));
|
543 |
+
cns.arc((size/2),(size/2),min*size/200+sec/60*size/200+size/15,-1.57+min*0.1046+sec/60*0.1046,-1.569+min*0.1046+sec/60*0.1046,0);
|
544 |
+
cns.stroke();
|
545 |
+
cns.closePath();
|
546 |
+
|
547 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
548 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
549 |
+
cns.lineCap="round";
|
550 |
+
cns.lineWidth=2;
|
551 |
+
cns.moveTo((size/2),(size/2));
|
552 |
+
cns.arc((size/2),(size/2),hour*size/200*3+min/60*size/200*3+size/15,-1.57+hour*0.523+min/60*0.523,-1.569+hour*0.523+min/60*0.523,0);
|
553 |
+
cns.stroke();
|
554 |
+
cns.closePath();
|
555 |
+
|
556 |
+
cns.beginPath();
|
557 |
+
cns.lineWidth=2;
|
558 |
+
cns.arc((size/2),(size/2),size/60,0,6.28,0);
|
559 |
+
cns.fill();
|
560 |
+
cns.closePath();
|
561 |
+
|
562 |
+
clockd.timer=setTimeout(function(){clock_grow(size, cns, clockd)},50);
|
563 |
+
}
|
564 |
+
|
565 |
+
function clock_dots(size, cns, clockd)
|
566 |
+
{
|
567 |
+
cns.clearRect(0,0,size,size);
|
568 |
+
|
569 |
+
cns.beginPath();
|
570 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
571 |
+
cns.rect(0,0,size,size);
|
572 |
+
cns.fill();
|
573 |
+
cns.closePath();
|
574 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
575 |
+
|
576 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
577 |
+
{
|
578 |
+
indicator(size, cns, clockd);
|
579 |
+
}
|
580 |
+
|
581 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
582 |
+
{
|
583 |
+
ycd_time_add((size/2),size/6*3, size, cns, clockd);
|
584 |
+
}
|
585 |
+
|
586 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
587 |
+
{
|
588 |
+
date_add((size/2),size/6*3+size/10, size, cns, clockd);
|
589 |
+
}
|
590 |
+
|
591 |
+
var now=new Date();
|
592 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
593 |
+
now.setTime(now.getTime()+time_off*1000);
|
594 |
+
var milisec=now.getMilliseconds();
|
595 |
+
var sec=now.getSeconds();
|
596 |
+
var min=now.getMinutes();
|
597 |
+
var hour=now.getHours()%12;
|
598 |
+
|
599 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
600 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
601 |
+
cns.lineCap="round";
|
602 |
+
for(var a=0;a<(sec+1);a++)
|
603 |
+
{
|
604 |
+
var r=parseInt(a)*0.1046;
|
605 |
+
var calc=Math.cos(r-1.57)*(size/2.8);
|
606 |
+
var y=Math.sin(r-1.57)*(size/2.8);
|
607 |
+
|
608 |
+
cns.beginPath();
|
609 |
+
cns.arc(calc+(size/2),y+(size/2),size/100,0,6.28,0);
|
610 |
+
cns.fill();
|
611 |
+
cns.closePath();
|
612 |
+
}
|
613 |
+
|
614 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
615 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
616 |
+
cns.lineCap="round";
|
617 |
+
|
618 |
+
for(var a=0;a<(min+1);a++)
|
619 |
+
{
|
620 |
+
var r=parseInt(a)*0.1046;
|
621 |
+
var calc=Math.cos(r-1.57)*(size/3.4);
|
622 |
+
var y=Math.sin(r-1.57)*(size/3.4);
|
623 |
+
|
624 |
+
cns.beginPath();
|
625 |
+
cns.arc(calc+(size/2),y+(size/2),size/100,0,6.28,0);
|
626 |
+
cns.fill();
|
627 |
+
cns.closePath();
|
628 |
+
}
|
629 |
+
|
630 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
631 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
632 |
+
cns.lineCap="round";
|
633 |
+
|
634 |
+
for(var a=0;a<(hour+1);a++)
|
635 |
+
{
|
636 |
+
var r=parseInt(a)*0.523;
|
637 |
+
var calc=Math.cos(r-1.57)*(size/4.5);
|
638 |
+
var y=Math.sin(r-1.57)*(size/4.5);
|
639 |
+
|
640 |
+
cns.beginPath();
|
641 |
+
cns.arc(calc+(size/2),y+(size/2),size/100,0,6.28,0);
|
642 |
+
cns.fill();
|
643 |
+
cns.closePath();
|
644 |
+
}
|
645 |
+
|
646 |
+
clockd.timer=setTimeout(function(){clock_dots(size, cns, clockd)},50);
|
647 |
+
}
|
648 |
+
|
649 |
+
function clock_num(size, cns, clockd)
|
650 |
+
{
|
651 |
+
cns.clearRect(0,0,size,size);
|
652 |
+
|
653 |
+
cns.beginPath();
|
654 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
655 |
+
cns.rect(0,0,size,size);
|
656 |
+
cns.fill();
|
657 |
+
cns.closePath();
|
658 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
659 |
+
|
660 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
661 |
+
{
|
662 |
+
indicator(size, cns, clockd);
|
663 |
+
}
|
664 |
+
|
665 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
666 |
+
{
|
667 |
+
ycd_time_add((size/2),size/5*3, size, cns, clockd);
|
668 |
+
}
|
669 |
+
|
670 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
671 |
+
{
|
672 |
+
date_add((size/2),size/5*3+size/10, size, cns, clockd);
|
673 |
+
}
|
674 |
+
|
675 |
+
var now=new Date();
|
676 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
677 |
+
now.setTime(now.getTime()+time_off*1000);
|
678 |
+
var milisec=now.getMilliseconds();
|
679 |
+
var sec=now.getSeconds();
|
680 |
+
var min=now.getMinutes();
|
681 |
+
var hour=now.getHours()%12;
|
682 |
+
|
683 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
684 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
685 |
+
cns.lineCap="round";
|
686 |
+
cns.beginPath();
|
687 |
+
cns.lineWidth=1;
|
688 |
+
cns.moveTo((size/2),(size/2));
|
689 |
+
cns.arc((size/2),(size/2),size/3.2,-1.57+sec*0.1046+milisec/1000*0.1046,-1.569+sec*0.1046+milisec/1000*0.1046,0);
|
690 |
+
cns.stroke();
|
691 |
+
cns.closePath();
|
692 |
+
|
693 |
+
cns.textBaseline="middle";
|
694 |
+
cns.textAlign="center";
|
695 |
+
cns.font=(size/35+5)+"px Arial";
|
696 |
+
cns.fillText(sec,Math.cos(-1.57+sec*0.1046+milisec/1000*0.1046)*size/3+(size/2),Math.sin(-1.57+sec*0.1046+milisec/1000*0.1046)*size/3+(size/2))
|
697 |
+
|
698 |
+
cns.beginPath();
|
699 |
+
cns.lineWidth=1;
|
700 |
+
cns.moveTo((size/2),(size/2));
|
701 |
+
cns.arc((size/2),(size/2),size/15,1.57+sec*0.1046+milisec/1000*0.1046,1.569+sec*0.1046+milisec/1000*0.1046,1);
|
702 |
+
cns.stroke();
|
703 |
+
cns.closePath();
|
704 |
+
|
705 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
706 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
707 |
+
cns.beginPath();
|
708 |
+
cns.lineWidth=2;
|
709 |
+
cns.moveTo((size/2),(size/2));
|
710 |
+
cns.arc((size/2),(size/2),size/3.2,-1.57+min*0.1046+sec/60*0.1046,-1.569+min*0.1046+sec/60*0.1046,0);
|
711 |
+
cns.stroke();
|
712 |
+
cns.closePath();
|
713 |
+
cns.fillText(min,Math.cos(-1.57+min*0.1046+sec/60*0.1046)*size/3+(size/2),Math.sin(-1.57+min*0.1046+sec/60*0.1046)*size/3+(size/2))
|
714 |
+
|
715 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
716 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
717 |
+
cns.beginPath();
|
718 |
+
cns.lineWidth=3;
|
719 |
+
cns.moveTo((size/2),(size/2));
|
720 |
+
cns.arc((size/2),(size/2),size/4,-1.57+hour*0.523+min/60*0.523,-1.569+hour*0.523+min/60*0.523,0);
|
721 |
+
cns.stroke();
|
722 |
+
cns.closePath();
|
723 |
+
if(hour==0){var hour2=12;}else{var hour2=hour;}
|
724 |
+
cns.fillText(hour2,Math.cos(-1.57+hour*0.523+min/60*0.523)*size/3.5+(size/2),Math.sin(-1.57+hour*0.523+min/60*0.523)*size/3.5+(size/2))
|
725 |
+
|
726 |
+
cns.beginPath();
|
727 |
+
cns.lineWidth=2;
|
728 |
+
cns.arc((size/2),(size/2),size/80,0,6.28,0);
|
729 |
+
cns.fill();
|
730 |
+
cns.closePath();
|
731 |
+
|
732 |
+
clockd.timer=setTimeout(function(){clock_num(size, cns, clockd)},50);
|
733 |
+
}
|
734 |
+
|
735 |
+
function clock_random(size, cns, clockd)
|
736 |
+
{
|
737 |
+
var now=new Date();
|
738 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
739 |
+
now.setTime(now.getTime()+time_off*1000);
|
740 |
+
var milisec=now.getMilliseconds();
|
741 |
+
var sec=now.getSeconds();
|
742 |
+
var min=now.getMinutes();
|
743 |
+
var hour=now.getHours();
|
744 |
+
|
745 |
+
if(!clockd.hasOwnProperty("track")){clockd["track"]=20;}
|
746 |
+
clockd["track"]=parseInt(clockd["track"])+1;
|
747 |
+
|
748 |
+
if(parseInt(clockd["track"])>=20)
|
749 |
+
{
|
750 |
+
cns.clearRect(0,0,size,size);
|
751 |
+
|
752 |
+
cns.beginPath();
|
753 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
754 |
+
cns.rect(0,0,size,size);
|
755 |
+
cns.fill();
|
756 |
+
cns.closePath();
|
757 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
758 |
+
|
759 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
760 |
+
{
|
761 |
+
date_add((size/2),size/5*3+size/10, size, cns, clockd);
|
762 |
+
}
|
763 |
+
|
764 |
+
var hourx=Math.floor(Math.random()*size/1.5)+Math.floor((size/2)/10);
|
765 |
+
var houry=Math.floor(Math.random()*size/1.5)+Math.floor((size/2)/10);
|
766 |
+
|
767 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
768 |
+
cns.strokeStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
769 |
+
//if(hour==0){hour=12;}else{hour=hour;}
|
770 |
+
if(hour<10){hour="0"+hour;}
|
771 |
+
if(min<10){min="0"+min;}
|
772 |
+
if(sec<10){sec="0"+sec;}
|
773 |
+
|
774 |
+
cns.textBaseline="middle";
|
775 |
+
cns.textAlign="left";
|
776 |
+
cns.font=(size/15)+"pt Arial";
|
777 |
+
cns.fillText(hour+":"+min+":"+sec,hourx,houry);
|
778 |
+
|
779 |
+
clockd["track"]=0;
|
780 |
+
}
|
781 |
+
|
782 |
+
clockd.timer=setTimeout(function(){clock_random(size, cns, clockd)},50);
|
783 |
+
}
|
784 |
+
|
785 |
+
function clock_digitalran(size, cns, clockd)
|
786 |
+
{
|
787 |
+
var now=new Date();
|
788 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
789 |
+
now.setTime(now.getTime()+time_off*1000);
|
790 |
+
var sec=now.getSeconds();
|
791 |
+
var min=now.getMinutes();
|
792 |
+
var hour=now.getHours();
|
793 |
+
var hexarr=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
|
794 |
+
var a=Math.floor(Math.random()*16);
|
795 |
+
var b=Math.floor(Math.random()*16);
|
796 |
+
var c=Math.floor(Math.random()*16);
|
797 |
+
var d=Math.floor(Math.random()*16);
|
798 |
+
var e=Math.floor(Math.random()*16);
|
799 |
+
var f=Math.floor(Math.random()*16);
|
800 |
+
|
801 |
+
if(clockd.hasOwnProperty("track"))
|
802 |
+
{
|
803 |
+
clockd["track"]+=1;
|
804 |
+
}
|
805 |
+
else
|
806 |
+
{
|
807 |
+
clockd["track"]=20;
|
808 |
+
}
|
809 |
+
|
810 |
+
if(parseInt(clockd["track"])==20)
|
811 |
+
{
|
812 |
+
cns.clearRect(0,0,size,size);
|
813 |
+
|
814 |
+
cns.beginPath();
|
815 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
816 |
+
cns.rect(0,0,size,size);
|
817 |
+
cns.fill();
|
818 |
+
cns.closePath();
|
819 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
820 |
+
|
821 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
822 |
+
{
|
823 |
+
date_add((size/2),size/3*2, size, cns, clockd);
|
824 |
+
}
|
825 |
+
|
826 |
+
if(hour==0){var hour2=12;}else{var hour2=hour;}
|
827 |
+
if(hour<10){hour="0"+hour;}
|
828 |
+
if(min<10){min="0"+min;}
|
829 |
+
if(sec<10){sec="0"+sec;}
|
830 |
+
cns.strokeStyle="#333333";
|
831 |
+
cns.fillStyle="#"+hexarr[a]+hexarr[b]+hexarr[c]+hexarr[d]+hexarr[e]+hexarr[f];
|
832 |
+
cns.textBaseline="middle";
|
833 |
+
cns.textAlign="center";
|
834 |
+
cns.font=size/7+"px Arial";
|
835 |
+
cns.fillText(hour2+":"+min+":"+sec,(size/2),size/2.5);
|
836 |
+
|
837 |
+
clockd["track"]=0;
|
838 |
+
}
|
839 |
+
|
840 |
+
clockd.timer=setTimeout(function(){clock_digitalran(size, cns, clockd)},50);
|
841 |
+
}
|
842 |
+
|
843 |
+
function clock_bars(size, cns, clockd)
|
844 |
+
{
|
845 |
+
cns.clearRect(0,0,size,size);
|
846 |
+
|
847 |
+
cns.beginPath();
|
848 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
849 |
+
cns.rect(0,0,size,size);
|
850 |
+
cns.fill();
|
851 |
+
cns.closePath();
|
852 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
853 |
+
|
854 |
+
var now=new Date();
|
855 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
856 |
+
now.setTime(now.getTime()+time_off*1000);
|
857 |
+
var mili=now.getMilliseconds();
|
858 |
+
var sec=now.getSeconds();
|
859 |
+
var min=now.getMinutes();
|
860 |
+
var hour=now.getHours()%12;
|
861 |
+
|
862 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
863 |
+
{
|
864 |
+
cns.strokeStyle=(clockd.hasOwnProperty("indicate_color"))?clockd["indicate_color"]:"#333333";
|
865 |
+
|
866 |
+
for(var a=0;a<13;a++)
|
867 |
+
{
|
868 |
+
if(a%3==0){cns.lineWidth=2;}else{cns.lineWidth=1;}
|
869 |
+
cns.beginPath();
|
870 |
+
cns.moveTo(size/7+size/7.1,size/8+a*size/1.3/12);
|
871 |
+
cns.lineTo(size/2.38,size/8+a*size/1.3/12);
|
872 |
+
cns.stroke();
|
873 |
+
cns.closePath();
|
874 |
+
|
875 |
+
cns.beginPath();
|
876 |
+
cns.moveTo(size/2.35+size/7.1,size/8+a*size/1.3/12);
|
877 |
+
cns.lineTo(size/1.45,size/8+a*size/1.3/12);
|
878 |
+
cns.stroke();
|
879 |
+
cns.closePath();
|
880 |
+
}
|
881 |
+
|
882 |
+
cns.beginPath();
|
883 |
+
cns.moveTo(size/7+size/7.1*1.5,size/8);
|
884 |
+
cns.lineTo(size/7+size/7.1*1.5,size/8+size/1.3);
|
885 |
+
cns.stroke();
|
886 |
+
cns.closePath();
|
887 |
+
|
888 |
+
cns.beginPath();
|
889 |
+
cns.moveTo(size/2.38+size/7.1*1.5,size/8);
|
890 |
+
cns.lineTo(size/2.38+size/7.1*1.5,size/8+size/1.3);
|
891 |
+
cns.stroke();
|
892 |
+
cns.closePath();
|
893 |
+
}
|
894 |
+
|
895 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
896 |
+
{
|
897 |
+
ycd_time_add((size/2),size/20, size, cns, clockd);
|
898 |
+
}
|
899 |
+
|
900 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
901 |
+
{
|
902 |
+
date_add((size/2),size/14*13, size, cns, clockd);
|
903 |
+
}
|
904 |
+
|
905 |
+
cns.strokeStyle=(clockd.hasOwnProperty("indicate_color"))?clockd["indicate_color"]:"#333333";
|
906 |
+
cns.lineCap="round";
|
907 |
+
cns.fillStyle=(clockd.hasOwnProperty("indicate_color"))?clockd["indicate_color"]:"#333333";
|
908 |
+
|
909 |
+
cns.beginPath();
|
910 |
+
cns.rect(size/7.4,size/8,size/6.8,size/1.3);
|
911 |
+
cns.rect(size/2.38,size/8,size/6.8,size/1.3);
|
912 |
+
cns.rect(size/1.45,size/8,size/6.8,size/1.3);
|
913 |
+
cns.stroke();
|
914 |
+
cns.closePath();
|
915 |
+
|
916 |
+
cns.beginPath();
|
917 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
918 |
+
cns.rect(size/7.4,size/8+size/1.3-(size/1.3)*(hour*60+min)/720,size/6.8,(size/1.3)*(hour*60+min)/720);
|
919 |
+
cns.fill()
|
920 |
+
cns.closePath();
|
921 |
+
|
922 |
+
cns.beginPath()
|
923 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
924 |
+
cns.rect(size/2.38,size/8+size/1.3-(size/1.3)*(min*60+sec)/3600,size/6.8,(size/1.3)*(min*60+sec)/3600);
|
925 |
+
cns.fill();
|
926 |
+
cns.closePath();
|
927 |
+
|
928 |
+
cns.beginPath();
|
929 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
930 |
+
cns.rect(size/1.45,size/8+size/1.3-(size/1.3)*(sec*1000+mili)/60000,size/6.8,(size/1.3)*(sec*1000+mili)/60000);
|
931 |
+
cns.fill();
|
932 |
+
cns.closePath();
|
933 |
+
|
934 |
+
clockd.timer=setTimeout(function(){clock_bars(size, cns, clockd)},50);
|
935 |
+
}
|
936 |
+
|
937 |
+
function clock_planets(size, cns, clockd)
|
938 |
+
{
|
939 |
+
cns.clearRect(0,0,size,size);
|
940 |
+
|
941 |
+
cns.beginPath();
|
942 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
943 |
+
cns.rect(0,0,size,size);
|
944 |
+
cns.fill();
|
945 |
+
cns.closePath();
|
946 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
947 |
+
|
948 |
+
if((clockd.hasOwnProperty("indicate") && clockd.indicate==true) || !clockd.hasOwnProperty("indicate"))
|
949 |
+
{
|
950 |
+
indicator(size, cns, clockd);
|
951 |
+
}
|
952 |
+
|
953 |
+
if(clockd.hasOwnProperty("time_add") && clockd.time_add)
|
954 |
+
{
|
955 |
+
ycd_time_add((size/2),size/5*3, size, cns, clockd);
|
956 |
+
}
|
957 |
+
|
958 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
959 |
+
{
|
960 |
+
date_add((size/2),size/5*3+size/10, size, cns, clockd);
|
961 |
+
}
|
962 |
+
|
963 |
+
var now=new Date();
|
964 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
965 |
+
now.setTime(now.getTime()+time_off*1000);
|
966 |
+
var milisec=now.getMilliseconds();
|
967 |
+
var sec=now.getSeconds();
|
968 |
+
var min=now.getMinutes();
|
969 |
+
var hour=now.getHours()%12;
|
970 |
+
|
971 |
+
if(clockd.hasOwnProperty("track")){cns.fillStyle=clockd["track"];}else{cns.fillStyle="#DAA520";}
|
972 |
+
cns.beginPath();
|
973 |
+
cns.lineWidth=3;
|
974 |
+
cns.moveTo((size/2),(size/2));
|
975 |
+
cns.arc((size/2),(size/2),size/25,0,6.29,0);
|
976 |
+
cns.lineTo((size/2),(size/2));
|
977 |
+
cns.fill();
|
978 |
+
cns.closePath();
|
979 |
+
|
980 |
+
var r=parseInt(milisec)*0.00628;
|
981 |
+
var calcms=Math.cos(r-1.57)*(size/25);
|
982 |
+
var yms=Math.sin(r-1.57)*(size/25);
|
983 |
+
|
984 |
+
var r=parseInt(sec)*0.1046+parseInt(milisec)/1000*0.1046;
|
985 |
+
var calc=Math.cos(r-1.57)*(size/5);
|
986 |
+
var y=Math.sin(r-1.57)*(size/5);
|
987 |
+
|
988 |
+
var r=parseInt(min)*0.1046+parseInt(sec)/60*0.1046;
|
989 |
+
var calcm=Math.cos(r-1.57)*(size/3.2);
|
990 |
+
var ym=Math.sin(r-1.57)*(size/3.2);
|
991 |
+
|
992 |
+
var r=parseInt(hour)*0.523+parseInt(min)/60*0.523;
|
993 |
+
var calcu=Math.cos(r-1.57)*(size/2.5);
|
994 |
+
var yu=Math.sin(r-1.57)*(size/2.5);
|
995 |
+
|
996 |
+
if(clockd.hasOwnProperty("indicate_color")){cns.strokeStyle=clockd["indicate_color"];}else{cns.strokeStyle="#333";}
|
997 |
+
|
998 |
+
cns.closePath();
|
999 |
+
cns.beginPath();
|
1000 |
+
cns.lineWidth=1;
|
1001 |
+
cns.arc((size/2),(size/2),(size/5),0,6.28,0);
|
1002 |
+
cns.stroke();
|
1003 |
+
cns.closePath();
|
1004 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
1005 |
+
cns.beginPath();
|
1006 |
+
cns.lineWidth=3;
|
1007 |
+
cns.arc(calc+(size/2),y+(size/2),size/42,0,6.28,0);
|
1008 |
+
cns.fill();
|
1009 |
+
|
1010 |
+
cns.closePath();
|
1011 |
+
cns.beginPath();
|
1012 |
+
cns.lineWidth=1;
|
1013 |
+
cns.arc((size/2)+calc,(size/2)+y,size/24,0,6.28,0);
|
1014 |
+
cns.stroke();
|
1015 |
+
cns.closePath();
|
1016 |
+
cns.beginPath();
|
1017 |
+
cns.lineWidth=3;
|
1018 |
+
cns.arc((size/2)+calc+calcms,(size/2)+y+yms,size/110,0,6.28,0);
|
1019 |
+
cns.fill();
|
1020 |
+
|
1021 |
+
cns.beginPath();
|
1022 |
+
cns.lineWidth=1;
|
1023 |
+
cns.arc((size/2),(size/2),size/3.2,0,6.28,0);
|
1024 |
+
cns.stroke();
|
1025 |
+
cns.closePath();
|
1026 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
1027 |
+
cns.beginPath();
|
1028 |
+
cns.lineWidth=3;
|
1029 |
+
cns.arc(calcm+(size/2),ym+(size/2),size/24,0,6.28,0);
|
1030 |
+
cns.fill();
|
1031 |
+
cns.closePath();
|
1032 |
+
|
1033 |
+
cns.beginPath();
|
1034 |
+
cns.lineWidth=1;
|
1035 |
+
cns.arc((size/2),(size/2),size/2.5,0,6.28,0);
|
1036 |
+
cns.stroke();
|
1037 |
+
cns.closePath();
|
1038 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
1039 |
+
cns.beginPath();
|
1040 |
+
cns.lineWidth=3;
|
1041 |
+
cns.arc(calcu+(size/2),yu+(size/2),size/22,0,6.28,0);
|
1042 |
+
cns.fill();
|
1043 |
+
cns.closePath();
|
1044 |
+
|
1045 |
+
clockd.timer=setTimeout(function(){clock_planets(size, cns, clockd)},50);
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
function clock_roulette(size, cns, clockd)
|
1049 |
+
{
|
1050 |
+
var now=new Date();
|
1051 |
+
var time_off=(clockd.hasOwnProperty("timeoffset"))?clockd["timeoffset"]:0;
|
1052 |
+
now.setTime(now.getTime()+time_off*1000);
|
1053 |
+
var milisec=now.getMilliseconds();
|
1054 |
+
var sec=now.getSeconds();
|
1055 |
+
var min=now.getMinutes();
|
1056 |
+
var hour=now.getHours()%12;
|
1057 |
+
|
1058 |
+
cns.clearRect(0,0,size,size);
|
1059 |
+
|
1060 |
+
cns.beginPath();
|
1061 |
+
if(clockd.hasOwnProperty("bg_color")){cns.fillStyle=clockd["bg_color"];}else{cns.fillStyle="#ffffff";}
|
1062 |
+
cns.rect(0,0,size,size);
|
1063 |
+
cns.fill();
|
1064 |
+
cns.closePath();
|
1065 |
+
if(clockd.hasOwnProperty("bgLoaded") && clockd.bgLoaded==1){if(clockd.hasOwnProperty("bg_opacity")){cns.globalAlpha=clockd["bg_opacity"];cns.drawImage(clockd.bgImage,0,0,size,size);cns.globalAlpha=1;}}
|
1066 |
+
|
1067 |
+
var a=hour-2;var b=hour-1;var c=hour+1;var d=hour+2;var e=hour+3;
|
1068 |
+
if(a<0){a=24+a;}
|
1069 |
+
if(b<0){b=24+b;}
|
1070 |
+
if(c>23){c=c-24;}
|
1071 |
+
if(d>23){d=d-24;}
|
1072 |
+
if(e>23){e=e-24;}
|
1073 |
+
|
1074 |
+
var f=hour;
|
1075 |
+
if(a<10){a="0"+a;}
|
1076 |
+
if(b<10){b="0"+b;}
|
1077 |
+
if(c<10){c="0"+c;}
|
1078 |
+
if(d<10){d="0"+d;}
|
1079 |
+
if(e<10){e="0"+e;}
|
1080 |
+
if(f<10){f="0"+f;}
|
1081 |
+
cns.font=size/10+"pt Arial";
|
1082 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial1_color"))?clockd["dial1_color"]:"#333333";
|
1083 |
+
cns.fillText(a,size/5,size/10-size/5*min/60-size/5*sec/36000);
|
1084 |
+
cns.fillText(b,size/5,size/10+size/5-size/5*min/60-size/5*sec/36000);
|
1085 |
+
cns.globalAlpha=0.3;
|
1086 |
+
cns.fillText(f,size/5,size/10+2*size/5-size/5*min/60-size/5*sec/3600);
|
1087 |
+
cns.globalAlpha=1;
|
1088 |
+
cns.fillText(c,size/5,size/10+3*size/5-size/5*min/60-size/5*sec/3600);
|
1089 |
+
cns.fillText(d,size/5,size/10+4*size/5-size/5*min/60-size/5*sec/3600);
|
1090 |
+
cns.fillText(e,size/5,size/10+5*size/5-size/5*min/60-size/5*sec/3600);
|
1091 |
+
|
1092 |
+
var a=min-2;var b=min-1;var c=min+1;var d=min+2;var e=min+3;
|
1093 |
+
if(a<0){a=60+a;}
|
1094 |
+
if(b<0){b=60+b;}
|
1095 |
+
if(c>59){c=c-60;}
|
1096 |
+
if(d>59){d=d-60;}
|
1097 |
+
if(e>59){e=e-60;}
|
1098 |
+
|
1099 |
+
var f=min;
|
1100 |
+
if(a<10){a="0"+a;}
|
1101 |
+
if(b<10){b="0"+b;}
|
1102 |
+
if(c<10){c="0"+c;}
|
1103 |
+
if(d<10){d="0"+d;}
|
1104 |
+
if(e<10){e="0"+e;}
|
1105 |
+
if(f<10){f="0"+f;}
|
1106 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial2_color"))?clockd["dial2_color"]:"#333333";
|
1107 |
+
cns.fillText(a,size/2,size/10-size/5*sec/60-size/5*milisec/60000);
|
1108 |
+
cns.fillText(b,size/2,size/10+size/5-size/5*sec/60-size/5*milisec/60000);
|
1109 |
+
cns.globalAlpha=0.3;
|
1110 |
+
cns.fillText(f,size/2,size/10+2*size/5-size/5*sec/60-size/5*milisec/60000);
|
1111 |
+
cns.globalAlpha=1;
|
1112 |
+
cns.fillText(c,size/2,size/10+3*size/5-size/5*sec/60-size/5*milisec/60000);
|
1113 |
+
cns.fillText(d,size/2,size/10+4*size/5-size/5*sec/60-size/5*milisec/60000);
|
1114 |
+
cns.fillText(e,size/2,size/10+5*size/5-size/5*sec/60-size/5*milisec/60000);
|
1115 |
+
|
1116 |
+
var a=sec-2;var b=sec-1;var c=sec+1;var d=sec+2;var e=sec+3;
|
1117 |
+
if(a<0){a=60+a;}
|
1118 |
+
if(b<0){b=60+b;}
|
1119 |
+
if(c>59){c=c-60;}
|
1120 |
+
if(d>59){d=d-60;}
|
1121 |
+
if(e>59){e=e-60;}
|
1122 |
+
|
1123 |
+
var f=sec;
|
1124 |
+
if(a<10){a="0"+a;}
|
1125 |
+
if(b<10){b="0"+b;}
|
1126 |
+
if(c<10){c="0"+c;}
|
1127 |
+
if(d<10){d="0"+d;}
|
1128 |
+
if(e<10){e="0"+e;}
|
1129 |
+
if(f<10){f="0"+f;}
|
1130 |
+
cns.fillStyle=(clockd.hasOwnProperty("dial3_color"))?clockd["dial3_color"]:"#333333";
|
1131 |
+
cns.fillText(a,size/5*4,size/10-size/5*milisec/1000);
|
1132 |
+
cns.fillText(b,size/5*4,size/10+size/5-size/5*milisec/1000);
|
1133 |
+
cns.globalAlpha=0.3;
|
1134 |
+
cns.fillText(f,size/5*4,size/10+2*size/5-size/5*milisec/1000);
|
1135 |
+
cns.globalAlpha=1;
|
1136 |
+
cns.fillText(c,size/5*4,size/10+3*size/5-size/5*milisec/1000);
|
1137 |
+
cns.fillText(d,size/5*4,size/10+4*size/5-size/5*milisec/1000);
|
1138 |
+
cns.fillText(e,size/5*4,size/10+5*size/5-size/5*milisec/1000);
|
1139 |
+
|
1140 |
+
if(clockd.hasOwnProperty("date_add") && clockd.date_add)
|
1141 |
+
{
|
1142 |
+
date_add((size/2),size/5*3+size/10, size, cns, clockd);
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
if(clockd.hasOwnProperty("indicate") && clockd.indicate)
|
1146 |
+
{
|
1147 |
+
cns.strokeStyle=(clockd.hasOwnProperty("indicate_color"))?clockd["indicate_color"]:"#333333";
|
1148 |
+
cns.beginPath();
|
1149 |
+
cns.moveTo(0,(size/2));
|
1150 |
+
cns.lineTo(size,(size/2));
|
1151 |
+
cns.stroke()
|
1152 |
+
cns.closePath();
|
1153 |
+
}
|
1154 |
+
|
1155 |
+
clockd.timer=setTimeout(function(){clock_roulette(size, cns, clockd)},50);
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
function clock_binary(size, cns, clockd)
|
1159 |
+
{
|
1160 |
+
|