-
Notifications
You must be signed in to change notification settings - Fork 1
/
req.html
238 lines (210 loc) · 7.91 KB
/
req.html
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE html>
<html>
<head>
<title>
User Profile
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<link rel="stylesheet" href="css/req_style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Dosis|Raleway" rel="stylesheet">
</head>
<body>
<div id="container">
<div id="header">
<center><h1>Smart Home Manager </h1></center>
</div>
<div id="body">
<div id="content">
<div id="nameimage">Name:<p id="name">Bhuvaneshwaran</p>
<div id="image">
Image:<br>
<img>
</div>
</div><br>
<div id="req">
<div id="item">
Fan:<label class="switch">
<input type="checkbox">
<span class="slider"></span>
</label>
</div>
<div id="item">Light:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
<div id="item">Modem:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
<div id="item">Tv:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
<div id="item">Music System:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
</div>
</div>
<div id="content">
<div id="nameimage">Name:<p id="name">Deepak</p>
<div id="image">
Image:<br>
<img>
</div>
</div><br>
<div id="req">
<div id="item">
Fan:<label class="switch">
<input type="checkbox">
<span class="slider"></span>
</label>
</div>
<div id="item">Light:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
<div id="item">Modem:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
<div id="item">Tv:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
<div id="item">Music System:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
</div>
</div>
<div id="add">
<button class="w3-button w3-xlarge w3-circle w3-blue" id="mod" data-toggle="modal" data-target="#myModal" onclick="startcamera()">+</button>
</div>
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" onclick="close()">×</button>
<h4 class="modal-title">Add A Person</h4>
</div>
<div class="modal-body">
Name:<input type="text" placeholder="Enter Your Name"/><br>
<div>
Image:<br>
<video id="video">video</video><br>
<button id="startbutton">Take photo</button><br>
<div ><canvas id="canvas" style="display:none"></canvas></div><br>
</div>
<div id="req">
<div id="item">
Fan:<label class="switch">
<input type="checkbox">
<span class="slider"></span>
</label>
</div>
<div id="item">Light:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
<div id="item">Modem:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
<div id="item">Tv:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
<div id="item">Music System:<label class="switch">
<input type="checkbox" checked>
<span class="slider"></span>
</label>
</div>
</div>
</div>
<div class="modal-footer">
<p>©Smart Home Manager</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<script id="jsbin-javascript">
function startcamera() {
var streaming = false,
video = document.querySelector('#video'),
canvas = document.querySelector('#canvas'),
startbutton = document.querySelector('#startbutton'),
width = 320,
height = 0;
navigator.getMedia = ( navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
navigator.getMedia(
{
video: true,
audio: false
},
function(stream) {
if (navigator.mozGetUserMedia) {
video.mozSrcObject = stream;
} else {
var vendorURL = window.URL || window.webkitURL;
video.src = vendorURL.createObjectURL(stream);
}
video.play();
},
function(err) {
console.log("An error occured! " + err);
}
);
video.addEventListener('canplay', function(ev){
if (!streaming) {
height = video.videoHeight / (video.videoWidth/width);
video.setAttribute('width', width);
video.setAttribute('height', height);
canvas.setAttribute('width', width);
canvas.setAttribute('height', height);
streaming = true;
}
}, false);
function takepicture() {
canvas.width = width;
canvas.height = height;
canvas.getContext('2d').drawImage(video, 0, 0, width, height);
var data = canvas.toDataURL('image/png');
video.style.display="none";
canvas.style.display="inline";
}
startbutton.addEventListener('click', function(ev){
console.log("removed");
takepicture();
ev.preventDefault();
}, false);
}
function close(){
video= document.querySelector('#video');
canvas= document.querySelector('#canvas');
video.style.display="";
console.log("released")
canvas.style.display="none";
}
</script>