Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geolocator

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geolocator - npm Package Compare versions

Comparing version 1.2.6 to 1.2.8

2

package.json
{
"name": "geolocator",
"version": "1.2.6",
"version": "1.2.8",
"description": "A javascript library for retrieving geolocation information via HTML5 and IP look-ups...",

@@ -5,0 +5,0 @@ "directories": {

## Geolocator Javascript Library
> Version: 1.2.6
> Version: 1.2.8
> Author: Onur Yıldırım © 2015

@@ -8,3 +8,3 @@ > Source code licensed under the MIT License.

###Features:
### Features:

@@ -36,3 +36,3 @@ - HTML5 geolocation (by user permission)

###Usage:
### Usage:

@@ -67,5 +67,5 @@ Inside the `<head>` of your HTML:

##Methods
## Methods
###`geolocator.locate()`
### `geolocator.locate()`
Use this method to get the location via HTML5 geolocation.

@@ -100,3 +100,3 @@ ```js

###`geolocator.locateByIP()`
### `geolocator.locateByIP()`
Use this method to get the location from the user's IP.

@@ -129,3 +129,3 @@ ```js

###`geolocator.isPositionError()`
### `geolocator.isPositionError()`
Checks whether the type of the given object is HTML5 `PositionError` and returns a `Boolean` value.

@@ -143,3 +143,3 @@ ```js

###`geolocator.location` *Object*
### `geolocator.location` *Object*
Provides the recent geo-location information.

@@ -183,4 +183,9 @@

###Change Log:
### Change Log:
**version 1.2.8**
- Revision: Removed the `sensor` parameter from Goole Maps loader, since it's not required anymore.
- Revision: Bumped *Google Maps* version to `3.18`.
- Revision: Created [NPM package][npm-package].
**version 1.2.6**

@@ -201,3 +206,3 @@ - Revision: The recent `Error` or `PositionError` (HTML5) is passed to error callbacks instead of `String` error message. See updated documentation. Fixes issue [#7](https://github.com/onury/geolocator/issues/7). *(This shouldn't be a breaking-change but do test your app if you decide to upgrade.)*

- Code optimizations.
- Now loads the latest release version of *Google Maps* (3.15).
- Now loads the latest release version of *Google Maps* (`3.15`).

@@ -219,1 +224,2 @@ **version 1.1.0**

[example-img]: https://raw.github.com/onury/geolocator/master/screenshots/geolocator-example.jpg
[npm-package]: https://www.npmjs.com/package/geolocator

@@ -5,3 +5,3 @@ /*jslint browser:true, nomen:true, regexp:true, unparam:true */

/** @license Geolocator Javascript Lib v.1.2.6
/** @license Geolocator Javascript Lib v.1.2.8
* (c) 2014-2015 Onur Yildirim (onur@cutepilot.com)

@@ -30,2 +30,4 @@ * https://github.com/onury/geolocator

googleLoaderURL = 'https://www.google.com/jsapi',
// Google Maps version to be loaded
mapsVersion = '3.18',
// Array of source services that provide location-by-IP information.

@@ -88,3 +90,3 @@ ipGeoSources = [

if (geolocator.__glcb) { delete geolocator.__glcb; }
google.load('maps', '3.15', {other_params: 'sensor=false', callback: callback});
google.load('maps', mapsVersion, {other_params: '', callback: callback});
}

@@ -91,0 +93,0 @@ if (window.google !== undefined && google.maps !== undefined) {

/*
Geolocator Javascript Lib v.1.2.6
Geolocator Javascript Lib v.1.2.8
(c) 2014-2015 Onur Yildirim (onur@cutepilot.com)

@@ -8,9 +8,9 @@ https://github.com/onury/geolocator

var geolocator=function(){function m(a,b,f){function d(b,a){f&&c.parentNode&&c.parentNode.removeChild(c);"function"===typeof b&&b(a)}var c=document.createElement("script");c.async=!0;c.readyState?c.onreadystatechange=function(a){if("loaded"===c.readyState||"complete"===c.readyState)c.onreadystatechange=null,d(b)}:c.onload=function(a){d(b)};c.onerror=function(b){b="Could not load source at "+String(a).replace(/\?.*$/,"");d(g,Error(b))};c.src=a;document.getElementsByTagName("head")[0].appendChild(c)}
function p(a){function b(){geolocator.__glcb&&delete geolocator.__glcb;google.load("maps","3.15",{other_params:"sensor=false",callback:a})}void 0!==window.google&&void 0!==google.maps?a&&a():void 0!==window.google&&void 0!==google.loader?b():(geolocator.__glcb=b,m("https://www.google.com/jsapi?callback=geolocator.__glcb"))}function u(a,b,f){var d,c,e;(a=document.getElementById(a))?(d=new google.maps.Map(a,b),c=new google.maps.Marker({position:b.center,map:d}),e=new google.maps.InfoWindow,e.setContent(f),
google.maps.event.addListener(c,"click",function(){e.open(d,c)}),geolocator.location.map={canvas:a,map:d,options:b,marker:c,infoWindow:e}):geolocator.location.map=null}function v(a,b){(new google.maps.Geocoder).geocode({latLng:a},function(a,d){d===google.maps.GeocoderStatus.OK&&b&&b(a)})}function q(a){var b=new google.maps.LatLng(a.latitude,a.longitude);v(b,function(a){if(a&&0<a.length){var d,c,e={},g=a[0].address_components;for(d=0;d<g.length;d+=1)c=g[d],c.types&&0<c.types.length&&(e[c.types[0]]=
c.long_name,e[c.types[0]+"_s"]=c.short_name);geolocator.location.formattedAddress=a[0].formatted_address;geolocator.location.address={street:e.route||"",neighborhood:e.neighborhood||"",town:e.sublocality||"",city:e.locality||"",region:e.administrative_area_level_1||"",country:e.country||"",countryCode:e.country_s||"",postalCode:e.postal_code||"",streetNumber:e.street_number||""}}u(l,{zoom:null===geolocator.location.ipGeoSource?14:7,center:b,mapTypeId:"roadmap"},a[0].formatted_address);h&&h.call(null,
geolocator.location)})}function w(a,b){function f(b){var c=!0===a?0:"number"===typeof a?a:-1;0<=c?geolocator.locateByIP(h,g,c,l):g&&g(b)}function d(a){geolocator.location={ipGeoSource:null,coords:a.coords,timestamp:(new Date).getTime()};q(geolocator.location.coords)}function c(a){f(a)}geolocator.location=null;navigator.geolocation?navigator.geolocation.getCurrentPosition(d,c,b):f(Error("geolocation is not supported."))}function r(a,b){switch(a){case 0:geolocator.location={coords:{latitude:b.latitude,
longitude:b.longitude},address:{city:b.city,country:b.country_name,countryCode:b.country_code,region:b.region_name}};break;case 1:geolocator.location={coords:{latitude:b.geoplugin_latitude,longitude:b.geoplugin_longitude},address:{city:b.geoplugin_city,country:b.geoplugin_countryName,countryCode:b.geoplugin_countryCode,region:b.geoplugin_regionName}};break;case 2:geolocator.location={coords:{latitude:b.lat,longitude:b.lon},address:{city:b.city,country:"",countryCode:b.country,region:""}}}geolocator.location&&
(geolocator.location.coords.accuracy=null,geolocator.location.coords.altitude=null,geolocator.location.coords.altitudeAccuracy=null,geolocator.location.coords.heading=null,geolocator.location.coords.speed=null,geolocator.location.timestamp=(new Date).getTime(),geolocator.location.ipGeoSource=n[a],geolocator.location.ipGeoSource.data=b)}function t(a){var b=!1;geolocator.location=null;delete geolocator.__ipscb;p(function(){2===k?void 0!==window.Geo&&(r(k,window.Geo),delete window.Geo,b=!0):void 0!==
a&&"string"!==typeof a&&(r(k,a),b=!0);!0===b?q(geolocator.location.coords):g&&g(Error(a||"Could not get location."))})}var h,g,l,n=[{url:"http://freegeoip.net/json/",cbParam:"callback"},{url:"http://www.geoplugin.net/json.gp",cbParam:"jsoncallback"},{url:"http://geoiplookup.wikimedia.org/",cbParam:""}],k;return{location:null,locate:function(a,b,f,d,c){h=a;g=b;l=c;p(function(){w(f,d)})},locateByIP:function(a,b,f,d){k="number"!==typeof f||0>f||f>=n.length?1:f;h=a;g=b;l=d;geolocator.__ipscb=t;a=n[k];
void 0===a.cbParam||null===a.cbParam||""===a.cbParam?m(a.url,t,!0):m(a.url+"?"+a.cbParam+"=geolocator.__ipscb",void 0,!0)},isPositionError:function(a){return"[object PositionError]"===Object.prototype.toString.call(a)}}}();
function p(a){function b(){geolocator.__glcb&&delete geolocator.__glcb;google.load("maps","3.18",{other_params:"",callback:a})}void 0!==window.google&&void 0!==google.maps?a&&a():void 0!==window.google&&void 0!==google.loader?b():(geolocator.__glcb=b,m("https://www.google.com/jsapi?callback=geolocator.__glcb"))}function u(a,b,f){var d,c,e;(a=document.getElementById(a))?(d=new google.maps.Map(a,b),c=new google.maps.Marker({position:b.center,map:d}),e=new google.maps.InfoWindow,e.setContent(f),google.maps.event.addListener(c,
"click",function(){e.open(d,c)}),geolocator.location.map={canvas:a,map:d,options:b,marker:c,infoWindow:e}):geolocator.location.map=null}function v(a,b){(new google.maps.Geocoder).geocode({latLng:a},function(a,d){d===google.maps.GeocoderStatus.OK&&b&&b(a)})}function q(a){var b=new google.maps.LatLng(a.latitude,a.longitude);v(b,function(a){if(a&&0<a.length){var d,c,e={},g=a[0].address_components;for(d=0;d<g.length;d+=1)c=g[d],c.types&&0<c.types.length&&(e[c.types[0]]=c.long_name,e[c.types[0]+"_s"]=
c.short_name);geolocator.location.formattedAddress=a[0].formatted_address;geolocator.location.address={street:e.route||"",neighborhood:e.neighborhood||"",town:e.sublocality||"",city:e.locality||"",region:e.administrative_area_level_1||"",country:e.country||"",countryCode:e.country_s||"",postalCode:e.postal_code||"",streetNumber:e.street_number||""}}u(l,{zoom:null===geolocator.location.ipGeoSource?14:7,center:b,mapTypeId:"roadmap"},a[0].formatted_address);h&&h.call(null,geolocator.location)})}function w(a,
b){function f(b){var c=!0===a?0:"number"===typeof a?a:-1;0<=c?geolocator.locateByIP(h,g,c,l):g&&g(b)}function d(a){geolocator.location={ipGeoSource:null,coords:a.coords,timestamp:(new Date).getTime()};q(geolocator.location.coords)}function c(a){f(a)}geolocator.location=null;navigator.geolocation?navigator.geolocation.getCurrentPosition(d,c,b):f(Error("geolocation is not supported."))}function r(a,b){switch(a){case 0:geolocator.location={coords:{latitude:b.latitude,longitude:b.longitude},address:{city:b.city,
country:b.country_name,countryCode:b.country_code,region:b.region_name}};break;case 1:geolocator.location={coords:{latitude:b.geoplugin_latitude,longitude:b.geoplugin_longitude},address:{city:b.geoplugin_city,country:b.geoplugin_countryName,countryCode:b.geoplugin_countryCode,region:b.geoplugin_regionName}};break;case 2:geolocator.location={coords:{latitude:b.lat,longitude:b.lon},address:{city:b.city,country:"",countryCode:b.country,region:""}}}geolocator.location&&(geolocator.location.coords.accuracy=
null,geolocator.location.coords.altitude=null,geolocator.location.coords.altitudeAccuracy=null,geolocator.location.coords.heading=null,geolocator.location.coords.speed=null,geolocator.location.timestamp=(new Date).getTime(),geolocator.location.ipGeoSource=n[a],geolocator.location.ipGeoSource.data=b)}function t(a){var b=!1;geolocator.location=null;delete geolocator.__ipscb;p(function(){2===k?void 0!==window.Geo&&(r(k,window.Geo),delete window.Geo,b=!0):void 0!==a&&"string"!==typeof a&&(r(k,a),b=!0);
!0===b?q(geolocator.location.coords):g&&g(Error(a||"Could not get location."))})}var h,g,l,n=[{url:"http://freegeoip.net/json/",cbParam:"callback"},{url:"http://www.geoplugin.net/json.gp",cbParam:"jsoncallback"},{url:"http://geoiplookup.wikimedia.org/",cbParam:""}],k;return{location:null,locate:function(a,b,f,d,c){h=a;g=b;l=c;p(function(){w(f,d)})},locateByIP:function(a,b,f,d){k="number"!==typeof f||0>f||f>=n.length?1:f;h=a;g=b;l=d;geolocator.__ipscb=t;a=n[k];void 0===a.cbParam||null===a.cbParam||
""===a.cbParam?m(a.url,t,!0):m(a.url+"?"+a.cbParam+"=geolocator.__ipscb",void 0,!0)},isPositionError:function(a){return"[object PositionError]"===Object.prototype.toString.call(a)}}}();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc