Skip to content

Commit 648dc1f

Browse files
authored
Merge pull request #89 from Logicify/development
Released version v0.1.15
2 parents d717c60 + 3f46656 commit 648dc1f

15 files changed

+253
-30
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules
1+
node_modules
2+
.idea

Gruntfile.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ module.exports = function (grunt) {
3838
sourceMap: true
3939
},
4040
files: {
41-
'<%= appConfig.dist %>/locationpicker.jquery.min.js': ['<%= appConfig.app %>/*.js']
41+
'<%= appConfig.dist %>/locationpicker.jquery.min.js': ['<%= appConfig.app %>/locationpicker.jquery.js'],
42+
'<%= appConfig.dist %>/angularLocationpicker.jquery.min.js': ['<%= appConfig.app %>/angularLocationpicker.jquery.js']
4243
}
4344
},
4445
beautify: {
@@ -52,7 +53,8 @@ module.exports = function (grunt) {
5253
mangle: false
5354
},
5455
files: {
55-
'<%= appConfig.dist %>/locationpicker.jquery.js': ['<%= appConfig.app %>/*.js']
56+
'<%= appConfig.dist %>/locationpicker.jquery.js': ['<%= appConfig.app %>/locationpicker.jquery.js'],
57+
'<%= appConfig.dist %>/angularLocationpicker.jquery.js': ['<%= appConfig.app %>/angularLocationpicker.jquery.js']
5658
}
5759
}
5860
}

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Documentation along with examples available [here](http://logicify.github.io/jqu
4040

4141
Credits
4242
-------
43-
Dmitry Berezovsky, Logicify (<http://logicify.com/>)
44-
Emanuele Coppola, Libre sc (<http://libreidee.com/>)
43+
* Dmitry Berezovsky, Logicify (<http://logicify.com/>)
44+
* Gennadiy Varava, Logicify (<http://logicify.com/>)
45+
* Emanuele Coppola, Libre sc (<http://libreidee.com/>)
4546

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "jquery-locationpicker",
3-
"version": "0.1.14",
2+
"name": "jquery-locationpicker-plugin",
3+
"version": "0.1.15",
44
"homepage": "https://github.com/Logicify/jquery-locationpicker-plugin",
55
"authors": [
66
"Dmitry Berezovsky <dmitry.berezovsky@logicify.com>"

dist/angularLocationpicker.jquery.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*! jquery-locationpicker - v0.1.15 - 2016-09-26 */
2+
"use strict";
3+
4+
angular.module("angular-jquery-locationpicker", []).constant("angularJQueryLocationpickerDefaultValue", {
5+
css: {
6+
width: "550px",
7+
height: "400px",
8+
"float": "left"
9+
}
10+
}).service("angularJQueryLocationpickerService", [ "angularJQueryLocationpickerDefaultValue", function(defaultValue) {
11+
var service = {};
12+
service.callAutosizeOnInit = function(element, initCb) {
13+
var cb = initCb;
14+
if (!!cb) {
15+
initCb = function() {
16+
$(element).locationpicker("autosize");
17+
cb();
18+
};
19+
} else {
20+
initCb = function() {
21+
$(element).locationpicker("autosize");
22+
};
23+
}
24+
};
25+
service.checkDefaultStyles = function(element) {
26+
var elementStyle = element[0].style;
27+
element.css({
28+
width: elementStyle.width || defaultValue.css.width,
29+
height: elementStyle.height || defaultValue.css.height,
30+
"float": elementStyle.float || defaultValue.css.float,
31+
overflow: "hidden"
32+
});
33+
};
34+
return service;
35+
} ]).directive("locationpicker", [ "angularJQueryLocationpickerService", function(service) {
36+
return {
37+
restrict: "EA",
38+
replace: true,
39+
scope: {
40+
options: "="
41+
},
42+
link: function(scope, element, attrs) {
43+
service.checkDefaultStyles(element);
44+
service.callAutosizeOnInit(element, scope.options.oninitialized);
45+
$(element).locationpicker(scope.options);
46+
}
47+
};
48+
} ]);

dist/angularLocationpicker.jquery.min.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angularLocationpicker.jquery.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/locationpicker.jquery.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jquery-locationpicker - v0.1.14 - 2016-09-20 */
1+
/*! jquery-locationpicker - v0.1.15 - 2016-09-26 */
22
(function($) {
33
function GMapContext(domElement, options) {
44
var _map = new google.maps.Map(domElement, options);
@@ -91,6 +91,10 @@
9191
var address = GmUtility.addressByFormat(results, gmapContext.settings.addressFormat);
9292
gmapContext.locationName = address.formatted_address;
9393
gmapContext.addressComponents = GmUtility.address_component_from_google_geocode(address.address_components);
94+
} else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
95+
return setTimeout(function() {
96+
GmUtility.updateLocationName(gmapContext, callback);
97+
}, 1e3);
9498
}
9599
if (callback) {
96100
callback.call(this, gmapContext);
@@ -148,10 +152,11 @@
148152
if (inputBinding) {
149153
if (inputBinding.radiusInput) {
150154
inputBinding.radiusInput.on("change", function(e) {
151-
if (!e.originalEvent) {
155+
var radiusInputValue = $(this).val();
156+
if (!e.originalEvent || isNaN(radiusInputValue)) {
152157
return;
153158
}
154-
gmapContext.radius = $(this).val();
159+
gmapContext.radius = radiusInputValue;
155160
GmUtility.setPosition(gmapContext, gmapContext.location, function(context) {
156161
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
157162
});
@@ -204,21 +209,23 @@
204209
}
205210
if (inputBinding.latitudeInput) {
206211
inputBinding.latitudeInput.on("change", function(e) {
207-
if (!e.originalEvent) {
212+
var latitudeInputValue = $(this).val();
213+
if (!e.originalEvent || isNaN(latitudeInputValue)) {
208214
return;
209215
}
210-
GmUtility.setPosition(gmapContext, new google.maps.LatLng($(this).val(), gmapContext.location.lng()), function(context) {
216+
GmUtility.setPosition(gmapContext, new google.maps.LatLng(latitudeInputValue, gmapContext.location.lng()), function(context) {
211217
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
212218
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
213219
});
214220
});
215221
}
216222
if (inputBinding.longitudeInput) {
217223
inputBinding.longitudeInput.on("change", function(e) {
218-
if (!e.originalEvent) {
224+
var longitudeInputValue = $(this).val();
225+
if (!e.originalEvent || isNaN(longitudeInputValue)) {
219226
return;
220227
}
221-
GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.location.lat(), $(this).val()), function(context) {
228+
GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.location.lat(), longitudeInputValue), function(context) {
222229
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
223230
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
224231
});
@@ -306,7 +313,7 @@
306313
return;
307314
}
308315
var settings = $.extend({}, $.fn.locationpicker.defaults, options);
309-
var gmapContext = new GMapContext(this, {
316+
var gmapContext = new GMapContext(this, $.extend({}, settings.mapOptions, {
310317
zoom: settings.zoom,
311318
center: new google.maps.LatLng(settings.location.latitude, settings.location.longitude),
312319
mapTypeId: settings.mapTypeId,
@@ -324,7 +331,7 @@
324331
markerIcon: settings.markerIcon,
325332
markerDraggable: settings.markerDraggable,
326333
markerVisible: settings.markerVisible
327-
});
334+
}));
328335
$target.data("locationpicker", gmapContext);
329336
function displayMarkerWithSelectedArea() {
330337
GmUtility.setPosition(gmapContext, gmapContext.marker.position, function(context) {
@@ -369,6 +376,7 @@
369376
zoom: 15,
370377
mapTypeId: google.maps.MapTypeId.ROADMAP,
371378
styles: [],
379+
mapOptions: {},
372380
scrollwheel: true,
373381
inputBinding: {
374382
latitudeInput: null,

0 commit comments

Comments
 (0)