From f7f5918e7a9f9eb00e235232df9da43ebdd63944 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 10 Jan 2018 13:25:38 +0000 Subject: Add JSHint configuration, tidy up any warnings. --- web/js/map-OpenLayers.js | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'web/js/map-OpenLayers.js') 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 { -- cgit v1.2.3