-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.html
255 lines (201 loc) · 6.2 KB
/
config.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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<script src="scripts/scriptsv01_21.js?a=123" type="text/javascript"></script>
<script src="https://apis.google.com/js/platform.js"></script>
<style>
body {
margin-left: 5%;
margin-right: 5%;
background-color: #f0f4c3;
}
h2,
h3 {
text-align: center;
;
}
.back-button {
padding: 8px;
height: 20px;
font-family: sans-serif;
margin-right: 5px;
background-color: #eee;
border: none;
border-style: groove;
text-decoration: none;
font-size: 15px;
cursor: pointer;
border-radius: 10px;
}
input {
width: 30px;
height: 18px;
font-size: 16px;
text-align: center;
font-family: sans-serif;
border-radius: 10px;
border: 2px solid #00;
padding: 6px;
}
input.text:focus {
background-color: #bbdefb;
color: #0d47a1;
border: 2px solid #0d47a1;
}
input.text2:focus {
background-color: #b2dfdb;
color: #004d40;
border: 2px solid #004d40;
}
input.text3:focus {
background-color: #ffccbc;
color: #bf360c;
border: 2px solid #bf360c;
}
.riego {
background-color: #e6ee9c;
color: #303f9f;
padding: 4px;
border-radius: 15px;
}
.temperatura {
background-color: #e6ee9c;
color: #b71c1c;
padding: 4px;
border-radius: 15px;
}
.humedad {
background-color: #e6ee9c;
color: #1b5e20;
padding: 4px;
border-radius: 15px;
}
.update-button {
padding: 10px;
border-style: ridge;
border-radius: 10px;
background-color: #c5e1a5;
margin-left: auto;
margin-right: auto;
font-size: 20px;
color: #00695c;
display: block;
align-self: center;
width: 60%;
height: 20%;
}
</style>
</head>
<body>
<script>
var auth2;
var googleUser; // The current user
gapi.load('auth2', function(){
auth2 = gapi.auth2.init({
client_id: '371644074979-3r8h8k0ma4rgjujv6b4sgh9tdqcdttgh.apps.googleusercontent.com'
});
auth2.attachClickHandler('g-signin2', {}, onSuccess, onFailure);
auth2.isSignedIn.listen(signinChanged);
auth2.currentUser.listen(userChanged); // This is what you use to listen for user changes
});
var signinChanged = function (val) {
console.log('Signin state changed to ', val);
let googleUser = auth2.currentUser.get();
let profile = googleUser.getBasicProfile();
showCurrentUserInfo(profile)
};
var onSuccess = function(user) {
console.log('Signed in as ' + user.getBasicProfile().getName());
// Redirect somewhere
};
var onFailure = function(error) {
console.log(error);
};
function signOut() {
auth2.signOut().then(function () {
console.log('User signed out.');
document.location.href = '/login.html';
});
}
var userChanged = function (user) {
if(user.getId()){
// Do something here
}
};
function showCurrentUserInfo(profile){
// Display the user details
var profileHTML = '<h3>Hola ' + profile.getGivenName() + '! <a href="javascript:void(0);" onclick="signOut();">Sign out</a></h3>';
profileHTML += '<img src="' + profile.getImageUrl() + '"/><p><b>Google ID: </b>' + profile.getId() + '</p><p><b>Nombre: </b>' + profile.getName() + '</p><p><b>Email: </b>' + profile.getEmail();
document.getElementById("userContent").innerHTML = profileHTML;
document.getElementById("g-signin2").style.display = "none";
document.getElementById("userContent").style.display = "block";
}
</script>
<div id="g-signin2" class="g-signin2" data-onsuccess="onSignIn" data-onfailure="onFailure" data-theme="dark"></div>
<!-- Show the user profile details -->
<div id="userContent" class="userContent" style="display: none;"></div>
<br><br>
<h2>Invernadero autonomo</h2>
<span class="config-refresh">
<a class="back-button" style="float:left; font-weight: bold; color:#00695c" href="./index.html">Volver</a>
</span>
<br><br><br>
<form id="formconfiguracion">
<section class="riego">
<h3>Configuracion del riego automatico</h3>
<br><br>
<div class="textos">Iniciar riego al:
<input id="humedadsuelominima" class="text" type="number" name="humedadsuelominima" onClick="this.select()" value="00">
% de humedad de la tierra
</div>
<br><br>
<div class="textos">Cortar riego al:
<input id="humedadsuelomaxima" class="text" type="number" name="humedadsuelomaxima" onClick="this.select()" value="00">
% de humedad de la tierra
</div>
<br>
</section>
<br>
<section class="temperatura">
<br>
<h3>Alarmas por temperatura y humedad ambiente</h3>
<br><br>
<div class="textos">Temp. maxima:
<input id="temperaturamaxima" class="text2" type="number" name="temperaturamaxima" onClick="this.select()" value="00">
℃
</div>
<br><br>
<div class="textos">Temp. minima:
<input id="temperaturaminima" class="text2" type="number" name="temperaturaminima" onClick="this.select()" value="00">
℃
</div>
<br>
</section>
<br>
<section class="humedad">
<br>
<div class="textos">Hum. amb. maxima:
<input id="humedadambientemaxima" class="text3" type="number" name="humedadambientemaxima" onClick="this.select()" value="00">
%
</div>
<br><br>
<div class="textos">Hum. amb. minima:
<input id="humedadambienteminima" class="text3" type="number" name="humedadambienteminima" onClick="this.select()" value="00">
%
</div>
</section>
</form>
<br><br>
<div>
<input id="btn-config-update" type="button" class="update-button" value="Actualizar datos" onclick="actualizarConfig(this,'formconfiguracion')">
</div>
<br>
<script type="text/javascript">
//loadParametersOnDom();
</script>
</body>
</html>