-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
398 lines (355 loc) · 16.3 KB
/
index.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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!DOCTYPE html>
<html id="outer-tag" class="scrollContainer" lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-112221222-3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-112221222-3');
</script>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-3504797040744216",
enable_page_level_ads: true
});
</script>
<meta charset="utf-8" />
<link rel="apple-touch-icon" sizes="76x76" href="./assets/img/apple-icon.png">
<link rel="icon" type="image/png" href="./assets/img/favicon.png">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>
HbA1c Converter
</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport' />
<!-- Fonts and icons -->
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet" />
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
<!-- CSS Files -->
<link href="./assets/css/bootstrap.min.css" rel="stylesheet" />
<link href="./assets/css/now-ui-kit.css?v=1.2.0" rel="stylesheet" />
<link href="./assets/css/switch-custom.css" rel="stylesheet" />
</head>
<body class="index-page sidebar-collapse">
<!-- Navbar -->
<nav class="navbar navbar-expand-lg fixed-top navbar-transparent " color-on-scroll="400">
<div class="container">
<div class="navbar-translate">
<button class="navbar-toggler navbar-toggler" type="button" data-toggle="collapse" data-target="#navigation" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-bar top-bar"></span>
<span class="navbar-toggler-bar middle-bar"></span>
<span class="navbar-toggler-bar bottom-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse justify-content-end" id="navigation" data-nav-image="./assets/img/blurred-image-1.jpg">
<ul class="navbar-nav">
<li class="nav-item">
<a id="forwardKnowledgeLang" class="nav-link">
<i class="now-ui-icons education_hat" style="display: inline-block;"></i>
<div id="edu_EN" style="display: inline-block;">
<p>Knowledge</p>
</div>
<div id="edu_IT" style="display: none">
<p>Sapere</p>
</div>
</a>
</li>
<li class="nav-item">
<a id="forwardInfoLang" class="nav-link">
<i class="now-ui-icons files_paper"></i>
<p>Info</p>
</a>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" id="navbarDropdownMenuLink1" data-toggle="dropdown">
<i class="now-ui-icons location_world"></i>
<p id="languageSelector" lang="en">EN</p>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink1">
<a lang="en" class="dropdown-item" href="#" onclick="setLanguage('en')">EN</a>
<a lang="it" class="dropdown-item" href="#" onclick="setLanguage('it')">ITA</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
<!-- End Navbar -->
<div class="wrapper">
<div class="page-header clear-filter" filter-color="blue">
<div class="page-header-image" data-parallax="true" style="background-image:url('./assets/img/bg11.jpg');">
</div>
<div class="container">
<div class="content-center brand">
<img class="n-logo" src="./assets/img/logo.png" style="opacity:0.7;max-width: 50%" alt="">
<div class="en">
<h2 class="h2-seo">HbA1c Converter</h2>
<h4>Easily convert from IFCC mmol/mol units to DCCT percentage and vice-versa</h4>
</div>
<div class="it">
<h2 class="h2-seo">HbA1c Convertitore</h2>
<h4>Converti facilmente dalle unità IFFC mmol/mol alle percentuali DCCT e vice-versa</h4>
</div>
<button id="scrollPage" style="background-color:transparent; border-color:transparent; cursor: pointer; outline: none;"><img style="opacity:0.4;" src="./assets/img/expand.png" /></button>
</div>
</div>
</div>
<br>
<div class="section section-basic" id="basic-elements">
<div class="container">
<div class="card" style="word-wrap: unset;">
<div class="card-body">
<!-- Tab panes -->
<div id="first-block-card" class="tab-content text-center en">
<h5>Converter</h5>
<span class="tab-pane active" id="home" role="tabpanel" style="display: inline-flex;">
<p>From mmol/mol to percentage  </p>
<label class="switch-custom" style="margin-top: 4px">
<input id="conversionType" type="checkbox" checked onclick="switchChange(this)">
<span class="slider-custom round"></span>
</label>
</span>
<form id="calculateHemo">
<div class="form-row" style="display: inline-flex;">
<div class="col">
<input id="input" type="text" class="form-control" placeholder="IFCC mmol/mol" onclick="reset()">
</div>
<i class="fa fa-angle-double-right" style="line-height: 2" aria-hidden="true"></i>
<div class="col">
<input id="output" type="text" class="form-control" placeholder="DCCT percentage" disabled="true" maxlength="3">
</div>
</div>
</form>
<button class="btn btn-simple btn-round" type="button" onclick="convert()">Convert</button>
<button class="btn btn-simple btn-round" type="button" onclick="reset()">Reset</button>
</div>
<div id="first-block-card" class="tab-content text-center it">
<h5>Convertitore</h5>
<span class="tab-pane active" id="home" role="tabpanel" style="display: inline-flex;">
<p>Da mmol/mol al valore in percentuale  </p>
<label class="switch-custom">
<input id="conversionType" type="checkbox" checked onclick="switchChange(this)">
<span class="slider-custom round"></span>
</label>
</span>
<form id="calculateHemo">
<div class="form-row" style="display: inline-flex;">
<div class="col">
<input id="input" type="text" class="form-control" placeholder="IFCC mmol/mol" onclick="reset()">
</div>
<i class="fa fa-angle-double-right" style="line-height: 2" aria-hidden="true"></i>
<div class="col">
<input id="output" type="text" class="form-control" placeholder="DCCT percentuali" disabled="true">
</div>
</div>
</form>
<button class="btn btn-simple btn-round" type="button" onclick="convert()">Converti</button>
<button class="btn btn-simple btn-round" type="button" onclick="reset()">Resetta</button>
</div>
<br>
<div id="sliderContainer" class="container" style="width: 70%;" padding="30px">
<div id="sliderDouble" class="slider slider-info" style="background: linear-gradient(to right, #66ff66 0%, #ff0000 130%);"></div>
<br>
<div id="unitClearDCCT" style="text-align: center;">
<br>
<div class="en">
<p>DCCT Percentage</p>
</div>
<div class="it">
<p>Percentuali DCCT</p>
</div>
</div>
<div id="unitClearIFCC" style="text-align: center;">
<br>
<div class="en">
<p>IFCC mmol/mol</p>
</div>
<div class="it">
<p>IFCC mmol/mol</p>
</div>
</div>
</div>
<div class="modal fade" id="errorModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
<div class="en">Input error</div>
<div class="it">Errore di inserimento</div>
</h5>
</div>
<div class="modal-body">
<div class="en">Error, enter just numbers.</div>
<div class="it">Errore, inserisci solo numeri.</div>
</div>
<div class="modal-footer" style="align-self: flex-end;">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
<div class="en">Close</div>
<div class="it">Chiudi</div>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Modal -->
<footer class="footer" data-background-color="black">
<div class="container">
<div class="copyright" id="copyright">
©
<script>
document.getElementById('copyright').appendChild(document.createTextNode(new Date().getFullYear()))
</script>, Made by
<a href="https://www.hichame.com" target="_blank">Hichame Yessou</a>
</div>
</div>
</footer>
</div>
<!-- Core JS Files -->
<script src="./assets/js/core/jquery.min.js" type="text/javascript"></script>
<script src="./assets/js/core/popper.min.js" type="text/javascript"></script>
<script src="./assets/js/core/bootstrap.min.js" type="text/javascript"></script>
<!-- Plugin for Switches, full documentation here: http://www.jque.re/plugins/version3/bootstrap.switch/ -->
<script src="./assets/js/plugins/bootstrap-switch.js"></script>
<!-- Plugin for the Sliders, full documentation here: http://refreshless.com/nouislider/ -->
<script src="./assets/js/plugins/nouislider.min.js" type="text/javascript"></script>
<!-- Control Center for Now Ui Kit: parallax effects, scripts for the example pages etc -->
<script src="./assets/js/now-ui-kit.js?v=1.2.0" type="text/javascript"></script>
<!-- Number formatting -->
<script src="./assets/js/wNumb.js" type="text/javascript"></script>
<script type="text/javascript">
$('.bootstrap-switch').each(function(){
$this = $(this);
data_on_label = $this.data('on-label') || '';
data_off_label = $this.data('off-label') || '';
$this.bootstrapSwitch({
onText: data_on_label,
offText: data_off_label
});
});
</script>
<script>
$(document).ready(function() {
var urlLang = window.location.hash.substring(1);
if(urlLang)
setLanguage(urlLang);
//TODO: fix scroll when changing language
$("#scrollPage").click(function () {
console.info("TRYING TO SCROLL");
$('html').animate({
scrollTop: $("#first-block-card").offset().top -100
}, 1500);
});
resetHints();
propagateTranslation();
});
function propagateTranslation(){
var currentLanguageSelector = document.getElementById('languageSelector').innerHTML;
document.getElementById('forwardKnowledgeLang').setAttribute('href', 'knowledge.html#'+currentLanguageSelector);
document.getElementById('forwardInfoLang').setAttribute('href', 'info.html#'+currentLanguageSelector);
}
function initSliders(lowerTarget, higherTarget, value){
//Initiate sliders
var slider = document.getElementById('sliderDouble');
noUiSlider.create(slider, {
start: value,
tooltips: [wNumb({decimals: 1})],
range: {
min: lowerTarget*0.7,
max: lowerTarget*2
},
pips: {
mode: 'values',
values: [lowerTarget, higherTarget],
density: 4
}
});
//Changing the pips height
$('.noUi-marker-horizontal.noUi-marker-large').css('height','10px');
//Disable Slider Drag
var origins = slider.getElementsByClassName('noUi-origin');
origins[0].setAttribute('disabled', true);
//Check if mobile and size for better readability of the slider
if (/Mobi|Android/i.test(navigator.userAgent)){
console.info("WE'RE MOBILE");
$('#sliderContainer').width('90%');
}
}
function switchChange(cb) {
var inputForm = document.getElementById('input').placeholder;
var outputForm = document.getElementById('output').placeholder;
$('#input').attr('placeholder',outputForm);
$('#output').attr('placeholder',inputForm);
reset();
}
function setLanguage(language) {
var currentLang = language;
$('#outer-tag').attr("lang", currentLang);
//TODO: Improve
//Dirty hack for fixing displaying style in menu
if (currentLang == "it") {
document.getElementById("edu_EN").style.display="none";
document.getElementById("edu_IT").style.display="inline-block";
}else{
document.getElementById("edu_EN").style.display="inline-block";
document.getElementById("edu_IT").style.display="none";
}
var selector = document.getElementById('languageSelector');
selector.innerHTML = currentLang;
propagateTranslation();
}
function convert() {
//Remove sliders in case of old ones
resetSlider();
var type = document.getElementById("conversionType");
if(! /^\d+$/.test(document.getElementById('input').value))
$('#errorModal').modal()
else{
$("#sliderContainer").css("padding","30px");
if(type.checked == true){
var val = +((0.09148 * document.getElementById('input').value) + 2.152).toFixed(2);
document.getElementById('output').value = val +" "+document.getElementById('output').placeholder;
document.getElementById('input').value = document.getElementById('input').value +" "+ document.getElementById('input').placeholder;
initSliders(6,9, val);
$("#unitClearIFCC").css("display","none");
$("#unitClearDCCT").css("display","block");
}else{
var val = +((10.93 * document.getElementById('input').value) - 23.50).toFixed(2);
document.getElementById('output').value = val +" "+ document.getElementById('output').placeholder;
document.getElementById('input').value = document.getElementById('input').value +" "+ document.getElementById('input').placeholder;
initSliders(42,75, val);
$("#unitClearDCCT").css("display","none");
$("#unitClearIFCC").css("display","block");
}
}
}
function reset(){
$("#calculateHemo").trigger('reset');
resetSlider();
resetHints();
}
function resetSlider(){
var slider = document.getElementById('sliderDouble');
try{
slider.noUiSlider.destroy();
}catch(e){
console.info("Exception: "+e);
}
$("#sliderContainer").css("padding","0px");
}
function resetHints(){
try{
$("#unitClearDCCT").css("display","none");
$("#unitClearIFCC").css("display","none");
}catch(e){
console.info("Exception: "+e);
}
}
</script>
</body>
</html>