aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew>2006-09-28 20:37:46 +0000
committermatthew <matthew>2006-09-28 20:37:46 +0000
commita3112933e5f676b5d164f2a7827c4666c84c1eb2 (patch)
tree5d0bd77cb17fdabe8417151edb152a5daa9240cf
parentfde5c9ce15ff9d46796cd198de4816768875f11e (diff)
Don't error on non-map pages.
-rw-r--r--web/js2.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/web/js2.js b/web/js2.js
index 8436bf422..405f10d9a 100644
--- a/web/js2.js
+++ b/web/js2.js
@@ -13,7 +13,8 @@
window.onload = onLoad;
// I love the global
-var tile_x, tile_y;
+var tile_x = 0;
+var tile_y = 0;
var tilewidth = 254;
var tileheight = 254;
@@ -33,16 +34,15 @@ function onLoad() {
}
var form = document.getElementById('mapForm');
- form.onsubmit = function() {
- this.x.value = x + 2;
- this.y.value = y + 2;
- return true;
+ if (form) {
+ form.onsubmit = function() {
+ this.x.value = x + 2;
+ this.y.value = y + 2;
+ return true;
+ }
+ var url = '/tilma/tileserver/10k-full-london/' + x + '-' + (x+5) + ',' + y + '-' + (y+5) + '/JSON';
+ var req = mySociety.asyncRequest(url, urls_loaded);
}
-
- tile_x = 0;
- tile_y = 0;
- var url = '/tilma/tileserver/10k-full-london/' + x + '-' + (x+5) + ',' + y + '-' + (y+5) + '/JSON';
- var req = mySociety.asyncRequest(url, urls_loaded);
}
function image_rotate(img, x, y) {