-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
148 lines (123 loc) · 4.62 KB
/
index.js
File metadata and controls
148 lines (123 loc) · 4.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
var imgLogo=document.getElementById('fitbit-image-logo');
var img=document.getElementById('fitbit-image');
var imgScreen=document.getElementById('fitbit-screenImg');
var fitScreen=document.getElementById('fitbit-screen');
var skinPink=document.getElementById('skin-pink');
var skinBrown=document.getElementById('skin-brown');
var skinBlack=document.getElementById('skin-black');
var skinOrange=document.getElementById('skin-orange');
var timeBtn=document.getElementById('time-btn');
var heartBtn=document.getElementById('heart-btn');
var glocBtn=document.getElementById('gloc-btn');
var andoBtn=document.getElementById('ando-btn');
var buyBtn=document.getElementById('buy-btn');
// console.log(skinPink);
// console.log(skinBrown);
// console.log(skinBlack);
// console.log(skinOrange);
// console.log(img);
skinPink.addEventListener('click', function(){
//alert('pink');
img.src="png/fit_band_pink.png"
imgLogo.src="png/fit_band_pink.png"
});
skinBrown.addEventListener('click', function(){
//alert('Brown');
img.src="png/fit_band_brown.png"
imgLogo.src="png/fit_band_brown.png"
});
skinBlack.addEventListener('click', function(){
//alert('black');
img.src="png/fit_band_black.png"
imgLogo.src="png/fit_band_black.png"
});
skinOrange.addEventListener('click', function(){
//alert('Orange');
img.src="png/fit_band_orange.png"
imgLogo.src="png/fit_band_orange.png"
});
timeBtn.addEventListener('click', function(){
//alert(timeBtn);
imgScreen.src="";
document.getElementById('heartRate').style.display = 'none';
document.getElementById('timetext').style.display = 'block';
document.getElementById('fitbit-screenImg').style.animation= '';
time();
});
heartBtn.addEventListener('click', function(){
//var displayStyle=window.getComputedStyle(fitScreen).backgroundImage;
imgScreen.src="heart.svg";
document.getElementById('timetext').style.display = 'none';
document.getElementById('heartRate').style.display = 'block';
document.getElementById('fitbit-screenImg').style.animation= 'heart 0.5s linear infinite';
//document.getElementById('fitbit-screen').innerHTML = time_str;
});
glocBtn.addEventListener('click', function(){
//alert("gloc");
// var displayStyle=imgScreen.src
// console.log(displayStyle);
// document.getElementById('fitbit-screen').innerHTML = ;
document.getElementById('timetext').style.display = 'none';
document.getElementById('heartRate').style.display = 'none';
document.getElementById('fitbit-screenImg').style.animation= '';
imgScreen.src="gloc.svg";
});
andoBtn.addEventListener('click', function(){
//alert("andoBtn");
document.getElementById('timetext').style.display = 'none';
document.getElementById('heartRate').style.display = 'none';
document.getElementById('fitbit-screenImg').style.animation= '';
imgScreen.src="ando.svg";
});
buyBtn.addEventListener('click', function(){
confirm('Want to Buy');
});
function time(){
var now = new Date,
hours = now.getHours(),
ampm = hours<12 ? ' AM' : ' PM',
minutes = now.getMinutes(),
seconds = now.getSeconds(),
time_str = (hours>12) ? [(hours-12), //otherwise: what's the use of AM/PM?
(minutes < 10 ? "0" + minutes : minutes),
(seconds < 10 ? "0" + seconds : seconds)]
.join(":") + ampm
//else part of if condition;
: [(hours), //otherwise: what's the use of AM/PM?
(minutes < 10 ? "0" + minutes : minutes),
(seconds < 10 ? "0" + seconds : seconds)]
.join(":") + ampm ;
document.getElementById('timetext').innerHTML = time_str;
setTimeout(time,1000);
return time_str;
}
// function time() {
// var d = new Date();
// var h = d.getHours()
// var m = d.getMinutes();
// var s = d.getSeconds();
// var total= h+":"+m+":"+s ;
// document.getElementById("heart").innerHTML = total;
// setTimeout(time,1000);
// return total
// }
// time()
// function time(){
// var now = new Date,
// hours = now.getHours(),
// ampm = hours<12 ? ' AM' : ' PM',
// minutes = now.getMinutes(),
// seconds = now.getSeconds(),
// time_str = (hours>12) ? [(hours-12), //otherwise: what's the use of AM/PM?
// (minutes < 10 ? "0" + minutes : minutes),
// (seconds < 10 ? "0" + seconds : seconds)]
// .join(":") + ampm
// //else part of if condition;
// : [(hours), //otherwise: what's the use of AM/PM?
// (minutes < 10 ? "0" + minutes : minutes),
// (seconds < 10 ? "0" + seconds : seconds)]
// .join(":") + ampm ;
// document.getElementById('heart').innerHTML = time_str;
// setTimeout(time,1000);
// return time_str;
// }