You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 23, 2021. It is now read-only.
timedifference=response["sent-time"]-response.message["timestamp"];//timedifference gives you a number in seconds (it's server-server relative so should be acurate) of how upto date the data you're getting is
81
-
if((timedifference/60)>minutesbeforefail){
82
-
//Over 1 hour out of date
83
-
$(".datadisplay").hide();
84
-
$("#nodata").html('<strong>Error</strong> We have not received data from the Weather Station for '+Math.round(timedifference/3600)+' hour'+((timedifference/3600)!=1 ? 's' : ''));
85
-
$("#nodata").fadeIn();
86
-
}elseif((timedifference/60)>minutesbeforewarn){
87
-
//5 minutes or more (upto 1 hour) out of date
88
-
$("#outofdatedata").html('<strong>Warning</strong> Data is '+Math.round(timedifference/60)+' minute'+((timedifference/60)!=1 ? 's' : '')+' out of date');
timedifference=response["sent-time"]-response.message["timestamp"];//timedifference gives you a number in seconds (it's server-server relative so should be acurate) of how upto date the data you're getting is
41
+
if((timedifference/60)>minutesbeforefail){
42
+
//Over 1 hour out of date
43
+
$(".datadisplay").hide();
44
+
$("#nodata").html('<strong>Error</strong> We have not received data from the Weather Station for '+Math.round(timedifference/3600)+' hour'+((timedifference/3600)!=1 ? 's' : ''));
45
+
$("#nodata").fadeIn();
46
+
}elseif((timedifference/60)>minutesbeforewarn){
47
+
//5 minutes or more (upto 1 hour) out of date
48
+
$("#outofdatedata").html('<strong>Warning</strong> Data is '+Math.round(timedifference/60)+' minute'+((timedifference/60)!=1 ? 's' : '')+' out of date');
//If can't connect to internet/server show a modal (unless it's already showing)
118
-
if(nointernetdialogshown==false){
119
-
nointernetdialog=bootbox.dialog({
120
-
message: '<p class="text-center">Error - could not download data updates - please check your internet connection or try again later<br/><br/><i>If this error persists please contact James Bithell using the details at <a href="https://www.jbithell.com" target="_blank">https://www.jbithell.com</a></i><br/><br/></p>',
121
-
closeButton: false
122
-
});
123
-
nointernetdialogshown=true;
124
-
}
125
68
69
+
},error: function(jqXHR,exception){
70
+
//If can't connect to internet/server show a modal explaining that
71
+
nointernetdialog=bootbox.dialog({
72
+
message: '<p class="text-center">Error - could not download data updates - please check your internet connection or try again later<br/><br/><i>If this error persists please contact James Bithell using the details at <a href="https://www.jbithell.com" target="_blank">https://www.jbithell.com</a></i><br/><br/></p>',
0 commit comments