aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/Cobrand/BathNES.pm2
-rw-r--r--perllib/FixMyStreet/Map/BathNES.pm20
-rw-r--r--perllib/FixMyStreet/Map/Bristol.pm2
-rw-r--r--perllib/FixMyStreet/Map/Bromley.pm10
-rw-r--r--perllib/FixMyStreet/Map/Hounslow.pm5
-rw-r--r--t/cobrand/national_assets.t1
-rw-r--r--t/map/tests.t7
-rw-r--r--templates/web/bathnes/footer_extra_js.html11
-rw-r--r--templates/web/bristol/footer_extra_js.html12
-rw-r--r--templates/web/bromley/footer_extra_js.html4
-rw-r--r--templates/web/hounslow/footer_extra_js.html1
-rw-r--r--web/cobrands/bathnes/assets.js39
-rw-r--r--web/cobrands/bexley/js.js38
-rw-r--r--web/cobrands/bromley/assets.js9
-rw-r--r--web/cobrands/buckinghamshire/assets.js31
-rw-r--r--web/cobrands/fixmystreet/assets.js74
-rw-r--r--web/cobrands/highways/assets.js9
-rw-r--r--web/cobrands/hounslow/assets.js38
-rw-r--r--web/cobrands/lincolnshire/assets.js15
-rw-r--r--web/js/duplicates.js6
-rw-r--r--web/js/map-OpenLayers.js7
22 files changed, 110 insertions, 232 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 525c350b5..89f215660 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- Improve keyboard accessibility.
- Report form now indicates that details are kept private if report is
made in a private category. #2528
+ - Improve map JavaScript defensiveness.
- Admin improvements:
- Add new roles system, to group permissions and apply to users.
- New features:
diff --git a/perllib/FixMyStreet/Cobrand/BathNES.pm b/perllib/FixMyStreet/Cobrand/BathNES.pm
index 0ccf488c7..05c91c8dd 100644
--- a/perllib/FixMyStreet/Cobrand/BathNES.pm
+++ b/perllib/FixMyStreet/Cobrand/BathNES.pm
@@ -19,7 +19,7 @@ sub council_url { return 'bathnes'; }
sub admin_user_domain { 'bathnes.gov.uk' }
-sub map_type { 'BathNES' }
+sub map_type { 'OSM' }
sub on_map_default_status { 'open' }
diff --git a/perllib/FixMyStreet/Map/BathNES.pm b/perllib/FixMyStreet/Map/BathNES.pm
deleted file mode 100644
index 45261a625..000000000
--- a/perllib/FixMyStreet/Map/BathNES.pm
+++ /dev/null
@@ -1,20 +0,0 @@
-# FixMyStreet:Map::BathNES
-# More JavaScript, for street assets
-
-package FixMyStreet::Map::BathNES;
-use base 'FixMyStreet::Map::OSM';
-
-use strict;
-
-sub map_javascript { [
- '/vendor/OpenLayers/OpenLayers.wfs.js',
- '/vendor/OpenLayers.Projection.OrdnanceSurvey.js',
- '/js/map-OpenLayers.js',
- '/js/map-OpenStreetMap.js',
- '/cobrands/fixmystreet-uk-councils/roadworks.js',
- '/cobrands/fixmystreet/assets.js',
- '/cobrands/bathnes/js.js',
- '/cobrands/bathnes/assets.js',
-] }
-
-1;
diff --git a/perllib/FixMyStreet/Map/Bristol.pm b/perllib/FixMyStreet/Map/Bristol.pm
index 32f5724f5..f6f5406de 100644
--- a/perllib/FixMyStreet/Map/Bristol.pm
+++ b/perllib/FixMyStreet/Map/Bristol.pm
@@ -37,8 +37,6 @@ sub map_javascript { [
'/js/map-OpenLayers.js',
'/js/map-wmts-base.js',
'/js/map-wmts-bristol.js',
- '/cobrands/fixmystreet/assets.js',
- '/cobrands/bristol/assets.js',
] }
1;
diff --git a/perllib/FixMyStreet/Map/Bromley.pm b/perllib/FixMyStreet/Map/Bromley.pm
index cd50cc1d1..595c83f6d 100644
--- a/perllib/FixMyStreet/Map/Bromley.pm
+++ b/perllib/FixMyStreet/Map/Bromley.pm
@@ -9,16 +9,6 @@ use base 'FixMyStreet::Map::FMS';
use strict;
-sub map_javascript { [
- '/vendor/OpenLayers/OpenLayers.wfs.js',
- '/js/map-OpenLayers.js',
- '/js/map-bing-ol.js',
- '/js/map-fms.js',
- '/cobrands/fixmystreet/assets.js',
- '/cobrands/bromley/map.js',
- '/cobrands/bromley/assets.js',
-] }
-
sub map_tile_base {
'-', "https://%sfix.bromley.gov.uk/tilma/%d/%d/%d.png";
}
diff --git a/perllib/FixMyStreet/Map/Hounslow.pm b/perllib/FixMyStreet/Map/Hounslow.pm
index ce0831196..d66188a83 100644
--- a/perllib/FixMyStreet/Map/Hounslow.pm
+++ b/perllib/FixMyStreet/Map/Hounslow.pm
@@ -55,14 +55,9 @@ sub copyright {
sub map_javascript { [
'/vendor/OpenLayers/OpenLayers.wmts.js',
- '/vendor/OpenLayers.Projection.OrdnanceSurvey.js',
'/js/map-OpenLayers.js',
'/js/map-wmts-base.js',
'/js/map-wmts-hounslow.js',
- '/cobrands/fixmystreet-uk-councils/roadworks.js',
- '/cobrands/fixmystreet/assets.js',
- '/cobrands/hounslow/js.js',
- '/cobrands/hounslow/assets.js',
] }
1;
diff --git a/t/cobrand/national_assets.t b/t/cobrand/national_assets.t
index 378425193..32e27079b 100644
--- a/t/cobrand/national_assets.t
+++ b/t/cobrand/national_assets.t
@@ -20,6 +20,7 @@ subtest 'cobrand assets includes not applied on cobrand sites', sub {
ALLOWED_COBRANDS => [ 'bathnes' ],
MAPIT_URL => 'http://mapit.uk/',
MAP_TYPE => 'FMS,OSM,BathNES,Buckinghamshire',
+ STAGING_FLAGS => { skip_checks => 1 },
}, sub {
$mech->get_ok("/report/new?latitude=51.494885&longitude=-2.602237");
$mech->content_lacks('buckinghamshire/assets.js');
diff --git a/t/map/tests.t b/t/map/tests.t
index 7e3b6f6bd..a06759a33 100644
--- a/t/map/tests.t
+++ b/t/map/tests.t
@@ -2,16 +2,15 @@ use FixMyStreet::Map;
use Test::More;
my $requires = {
- 'BathNES' => 'bathnes/assets.js',
'Bing' => 'map-bing-ol.js',
- 'Bristol' => 'bristol/assets.js',
- 'Bromley' => 'bromley/assets.js',
+ 'Bristol' => 'map-wmts-bristol.js',
+ 'Bromley' => 'map-fms.js',
'Buckinghamshire' => 'map-wmts-buckinghamshire.js',
'Lincolnshire' => 'lincolnshire/assets.js',
'FMS' => 'map-fms.js',
'Google' => 'map-google.js',
'GoogleOL' => 'map-google-ol.js',
- 'Hounslow' => 'hounslow/assets.js',
+ 'Hounslow' => 'map-wmts-hounslow.js',
'OSM' => 'OpenStreetMap.js',
'CycleMap' => 'OpenStreetMap.js',
'MapQuest' => 'OpenStreetMap.js',
diff --git a/templates/web/bathnes/footer_extra_js.html b/templates/web/bathnes/footer_extra_js.html
index 8113befc9..c195600fc 100644
--- a/templates/web/bathnes/footer_extra_js.html
+++ b/templates/web/bathnes/footer_extra_js.html
@@ -1,3 +1,14 @@
[% scripts.push(
version('/cobrands/fixmystreet-uk-councils/council_validation_rules.js'),
) %]
+[%~
+IF bodyclass.match('mappage');
+ scripts.push(
+ version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'),
+ version('/cobrands/fixmystreet/assets.js'),
+ version('/cobrands/fixmystreet-uk-councils/roadworks.js'),
+ version('/cobrands/bathnes/js.js'),
+ version('/cobrands/bathnes/assets.js'),
+ );
+END
+%]
diff --git a/templates/web/bristol/footer_extra_js.html b/templates/web/bristol/footer_extra_js.html
index 1742a55e2..deff4e395 100644
--- a/templates/web/bristol/footer_extra_js.html
+++ b/templates/web/bristol/footer_extra_js.html
@@ -1,5 +1,13 @@
[% scripts.push(
- version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js')
version('/cobrands/fixmystreet-uk-councils/js.js'),
- version('/cobrands/highways/assets.js'),
) %]
+[%~
+IF bodyclass.match('mappage');
+ scripts.push(
+ version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'),
+ version('/cobrands/fixmystreet/assets.js'),
+ version('/cobrands/bristol/assets.js'),
+ version('/cobrands/highways/assets.js'),
+ );
+END
+%]
diff --git a/templates/web/bromley/footer_extra_js.html b/templates/web/bromley/footer_extra_js.html
index 27eb438ca..26c8fe9f5 100644
--- a/templates/web/bromley/footer_extra_js.html
+++ b/templates/web/bromley/footer_extra_js.html
@@ -6,5 +6,9 @@
[% IF bodyclass.match('mappage');
scripts.push(
version('/cobrands/bromley/js.js'),
+ version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'),
+ version('/cobrands/fixmystreet/assets.js'),
+ version('/cobrands/bromley/map.js'),
+ version('/cobrands/bromley/assets.js'),
);
END %]
diff --git a/templates/web/hounslow/footer_extra_js.html b/templates/web/hounslow/footer_extra_js.html
index ccec09313..5ca03231b 100644
--- a/templates/web/hounslow/footer_extra_js.html
+++ b/templates/web/hounslow/footer_extra_js.html
@@ -6,6 +6,7 @@ IF bodyclass.match('mappage');
version('/cobrands/fixmystreet/assets.js'),
version('/cobrands/highways/assets.js'),
version('/cobrands/hounslow/js.js'),
+ version('/cobrands/hounslow/assets.js'),
);
END
%]
diff --git a/web/cobrands/bathnes/assets.js b/web/cobrands/bathnes/assets.js
index fd1386480..7a32facc9 100644
--- a/web/cobrands/bathnes/assets.js
+++ b/web/cobrands/bathnes/assets.js
@@ -68,12 +68,7 @@ fixmystreet.assets.add(fixmystreet.maps.banes_defaults, {
],
asset_item: "park",
disable_pin_snapping: true,
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- }),
+ stylemap: fixmystreet.assets.stylemap_invisible,
attributes: {
asset_details: function() {
var a = this.attributes;
@@ -161,35 +156,15 @@ var rule_not_owned = new OpenLayers.Rule({
});
lighting_default_style.addRules([rule_owned, rule_not_owned]);
-// XXX fixmystreet.pin_prefix isn't always available here (e.g. on /report/new),
-// so get it from the DOM directly
-var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');
-
var lighting_stylemap = new OpenLayers.StyleMap({
'default': lighting_default_style,
- 'select': new OpenLayers.Style({
- externalGraphic: pin_prefix + "pin-spot.png",
- fillColor: "#55BB00",
- graphicWidth: 48,
- graphicHeight: 64,
- graphicXOffset: -24,
- graphicYOffset: -56,
- backgroundGraphic: pin_prefix + "pin-shadow.png",
- backgroundWidth: 60,
- backgroundHeight: 30,
- backgroundXOffset: -7,
- backgroundYOffset: -22,
- popupYOffset: -40,
- graphicOpacity: 1.0
- }),
+ 'select': fixmystreet.assets.style_default_select,
'hover': new OpenLayers.Style({
pointRadius: 8,
cursor: 'pointer'
})
-
});
-
fixmystreet.assets.add(fixmystreet.maps.banes_defaults, {
http_options: {
params: {
@@ -213,21 +188,13 @@ fixmystreet.assets.add(fixmystreet.maps.banes_defaults, {
}
});
-
-var highways_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
-});
-
fixmystreet.assets.add(fixmystreet.maps.banes_defaults, {
http_options: {
params: {
TYPENAME: "AdoptedHighways"
}
},
- stylemap: highways_stylemap,
+ stylemap: fixmystreet.assets.stylemap_invisible,
non_interactive: true,
always_visible: true,
usrn: {
diff --git a/web/cobrands/bexley/js.js b/web/cobrands/bexley/js.js
index 27694f772..907185aea 100644
--- a/web/cobrands/bexley/js.js
+++ b/web/cobrands/bexley/js.js
@@ -23,42 +23,17 @@ var defaults = {
strategy_class: OpenLayers.Strategy.FixMyStreet
};
-var streetlight_default = {
- fillColor: "#FFFF00",
- fillOpacity: 0.6,
- strokeColor: "#000000",
- strokeOpacity: 0.8,
- strokeWidth: 2,
- pointRadius: 6
-};
-
-var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');
-
-var streetlight_select = {
- externalGraphic: pin_prefix + "pin-spot.png",
- fillColor: "#55BB00",
- graphicWidth: 48,
- graphicHeight: 64,
- graphicXOffset: -24,
- graphicYOffset: -56,
- backgroundGraphic: pin_prefix + "pin-shadow.png",
- backgroundWidth: 60,
- backgroundHeight: 30,
- backgroundXOffset: -7,
- backgroundYOffset: -22,
- popupYOffset: -40,
- graphicOpacity: 1.0,
-
+var streetlight_select = $.extend({
label: "${Unit_No}",
labelOutlineColor: "white",
labelOutlineWidth: 3,
labelYOffset: 65,
fontSize: '15px',
fontWeight: 'bold'
-};
+}, fixmystreet.assets.style_default_select.defaultStyle);
var streetlight_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style(streetlight_default),
+ 'default': fixmystreet.assets.style_default,
'select': new OpenLayers.Style(streetlight_select)
});
@@ -100,12 +75,7 @@ fixmystreet.assets.add(defaults, {
attribute: 'NSG_REF',
field: 'NSGRef'
},
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- })
+ stylemap: fixmystreet.assets.stylemap_invisible
});
fixmystreet.assets.add(labeled_defaults, {
diff --git a/web/cobrands/bromley/assets.js b/web/cobrands/bromley/assets.js
index d5386d9af..c1f22f529 100644
--- a/web/cobrands/bromley/assets.js
+++ b/web/cobrands/bromley/assets.js
@@ -76,13 +76,6 @@ fixmystreet.assets.add(defaults, {
asset_item: 'tree'
});
-var highways_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
-});
-
var bromley_to_tfl = {
'Enforcement': ['ENF_NUI_SIGN', 'ENF_OBS_HIGH', 'ENF_OHANG_HANG', 'ENF_UNLIC_HIGH'],
'Graffiti and Flyposting': ['GF_NUI_SIGN'],
@@ -106,7 +99,7 @@ fixmystreet.assets.add(defaults, {
TYPENAME: "TFL_Red_Route"
}
},
- stylemap: highways_stylemap,
+ stylemap: fixmystreet.assets.stylemap_invisible,
always_visible: true,
asset_category: tfl_asset_categories,
diff --git a/web/cobrands/buckinghamshire/assets.js b/web/cobrands/buckinghamshire/assets.js
index 7b27a84f2..fe54c32fe 100644
--- a/web/cobrands/buckinghamshire/assets.js
+++ b/web/cobrands/buckinghamshire/assets.js
@@ -42,42 +42,17 @@ fixmystreet.assets.add(defaults, {
asset_item: 'grit bin'
});
-var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');
-
-var streetlight_default = {
- fillColor: "#FFFF00",
- fillOpacity: 0.6,
- strokeColor: "#000000",
- strokeOpacity: 0.8,
- strokeWidth: 2,
- pointRadius: 6
-};
-
-var streetlight_select = {
- externalGraphic: pin_prefix + "pin-spot.png",
- fillColor: "#55BB00",
- graphicWidth: 48,
- graphicHeight: 64,
- graphicXOffset: -24,
- graphicYOffset: -56,
- backgroundGraphic: pin_prefix + "pin-shadow.png",
- backgroundWidth: 60,
- backgroundHeight: 30,
- backgroundXOffset: -7,
- backgroundYOffset: -22,
- popupYOffset: -40,
- graphicOpacity: 1.0,
-
+var streetlight_select = $.extend({
label: "${feature_id}",
labelOutlineColor: "white",
labelOutlineWidth: 3,
labelYOffset: 65,
fontSize: '15px',
fontWeight: 'bold'
-};
+}, fixmystreet.assets.style_default_select.defaultStyle);
var streetlight_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style(streetlight_default),
+ 'default': fixmystreet.assets.style_default,
'select': new OpenLayers.Style(streetlight_select)
});
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index 1d2bc3206..c86f09ed9 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -452,34 +452,9 @@ function layer_loadend() {
}
function get_asset_stylemap() {
- // fixmystreet.pin_prefix isn't always available here (e.g. on /report/new),
- // so get it from the DOM directly
- var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');
-
return new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fillColor: "#FFFF00",
- fillOpacity: 0.6,
- strokeColor: "#000000",
- strokeOpacity: 0.8,
- strokeWidth: 2,
- pointRadius: 6
- }),
- 'select': new OpenLayers.Style({
- externalGraphic: pin_prefix + "pin-spot.png",
- fillColor: "#55BB00",
- graphicWidth: 48,
- graphicHeight: 64,
- graphicXOffset: -24,
- graphicYOffset: -56,
- backgroundGraphic: pin_prefix + "pin-shadow.png",
- backgroundWidth: 60,
- backgroundHeight: 30,
- backgroundXOffset: -7,
- backgroundYOffset: -22,
- popupYOffset: -40,
- graphicOpacity: 1.0
- }),
+ 'default': fixmystreet.assets.style_default,
+ 'select': fixmystreet.assets.style_default_select,
'hover': new OpenLayers.Style({
fillColor: "#55BB00",
fillOpacity: 0.8,
@@ -505,15 +480,56 @@ function get_fault_stylemap() {
});
}
+// fixmystreet.pin_prefix isn't always available here, due
+// to file loading order, so get it from the DOM directly.
+var map_data = document.getElementById('js-map-data');
+var pin_prefix = fixmystreet.pin_prefix || (map_data ? map_data.getAttribute('data-pin_prefix') : '/i/');
+
fixmystreet.assets = {
layers: [],
controls: [],
+ stylemap_invisible: new OpenLayers.StyleMap({
+ 'default': new OpenLayers.Style({
+ fill: false,
+ stroke: false
+ })
+ }),
+
+ style_default: new OpenLayers.Style({
+ fillColor: "#FFFF00",
+ fillOpacity: 0.6,
+ strokeColor: "#000000",
+ strokeOpacity: 0.8,
+ strokeWidth: 2,
+ pointRadius: 6
+ }),
+
+ style_default_select: new OpenLayers.Style({
+ externalGraphic: pin_prefix + "pin-spot.png",
+ fillColor: "#55BB00",
+ graphicWidth: 48,
+ graphicHeight: 64,
+ graphicXOffset: -24,
+ graphicYOffset: -56,
+ backgroundGraphic: pin_prefix + "pin-shadow.png",
+ backgroundWidth: 60,
+ backgroundHeight: 30,
+ backgroundXOffset: -7,
+ backgroundYOffset: -22,
+ popupYOffset: -40,
+ graphicOpacity: 1.0
+ }),
+
selectedFeature: function() {
return selected_feature;
},
add: function(default_options, options) {
+ if (!document.getElementById('map')) {
+ return;
+ }
+
options = $.extend(true, {}, default_options, options);
var asset_fault_layer = null;
@@ -722,6 +738,10 @@ fixmystreet.assets = {
return;
}
+ if (!fixmystreet.map) {
+ return;
+ }
+
// Make sure the assets get hidden if the back button is pressed
fixmystreet.maps.display_around = (function(original) {
function hide_assets() {
diff --git a/web/cobrands/highways/assets.js b/web/cobrands/highways/assets.js
index 8f4734131..f24ad66f5 100644
--- a/web/cobrands/highways/assets.js
+++ b/web/cobrands/highways/assets.js
@@ -24,20 +24,13 @@ var defaults = {
strategy_class: OpenLayers.Strategy.FixMyStreet
};
-var highways_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false,
- })
-});
-
fixmystreet.assets.add(defaults, {
http_options: {
params: {
TYPENAME: "Highways"
}
},
- stylemap: highways_stylemap,
+ stylemap: fixmystreet.assets.stylemap_invisible,
always_visible: true,
non_interactive: true,
diff --git a/web/cobrands/hounslow/assets.js b/web/cobrands/hounslow/assets.js
index e6d3383ff..918123141 100644
--- a/web/cobrands/hounslow/assets.js
+++ b/web/cobrands/hounslow/assets.js
@@ -114,39 +114,14 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
// asset_item: 'gulley'
// }));
-var pin_prefix = fixmystreet.pin_prefix || document.getElementById('js-map-data').getAttribute('data-pin_prefix');
-
-var streetlight_default = {
- fillColor: "#FFFF00",
- fillOpacity: 0.6,
- strokeColor: "#000000",
- strokeOpacity: 0.8,
- strokeWidth: 2,
- pointRadius: 6
-};
-
-var streetlight_select = {
- externalGraphic: pin_prefix + "pin-spot.png",
- fillColor: "#55BB00",
- graphicWidth: 48,
- graphicHeight: 64,
- graphicXOffset: -24,
- graphicYOffset: -56,
- backgroundGraphic: pin_prefix + "pin-shadow.png",
- backgroundWidth: 60,
- backgroundHeight: 30,
- backgroundXOffset: -7,
- backgroundYOffset: -22,
- popupYOffset: -40,
- graphicOpacity: 1.0,
-
+var streetlight_select = $.extend({
label: "${FeatureId}",
labelOutlineColor: "white",
labelOutlineWidth: 3,
labelYOffset: 65,
fontSize: '15px',
fontWeight: 'bold'
-};
+}, fixmystreet.assets.style_default_select.defaultStyle);
// The label for street light markers should be everything after the final
// '/' in the feature's FeatureId attribute.
@@ -162,7 +137,7 @@ select_style.createLiterals = function() {
};
var streetlight_stylemap = new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style(streetlight_default),
+ 'default': fixmystreet.assets.style_default,
'select': select_style
});
@@ -229,12 +204,7 @@ fixmystreet.assets.add($.extend(true, {}, defaults, {
attribute: 'SITE_CODE',
field: 'site_code'
},
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- })
+ stylemap: fixmystreet.assets.stylemap_invisible
}));
diff --git a/web/cobrands/lincolnshire/assets.js b/web/cobrands/lincolnshire/assets.js
index b36b04b64..afe6abf8f 100644
--- a/web/cobrands/lincolnshire/assets.js
+++ b/web/cobrands/lincolnshire/assets.js
@@ -173,12 +173,7 @@ fixmystreet.assets.add(defaults, {
asset_item: 'road',
asset_item_message: null,
disable_pin_snapping: true,
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- })
+ stylemap: fixmystreet.assets.stylemap_invisible
});
fixmystreet.assets.add(defaults, {
@@ -193,13 +188,7 @@ fixmystreet.assets.add(defaults, {
attribute: 'Site_Code',
field: 'site_code'
},
- stylemap: new OpenLayers.StyleMap({
- 'default': new OpenLayers.Style({
- fill: false,
- stroke: false
- })
- })
-
+ stylemap: fixmystreet.assets.stylemap_invisible
});
var llpg_stylemap = new OpenLayers.StyleMap({
diff --git a/web/js/duplicates.js b/web/js/duplicates.js
index 0844cb5f3..3ed7e6079 100644
--- a/web/js/duplicates.js
+++ b/web/js/duplicates.js
@@ -121,6 +121,9 @@
}
function render_duplicate_pins(api_response) {
+ if (!fixmystreet.markers) {
+ return;
+ }
var markers = fixmystreet.maps.markers_list( api_response.pins, true );
fixmystreet.markers.removeFeatures( current_duplicate_markers );
fixmystreet.markers.addFeatures( markers );
@@ -138,6 +141,9 @@
}
function remove_duplicate_pins() {
+ if (!fixmystreet.markers) {
+ return;
+ }
fixmystreet.markers.removeFeatures( current_duplicate_markers );
}
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index ae86269c9..cd2283491 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -304,6 +304,9 @@ $.extend(fixmystreet.utils, {
// fixmystreet.select_feature).
markers_highlight: function(problem_id) {
+ if (!fixmystreet.markers) {
+ return;
+ }
for (var i = 0; i < fixmystreet.markers.features.length; i++) {
if (typeof problem_id == 'undefined') {
// There is no highlighted marker, so unfade this marker
@@ -791,6 +794,10 @@ $.extend(fixmystreet.utils, {
$(function(){
+ if (!document.getElementById('map')) {
+ return;
+ }
+
// Set specific map config - some other JS included in the
// template should define this
fixmystreet.maps.config();