aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-OpenLayers.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-01-10 13:25:38 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-01-10 13:25:38 +0000
commitf7f5918e7a9f9eb00e235232df9da43ebdd63944 (patch)
tree4e73609f8aabf9f1d2d12e8b423aadcf855ce162 /web/js/map-OpenLayers.js
parent70dacd4fe2de9eef582ae7e68ab9cc8ad2ead5ba (diff)
Add JSHint configuration, tidy up any warnings.
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r--web/js/map-OpenLayers.js38
1 files changed, 20 insertions, 18 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 31f5f49d8..00f3e8e70 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -22,6 +22,23 @@ $.extend(fixmystreet.utils, {
fixmystreet.maps = fixmystreet.maps || {};
+ var drag = {
+ activate: function() {
+ this._drag = new OpenLayers.Control.DragFeatureFMS( fixmystreet.markers, {
+ onComplete: function(feature, e) {
+ fixmystreet.update_pin( feature.geometry );
+ }
+ } );
+ fixmystreet.map.addControl( this._drag );
+ this._drag.activate();
+ },
+ deactivate: function() {
+ if (this._drag) {
+ this._drag.deactivate();
+ }
+ }
+ };
+
$.extend(fixmystreet.maps, {
// This function might be passed either an OpenLayers.LonLat (so has
// lon and lat), or an OpenLayers.Geometry.Point (so has x and y).
@@ -215,23 +232,6 @@ $.extend(fixmystreet.utils, {
}
});
- var drag = {
- activate: function() {
- this._drag = new OpenLayers.Control.DragFeatureFMS( fixmystreet.markers, {
- onComplete: function(feature, e) {
- fixmystreet.update_pin( feature.geometry );
- }
- } );
- fixmystreet.map.addControl( this._drag );
- this._drag.activate();
- },
- deactivate: function() {
- if (this._drag) {
- this._drag.deactivate();
- }
- }
- };
-
/* Make sure pins aren't going to reload just because we're zooming out,
* we already have the pins when the page loaded */
function zoomToBounds(bounds) {
@@ -862,8 +862,9 @@ OpenLayers.Protocol.FixMyStreet = OpenLayers.Class(OpenLayers.Protocol.HTTP, {
options.params[key] = val;
}
});
+ var page;
if (this.use_page) {
- var page = $('.pagination').data('page');
+ page = $('.pagination').data('page');
this.use_page = false;
} else if (this.initial_page) {
page = 1;
@@ -883,6 +884,7 @@ OpenLayers.Format.FixMyStreet = OpenLayers.Class(OpenLayers.Format.JSON, {
// Remove loading indicator
$('#loading-indicator').addClass('hidden');
$('#loading-indicator').attr('aria-hidden', true);
+ var obj;
if (typeof json == 'string') {
obj = OpenLayers.Format.JSON.prototype.read.apply(this, [json, filter]);
} else {