forked from psayre-sc/jQuery-Geolocation-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.geo.min.js
2 lines (2 loc) · 896 Bytes
/
jquery.geo.min.js
1
2
/* jQuery Geo Plugin v0.1.2 - SiteCrafting.com */
(function(d){var f={maximumAge:0,timeout:60000,enableHighAccuracy:false,failToGoogle:true};var e=window.navigator.geolocation;var c=(function(){var g;return function(h){if(!g){g=d.ajax({url:(window.navigator.protocol==="https"?"https":"http")+"://www.google.com/jsapi",dataType:"jsonp",timeout:h})}return g}})();var a=function(h,g){return function(j){var i=j.coords;h.resolve({lat:i.latitude,lng:i.longitude,accr:i.accuracy})}};var b=function(h,g){return function(i){if(g.failToGoogle){c(g.timeout).done(function(){a(h)({coords:{latitude:google.loader.ClientLocation.latitude,longitude:google.loader.ClientLocation.longitude,accuracy:null}})}).fail(function(){h.reject(i)})}else{h.reject(i)}}};d.geo=function(g){var h=d.extend({},f,g),i=d.Deferred();if(e){e.getCurrentPosition(a(i,h),b(i,h),h)}else{b(i,h)()}return i.promise()}})(window.jQuery);