-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
149 lines (148 loc) · 5.07 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/ico" href="./assets/images/coronavirus-logo.png">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, user-scalable=no">
<title>Coronavirus Tracker</title>
<link rel="stylesheet" type="text/css" href="./assets/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="./assets/css/shCore.css">
<link rel="stylesheet" type="text/css" href="./assets/css/demo.css">
<script type="text/javascript" language="javascript" src="./assets/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="./assets/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="./assets/js/shCore.js"></script>
<script type="text/javascript" language="javascript" src="./assets/js/demo.js"></script>
<script type="text/javascript" language="javascript" class="init"></script>
</head>
<body class="dt-example">
<div class="coronavirus-container">
<section>
<h1 class="rainbow">Coronavirus Status
<img class="coronaviruslogo" src="./assets/images/coronoavirus.png" width=45 height=45></img>
<span style="color: black;">Version 1.1.0 </span>
<span style="color: black;font-size: 14px;"> © CodezTech</span>
</h1>
<div class="demo-html"></div>
<table id="coronavirustracker" class="display" style="width:100%">
<thead>
<tr>
<th>Country</th>
<th>Cases</th>
<th>Deaths</th>
<th>Total recovered</th>
<th>New deaths</th>
<th>New cases</th>
<th>Serious critical</th>
<th>Active cases</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
</section>
<a href="https://chrome.google.com/webstore/detail/codeztech-launcher/gcciplpdnddimongoimloaabpincoloc?hl=en-US&gclid=Cj0KCQjw-Mr0BRDyARIsAKEFbec3FRF77j10UpAeRGDS9ye4Dh2LHVpQEcO_7vXOM0UsS4u7YuHUjN0aAh7UEALw_wcB" target="_blank"><b>Click here - To Easily Access Codez Tech content</b></a>
</div>
</body>
<script type="text/javascript" language="javascript">
var myTable;
var serious_critical="120";
var active_cases="220";
var worldresult = [];
function bindItemTable() {
myTable = $("#coronavirustracker").DataTable({
"deferRender": true,
"searching": true,
"destroy": true,
"filter": true,
"scrollY": 200,
"scrollCollapse": true,
"scroller": true,
"paging": false,
"lengthChange": false,
"ordering": true,
"order": [[ 1, "desc" ]],
"info": true,
"autoWidth": false,
"sDom": 'lfrtip',
"footerCallback": function( tfoot, data, start, end, display ) {
$.ajax({
url: "https://coronavirus-monitor.p.rapidapi.com/coronavirus/worldstat.php",
headers: {
'x-rapidapi-host':'coronavirus-monitor.p.rapidapi.com',
'x-rapidapi-key':'yourkey',
'Content-Type':'application/json'
},
method: "GET",
dataType: 'json',
crossDomain: true,
success:function(data) {
console.log(data);
$(tfoot).find('th').eq(0).html("Total");
$(tfoot).find('th').eq(1).html(data.total_cases);
$(tfoot).find('th').eq(2).html(data.total_deaths);
$(tfoot).find('th').eq(3).html(data.total_recovered);
$(tfoot).find('th').eq(4).html(data.new_deaths);
$(tfoot).find('th').eq(5).html(data.new_cases);
$(tfoot).find('th').eq(6).html(data.serious_critical);
$(tfoot).find('th').eq(7).html(data.active_cases);
},failure: function () {
$("#coronavirustracker").append("Error when fetching world wide data");
}
});
}
});
}
function getCoronavirusstatus() {
$.ajax({
url: "https://coronavirus-monitor.p.rapidapi.com/coronavirus/cases_by_country.php",
headers: {
'x-rapidapi-host':'coronavirus-monitor.p.rapidapi.com',
'x-rapidapi-key':'yourkey',
'Content-Type':'application/json'
},
method: "GET",
dataType: 'json',
crossDomain: true,
success:function(data) {
var jsonObject = data.countries_stat;
var result = jsonObject.map(function (item) {
var result = [];
result.push(item.country_name);
result.push(item.cases);
result.push(item.deaths);
result.push(item.total_recovered);
result.push(item.new_deaths);
result.push(item.new_cases);
result.push(item.serious_critical);
result.push(item.active_cases);
result.push("");
return result;
});
myTable.clear();
myTable.rows.add(result);
myTable.draw();
},failure: function () {
$("#coronavirustracker").append(" Error when fetching data please contact administrator");
}
});
}
$(function(){
bindItemTable();
getCoronavirusstatus();
setInterval(()=>{
bindItemTable();
getCoronavirusstatus();
},15000)
})
</script>
</html>