Improved www.ttss.krakow.pl
Jacek Kowalski
2017-04-17 4b0eda2a43298f2a3ac6c21b8d5eabe2a1590acc
Add separate column for vehicle number (hidden by default)
5 files modified
35 ■■■■ changed files
index.css 6 ●●●●● patch | view | raw | blame | history
index.html 7 ●●●● patch | view | raw | blame | history
index.js 20 ●●●● patch | view | raw | blame | history
lang_en.js 1 ●●●● patch | view | raw | blame | history
lang_pl.js 1 ●●●● patch | view | raw | blame | history
index.css
@@ -39,9 +39,15 @@
    margin: -5px 0;
    font-size: 21px;
}
#vehicle-data {
    float: right;
}
.bigger {
    font-size: 21px;
}
.vehicleData {
    display: none;
}
/* Change navbar behavior for low media width */
.navbar-nav {
index.html
@@ -7,6 +7,7 @@
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        <link rel="stylesheet" type="text/css" href="index.css">
        <style type="text/css" id="vehicle-data-style"></style>
    </head>
    <body>
        <nav class="navbar navbar-default">
@@ -63,7 +64,11 @@
                        <thead>
                            <tr>
                                <th data-translate="header_line">Linia</th>
                                <th data-translate="header_direction">Kierunek</th>
                                <th>
                                    <span data-translate="header_direction">Kierunek</span>
                                    <a id="vehicle-data" data-translate="header_vehicle">Pojazd</span>
                                </th>
                                <th data-translate="header_vehicle" class="vehicleData">Pojazd</th>
                                <th data-translate="header_time">Czas</th>
                                <th data-translate="header_delay">Opóźn.</th>
                            </tr>
index.js
@@ -37,6 +37,8 @@
var alert_close = document.getElementById('alert-close');
var nav = document.getElementsByTagName('nav')[0];
var vehicle_data = document.getElementById('vehicle-data');
var vehicle_data_style = document.getElementById('vehicle-data-style');
function parseStatus(status) {
    switch(status.status) {
@@ -179,7 +181,9 @@
            var tr = document.createElement('tr');
            addCellWithText(tr, data.old[i].patternText);
            var dir_cell = addCellWithText(tr, data.old[i].direction);
            dir_cell.appendChild(displayVehicle(parseVehicle(data.old[i].vehicleId)));
            var vehicle = parseVehicle(data.actual[i].vehicleId);
            dir_cell.appendChild(displayVehicle(vehicle));
            addCellWithText(tr, vehicle.num).className = 'vehicleData';
            var status = parseStatus(data.old[i]);
            addCellWithText(tr, status);
            addCellWithText(tr, '');
@@ -193,7 +197,9 @@
            var tr = document.createElement('tr');
            addCellWithText(tr, data.actual[i].patternText);
            var dir_cell = addCellWithText(tr, data.actual[i].direction);
            dir_cell.appendChild(displayVehicle(parseVehicle(data.actual[i].vehicleId)));
            var vehicle = parseVehicle(data.actual[i].vehicleId);
            dir_cell.appendChild(displayVehicle(vehicle));
            addCellWithText(tr, vehicle.num).className = 'vehicleData';
            var status = parseStatus(data.actual[i]);
            var status_cell = addCellWithText(tr, status);
            var delay = parseDelay(data.actual[i]);
@@ -425,15 +431,21 @@
        loadTimes(stop_name_autocomplete.value);
    });
    
    refresh_button.addEventListener('click', function(e) {
    refresh_button.addEventListener('click', function() {
        loadTimes();
        loadRoute();
    });
    
    alert_close.addEventListener('click', function(e) {
    alert_close.addEventListener('click', function() {
        alert.style.display = 'none';
    });
    
    vehicle_data.addEventListener('click', function(e) {
        e.preventDefault();
        vehicle_data.style.display = 'none';
        setText(vehicle_data_style, '.vehicleData { display: table-cell; }')
    });
    hash();
    
    window.addEventListener('hashchange', hash);
lang_en.js
@@ -17,6 +17,7 @@
    
    header_line: 'Line',
    header_direction: 'Direction',
    header_vehicle: 'Vehicle',
    header_time: 'Time',
    header_delay: 'Delay',
    header_lines: 'Lines',
lang_pl.js
@@ -17,6 +17,7 @@
    
    header_line: 'Linia',
    header_direction: 'Kierunek',
    header_vehicle: 'Pojazd',
    header_time: 'Odjazd',
    header_delay: 'Opóźn.',
    header_lines: 'Linie',