-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
165 lines (145 loc) · 6.03 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
<!DOCTYPE html>
<html>
<head>
<title>BeRoads - Dead webcams</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
<style>
.opacity50 {
filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
</style>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Modal -->
<div class="modal fade" id="aboutModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">About</h4>
</div>
<div class="modal-body">
Some BeRoads users were complaining about the webcams feeds not being available, so we launched a new
feature into our API server that analyze the webcams images to detect broken webcams.
<br /><br />
Broken webcams includes :
<ul>
<li>unavailable images</li>
<li>blacked out images</li>
<li>images that have not been updated in the last hour</li>
</ul>
Everything is explained in this blog post <a href="http://blog.beroads.com/" alt="blog post">Title</a>
<br /><br />
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="container">
<div class="header">
<ul class="nav nav-pills pull-right">
<li class="active"><a href="#">Home</a></li>
<li><a href="#" data-toggle="modal" data-target="#aboutModal">About</a></li>
</ul>
<h3 class="text-muted">BeRoads</h3>
</div>
<br />
<div class="jumbotron">
<h1>Dead webcams, dead webcams everywhere ...</h1>
<p class="lead">It's been a long time since we started playing with highway webcams
feeds at BeRoads and as we were building the API we clearly saw that a lot of webcams
are broken, unavailable or not up to date. So we build this website in the hope
that the administrators will do something.</p>
</div>
<div id="general"></div>
<hr />
<div class="footer">
<h4 class="text-center">Built with the BeRoads API and data ♥</h4>
</div>
</div> <!-- /container -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://code.jquery.com/jquery.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="./bootstrap/js/bootstrap.min.js"></script>
<script>
$.getJSON("http://data.beroads.com/IWay/Camera.json",
function(data){
var total = data.Camera.item.length;
var enabled = 0;
var zones = {};
$.each(data.Camera.item, function(i,item){
if(item.enabled == "1")
enabled++;
if(zones[item.zone] == undefined)
zones[item.zone] = {
'total' : 0,
'enabled' : 0,
'webcams' : []
};
zones[item.zone]['total']++;
zones[item.zone]['webcams'].push(item);
if(item.enabled==true)
zones[item.zone]['enabled']++;
});
var percentage = Math.round((enabled/total)*100);
var html = "";
html += '<div class="progress" style="height:30px"> \
<div class="progress-bar progress-bar-success" style="width: '+percentage+'%"> \
<span class="show" style="font-size:16pt;margin-top:5px;">'+percentage+'% Available</span> \
</div> \
<div class="progress-bar progress-bar-warning" style="width: '+(100-percentage)+'%"> \
<span class="show" style="font-size:16pt;margin-top:5px;">'+(100-percentage)+'% Unavailable</span> \
</div> \
</div> \
</div>';
html += '<div class="panel-group" id="accordion">';
var j = 0;
$.each(zones, function(i, zone){
html += '<div class="panel panel-default"> \
<div class="panel-heading"> \
<h4 class="panel-title"> \
<a data-toggle="collapse" data-parent="#accordion" href="#collapse_'+j+'">';
var percentage = Math.round((zone['enabled']/zone['total'])*100);
html += '<div class="col-lg-12"><h1>'+i+' <small>';
if(percentage==100)
html+= '<span class="pull-right label label-success">'+percentage+' %</span>';
else if(percentage >= 50) {
html+= '<span class="pull-right label label-warning">'+percentage+' %</span>';
}
else {
html+= '<span class="pull-right label label-danger">'+percentage+' %</span>';
}
html += "</small></h1><br />";
html += '</a></h4></div><div id="collapse_'+j+'" class="panel-collapse collapse">';
html += '<div class="panel-body">';
html += '<div class="row">';
$.each(zone['webcams'], function(j, webcam) {
html += '<div class="col-sm-2 col-md-2"><div class="thumbnail">';
html += "<img src='"+webcam.img+"' ";
if(!webcam.enabled){
html += " class='opacity50' ";
}
html += " />";
html += '<div class="caption">';
html += '<p>'+webcam.city+'</p>';
html += '</div></div></div>';
});
html += '</div></div></div></div>';
j++;
});
html += '</div>';
$('#general').html(html);
});
</script>
</body>
</html>