Improved www.ttss.krakow.pl
Jacek Kowalski
2016-12-08 fd40e5769b73ac62ea59263495ebb1985c78d19a
index.js
@@ -101,7 +101,6 @@
}
function fail(message, more) {
   if(refresh_timer) clearInterval(refresh_timer);
   if(times_timer) clearTimeout(times_timer);
   
   setText(alert_text, message);
@@ -170,13 +169,19 @@
         addCellWithText(tr, data.actual[i].patternText);
         addCellWithText(tr, data.actual[i].direction);
         var status = parseStatus(data.actual[i]);
         addCellWithText(tr, status);
         var status_cell = addCellWithText(tr, status);
         var delay = parseDelay(data.actual[i]);
         addCellWithText(tr, delay);
         var delay_cell = addCellWithText(tr, delay);
         
         if(status == parseStatusBoarding) tr.className = 'success';
         else if(parseInt(delay) > 9) tr.className = 'danger';
         else if(parseInt(delay) > 3) tr.className = 'warning';
         if(status == parseStatusBoarding) {
            tr.className = 'success';
            status_cell.className = 'status-boarding';
         } else if(parseInt(delay) > 9) {
            tr.className = 'danger';
            delay_cell.className = 'status-delayed';
         } else if(parseInt(delay) > 3) {
            tr.className = 'warning';
         }
         times_table.appendChild(tr);
      }
      
@@ -308,6 +313,7 @@
      e.preventDefault();
      if(!stop_name_autocomplete.value) return;
      stop_id = stop_name_autocomplete.value;
      window.location.hash = '#!' + stop_id;
      loadTimes(stop_id, true);
   });
   
@@ -318,6 +324,11 @@
   alert_close.addEventListener('click', function(e) {
      alert.style.display = 'none';
   });
   if(window.location.hash.match(/^#![0-9]+$/)) {
      stop_id = parseInt(window.location.hash.slice(2));
      loadTimes(stop_id);
   }
}
init();