Reload page on script changes
4 files modified
1 files added
| | |
| | | 'Zajezdnia Podgórze' : 'P', |
| | | }; |
| | | |
| | | var script_version; |
| | | var script_version_xhr; |
| | | |
| | | // Check for website updates |
| | | function checkVersion() { |
| | | if(script_version_xhr) script_version_xhr.abort(); |
| | | |
| | | script_version_xhr = $.get( |
| | | 'version.php' |
| | | ).done(function(data) { |
| | | if(!script_version) { |
| | | script_version = data; |
| | | return; |
| | | } |
| | | |
| | | if(script_version != data) { |
| | | fail(lang.error_new_version); |
| | | location.reload(true); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function checkVersionInit() { |
| | | checkVersion(); |
| | | setInterval(checkVersion, 3600000); |
| | | } |
| | | |
| | | // Webservice-related functions |
| | | function parseVehicle(vehicleId) { |
| | | if(!vehicleId) return; |
| | |
| | | setText(alert_text, message); |
| | | alert.style.display = 'block'; |
| | | |
| | | console.log(message + ' More details follow.'); |
| | | console.log(message + (more ? ' More details follow.' : '')); |
| | | if(more) console.log(more); |
| | | } |
| | | |
| | |
| | | hash(); |
| | | |
| | | window.addEventListener('hashchange', hash); |
| | | |
| | | checkVersionInit(); |
| | | } |
| | | |
| | | init(); |
| | |
| | | error_request_failed: 'Internet request failed.', |
| | | error_request_failed_status: 'Internet request failed with error: $status.', |
| | | error_request_failed_connectivity: 'Request failed - please check your network connectivity.', |
| | | error_new_version: 'Website has been updated, reloading...', |
| | | }; |
| | |
| | | error_request_failed: 'Wykonanie żądania internetowego nie udało się.', |
| | | error_request_failed_status: 'Wykonanie żądania internetowego nie udało się. Błąd: $status.', |
| | | error_request_failed_connectivity: 'Wykonanie żądania internetowego nie udało się - sprawdź połączenie z siecią.', |
| | | error_new_version: 'Strona została zaktualizowana, przeładowuję...', |
| | | }; |
New file |
| | |
| | | <?php |
| | | echo max(array_map('filemtime', glob('*.{html,js,css}', GLOB_NOSORT|GLOB_BRACE))); |