diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-02-28 12:41:52 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-02-28 12:41:52 +0000 |
commit | 37e9d4bcf5793c821f743189c3bf691f2ea3de57 (patch) | |
tree | 23ddbcfd60134cc36e11f5ad055176c4c1f10f60 /web/js/map-bing-ol.js | |
parent | 9871947fbf0be777450884345287bba5317f5886 (diff) |
First time jslint fixings.
Diffstat (limited to 'web/js/map-bing-ol.js')
-rw-r--r-- | web/js/map-bing-ol.js | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index 0211050c6..588f8d45b 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -33,10 +33,12 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { logo: logo, copyrights: copyrights }); - this.map && this.map.events.triggerEvent("changelayer", { - layer: this, - property: "attribution" - }); + if (this.map) { + this.map.events.triggerEvent("changelayer", { + layer: this, + property: "attribution" + }); + } }, initialize: function(name, options) { @@ -59,10 +61,10 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { for (var i = level; i > 0; i--) { var digit = 0; var mask = 1 << (i - 1); - if ((x & mask) != 0) { + if ((x & mask) !== 0) { digit++; } - if ((y & mask) != 0) { + if ((y & mask) !== 0) { digit += 2; } key += digit; @@ -72,16 +74,17 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { getURL: function (bounds) { var res = this.map.getResolution(); - var x = Math.round((bounds.left - this.maxExtent.left) - / (res * this.tileSize.w)); - var y = Math.round((this.maxExtent.top - bounds.top) - / (res * this.tileSize.h)); - var z = this.serverResolutions != null ? + var x = Math.round((bounds.left - this.maxExtent.left) / + (res * this.tileSize.w)); + var y = Math.round((this.maxExtent.top - bounds.top) / + (res * this.tileSize.h)); + var z = this.serverResolutions !== null ? OpenLayers.Util.indexOf(this.serverResolutions, res) : this.map.getZoom() + this.zoomOffset; + var url; if (z >= 16) { - var url = [ + url = [ "http://tilma.mysociety.org/sv/${z}/${x}/${y}.png", "http://a.tilma.mysociety.org/sv/${z}/${x}/${y}.png", "http://b.tilma.mysociety.org/sv/${z}/${x}/${y}.png", @@ -89,8 +92,8 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { ]; } else { var type = ''; - if (z > 10) type = '&productSet=mmOS'; - var url = [ + if (z > 10) { type = '&productSet=mmOS'; } + url = [ "http://ecn.t0.tiles.virtualearth.net/tiles/r${id}.png?g=701" + type, "http://ecn.t1.tiles.virtualearth.net/tiles/r${id}.png?g=701" + type, "http://ecn.t2.tiles.virtualearth.net/tiles/r${id}.png?g=701" + type, |