aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-fms.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-06-17 13:57:34 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-07-11 15:03:52 +0100
commit962b881830f9edb4f0b0b5aac3ece87c80af1f0a (patch)
tree222109707006df0f59358308bfb6cb57526a5243 /web/js/map-fms.js
parent615e5b7b1cc1a829f4ee982659220a7a01a13639 (diff)
Tidy up JavaScript functions.
Split big functions into smaller more descriptive ones.
Diffstat (limited to 'web/js/map-fms.js')
-rw-r--r--web/js/map-fms.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/web/js/map-fms.js b/web/js/map-fms.js
index c5bf70191..65c02a503 100644
--- a/web/js/map-fms.js
+++ b/web/js/map-fms.js
@@ -1,13 +1,14 @@
-var fms_tile_base = [ [ '', 'a-', 'b-', 'c-' ], '//{S}tilma.mysociety.org/sv' ];
+fixmystreet.maps.tile_base = [ [ '', 'a-', 'b-', 'c-' ], '//{S}tilma.mysociety.org/sv' ];
-function set_map_config(perm) {
- _set_map_config();
-
- if (fixmystreet.map_type) {
- fms_tile_base = fixmystreet.map_type;
- }
- fixmystreet.map_type = OpenLayers.Layer.BingUK;
-}
+fixmystreet.maps.config = (function(original) {
+ return function(){
+ if (fixmystreet.map_type) {
+ this.tile_base = fixmystreet.map_type;
+ }
+ original();
+ fixmystreet.map_type = OpenLayers.Layer.BingUK;
+ };
+})(fixmystreet.maps.config);
OpenLayers.Layer.BingUK = OpenLayers.Class(OpenLayers.Layer.Bing, {
uk_bounds: [
@@ -54,8 +55,8 @@ OpenLayers.Layer.BingUK = OpenLayers.Class(OpenLayers.Layer.Bing, {
var in_uk = this.in_uk(bounds.getCenterLonLat());
if (z >= 16 && in_uk) {
urls = [];
- for (var i=0; i< fms_tile_base[0].length; i++) {
- urls.push( fms_tile_base[1].replace('{S}', fms_tile_base[0][i]) + "/${z}/${x}/${y}.png" );
+ for (var i=0; i< fixmystreet.maps.tile_base[0].length; i++) {
+ urls.push( fixmystreet.maps.tile_base[1].replace('{S}', fixmystreet.maps.tile_base[0][i]) + "/${z}/${x}/${y}.png" );
}
} else {
var type = '';