| | |
| | | |
| | | var map = null; |
| | | var map_sphere = null; |
| | | var fail_element = document.getElementById('fail'); |
| | | |
| | | var ignore_hashchange = false; |
| | | |
| | |
| | | }, |
| | | }; |
| | | |
| | | function fail(msg) { |
| | | setText(fail_element, msg); |
| | | fail_element.style.top = '0.5em'; |
| | | var Alert = { |
| | | element: document.getElementById('fail'), |
| | | action: undefined, |
| | | |
| | | fail: function(message, action) { |
| | | if(this.action) { |
| | | this.element.removeEventListener('click', this.action); |
| | | this.action = undefined; |
| | | } |
| | | |
| | | setText(this.element, message); |
| | | this.element.style.top = '0.5em'; |
| | | |
| | | if(action) { |
| | | this.action = action; |
| | | this.element.addEventListener('click', action); |
| | | } |
| | | }, |
| | | }; |
| | | |
| | | function fail_ajax_generic(data, fnc) { |
| | | // abort() is not a failure |
| | |
| | | } |
| | | |
| | | function fail_ajax(data) { |
| | | fail_ajax_generic(data, fail); |
| | | fail_ajax_generic(data, Alert.fail.bind(Alert)); |
| | | } |
| | | |
| | | function fail_ajax_popup(data) { |
| | | fail_ajax_generic(data, Panel.fail); |
| | | fail_ajax_generic(data, Panel.fail.bind(Panel)); |
| | | } |
| | | |
| | | function getGeometry(object) { |
| | |
| | | |
| | | function init() { |
| | | if(!window.jQuery) { |
| | | fail(lang.jquery_not_loaded); |
| | | Alert.fail(lang.jquery_not_loaded); |
| | | return; |
| | | } |
| | | |
| | |
| | | element: document.getElementById('title'), |
| | | }), |
| | | new ol.control.Control({ |
| | | element: fail_element, |
| | | element: Alert.element, |
| | | }) |
| | | ]), |
| | | loadTilesWhileAnimating: true, |
| | |
| | | featureClicked(feature); |
| | | }); |
| | | |
| | | fail_element.addEventListener('click', function() { |
| | | fail_element.style.top = '-10em'; |
| | | }); |
| | | |
| | | // Change mouse cursor when over marker |
| | | map.on('pointermove', function(e) { |
| | | var hit = map.hasFeatureAtPixel(e.pixel); |
| | |
| | | if(vehicles_xhr) vehicles_xhr.abort(); |
| | | if(vehicles_timer) clearTimeout(vehicles_timer); |
| | | |
| | | fail(lang.error_refresh); |
| | | Alert.fail(lang.error_refresh); |
| | | }, 1800000); |
| | | } |
| | | |