diff options
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/fixmystreet.js | 78 | ||||
-rw-r--r-- | web/js/map-OpenLayers.js | 6 | ||||
-rw-r--r-- | web/js/map-bing-ol.js | 2 | ||||
-rw-r--r-- | web/js/map-tilma.js | 4 |
4 files changed, 82 insertions, 8 deletions
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js new file mode 100644 index 000000000..7f6014c6c --- /dev/null +++ b/web/js/fixmystreet.js @@ -0,0 +1,78 @@ +/* + * fixmystreet.js + * FixMyStreet JavaScript + */ + + +YAHOO.util.Event.onContentReady('pc', function() { + if (this.id && this.value == this.defaultValue) { + this.focus(); + } +}); + +YAHOO.util.Event.onContentReady('mapForm', function() { + this.onsubmit = function() { + if (this.submit_problem) { + this.onsubmit = function() { return false; }; + } + + /* XXX Should be in Tilma code only */ + if (this.x) { + this.x.value = fixmystreet.x + 3; + this.y.value = fixmystreet.y + 3; + } + + return true; + } +}); + +YAHOO.util.Event.onContentReady('another_qn', function() { + if (!document.getElementById('been_fixed_no').checked && !document.getElementById('been_fixed_unknown').checked) { + YAHOO.util.Dom.setStyle(this, 'display', 'none'); + } + YAHOO.util.Event.addListener('been_fixed_no', 'click', function(e) { + YAHOO.util.Dom.setStyle('another_qn', 'display', 'block'); + }); + YAHOO.util.Event.addListener('been_fixed_unknown', 'click', function(e) { + YAHOO.util.Dom.setStyle('another_qn', 'display', 'block'); + }); + YAHOO.util.Event.addListener('been_fixed_yes', 'click', function(e) { + YAHOO.util.Dom.setStyle('another_qn', 'display', 'none'); + }); +}); + +var timer; +function email_alert_close() { + YAHOO.util.Dom.setStyle('email_alert_box', 'display', 'none'); +} +YAHOO.util.Event.onContentReady('email_alert', function() { + YAHOO.util.Event.addListener(this, 'click', function(e) { + if (!document.getElementById('email_alert_box')) + return true; + YAHOO.util.Event.preventDefault(e); + if (YAHOO.util.Dom.getStyle('email_alert_box', 'display') == 'block') { + email_alert_close(); + } else { + var pos = YAHOO.util.Dom.getXY(this); + pos[0] -= 20; pos[1] += 20; + YAHOO.util.Dom.setStyle('email_alert_box', 'display', 'block'); + YAHOO.util.Dom.setXY('email_alert_box', pos); + document.getElementById('alert_rznvy').focus(); + } + }); + YAHOO.util.Event.addListener(this, 'mouseout', function(e) { + timer = window.setTimeout(email_alert_close, 2000); + }); + YAHOO.util.Event.addListener(this, 'mouseover', function(e) { + window.clearTimeout(timer); + }); +}); +YAHOO.util.Event.onContentReady('email_alert_box', function() { + YAHOO.util.Event.addListener(this, 'mouseout', function(e) { + timer = window.setTimeout(email_alert_close, 2000); + }); + YAHOO.util.Event.addListener(this, 'mouseover', function(e) { + window.clearTimeout(timer); + }); +}); + diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index ed3ca4653..22492e400 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -1,6 +1,6 @@ YAHOO.util.Event.onContentReady('map', function() { - fixmystreet.ZOOM_OFFSET = 14; + fixmystreet.ZOOM_OFFSET = 13; var perm = new OpenLayers.Control.Permalink(); set_map_config(perm); @@ -13,7 +13,7 @@ YAHOO.util.Event.onContentReady('map', function() { fixmystreet.layer_options = OpenLayers.Util.extend({ zoomOffset: fixmystreet.ZOOM_OFFSET, transitionEffect: 'resize', - numZoomLevels: 4 + numZoomLevels: 5 }, fixmystreet.layer_options); var layer = new fixmystreet.map_type("", fixmystreet.layer_options); fixmystreet.map.addLayer(layer); @@ -24,7 +24,7 @@ YAHOO.util.Event.onContentReady('map', function() { new OpenLayers.Projection("EPSG:4326"), fixmystreet.map.getProjectionObject() ); - fixmystreet.map.setCenter(centre, fixmystreet.zoom || 2); + fixmystreet.map.setCenter(centre, fixmystreet.zoom || 3); } if (document.getElementById('mapForm')) { diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index 254d407f4..00c3a487f 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -51,7 +51,7 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { OpenLayers.Util.indexOf(this.serverResolutions, res) : this.map.getZoom() + this.zoomOffset; - if (z == 16) { + if (z >= 16) { var url = [ "http://a.os.openstreetmap.org/sv/${z}/${x}/${y}.png", "http://b.os.openstreetmap.org/sv/${z}/${x}/${y}.png", diff --git a/web/js/map-tilma.js b/web/js/map-tilma.js index 1b8cc6450..3c5f546e5 100644 --- a/web/js/map-tilma.js +++ b/web/js/map-tilma.js @@ -146,10 +146,6 @@ function load_pins(x, y) { 'y=' + (y+3), 'all_pins=' + all_pins ]; - if (document.getElementById('extra_param')) { - ajax_params.push(document.getElementById('extra_param').name + '=' + document.getElementById('extra_param').value); - } - var url = [ root_path , '/ajax?', ajax_params.join(';')].join(''); YAHOO.util.Connect.asyncRequest('GET', url, { success: pins_loaded |