- Timestamp:
- 03/29/2020 01:38:01 PM (6 years ago)
- File:
-
- 1 edited
-
branches/realtime_VDS/cptms/js/vdsLayer.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/realtime_VDS/cptms/js/vdsLayer.js
r588 r606 162 162 //initialize live indicator icon 163 163 function initLiveIcon(success) { 164 //create new img tags for live and not-live indicators165 var live = document.createElement('img');166 var notLive = document.createElement('img');167 live.src ="images/live.svg";168 live.width = 50 ;169 live.height= 40 ;170 notLive.src ="images/offline.jpg";171 164 // if fetch is a success, display live img 172 if (success) { 173 //console.log(live); 174 if (map.controls[google.maps.ControlPosition.TOP_RIGHT].getLength() > 0) 165 var indicator = document.createElement('img'); 166 if (success) 167 { 168 //create new img tags for live and not-live indicators 169 indicator.src ="images/live.svg"; 170 indicator.width = 50 ; 171 indicator.height= 40 ; 172 } 173 else 174 { 175 indicator.src ="images/offline.jpg"; 176 } 177 if (map.controls[google.maps.ControlPosition.TOP_RIGHT].getLength() > 0) 175 178 map.controls[google.maps.ControlPosition.TOP_RIGHT].pop(); 176 map.controls[google.maps.ControlPosition.TOP_RIGHT].push(live); 177 } 178 // if error, display sad smiley image 179 else { 180 //console.log(notLive); 181 if (map.controls[google.maps.ControlPosition.TOP_RIGHT].getLength() > 0) 182 map.controls[google.maps.ControlPosition.TOP_RIGHT].pop(); 183 map.controls[google.maps.ControlPosition.TOP_RIGHT].push(notLive); 184 } 179 map.controls[google.maps.ControlPosition.TOP_RIGHT].push(indicator); 185 180 } 186 181 … … 202 197 var now = new Date(); 203 198 // calculate time difference 199 var timeDiff = new Date(now - lastFetch); 204 200 var msec = now - lastFetch; 205 201 var days = Math.floor(msec / 1000 / 60 / (60 * 24)); … … 216 212 else 217 213 initLiveIcon(0) 218 //console.log(days + " Days "+ hh + " Hours " + mm + " Minutes " + ss + " Seconds ");214 //console.log(days + " Days "+ hh + " Hours " + mm + " Minutes " + ss + " Seconds "); 219 215 } 220 216 }
Note: See TracChangeset
for help on using the changeset viewer.
