vendor/assets/javascripts/webshims/minified/shims/geolocation.js in webshims-rails-0.4.4 vs vendor/assets/javascripts/webshims/minified/shims/geolocation.js in webshims-rails-0.4.5
- old
+ new
@@ -1,5 +2 @@
-(function(c){if(!navigator.geolocation){var n=function(){setTimeout(function(){throw"document.write is overwritten by geolocation shim. This method is incompatible with this plugin";},1)},f=0,k=c.webshims.cfg.geolocation.options||{};navigator.geolocation=function(){var a,i={getCurrentPosition:function(i,d,g){var e=2,f,l,m,h=function(){if(!m)if(a){if(m=!0,i(c.extend({timestamp:(new Date).getTime()},a)),j(),window.JSON&&window.sessionStorage)try{sessionStorage.setItem("storedGeolocationData654321",
-JSON.stringify(a))}catch(b){}}else d&&!e&&(m=!0,j(),d({code:2,message:"POSITION_UNAVAILABLE"}))},p=function(){e--;o();h()},j=function(){c(document).unbind("google-loader",j);clearTimeout(l);clearTimeout(f)},o=function(){if(a||!window.google||!google.loader||!google.loader.ClientLocation)return!1;var b=google.loader.ClientLocation;a={coords:{latitude:b.latitude,longitude:b.longitude,altitude:null,accuracy:43E3,altitudeAccuracy:null,heading:parseInt("NaN",10),velocity:null},address:c.extend({streetNumber:"",
-street:"",premises:"",county:"",postalCode:""},b.address)};return!0};if(!a&&(o(),!a&&window.JSON&&window.sessionStorage))try{a=(a=sessionStorage.getItem("storedGeolocationData654321"))?JSON.parse(a):!1,a.coords||(a=!1)}catch(q){a=!1}a?setTimeout(h,1):k.confirmText&&!confirm(k.confirmText.replace("{location}",location.hostname))?d&&d({code:1,message:"PERMISSION_DENIED"}):(c.ajax({url:"http://freegeoip.net/json/",dataType:"jsonp",cache:!0,jsonp:"callback",success:function(b){e--;b&&(a=a||{coords:{latitude:b.latitude,
-longitude:b.longitude,altitude:null,accuracy:43E3,altitudeAccuracy:null,heading:parseInt("NaN",10),velocity:null},address:{city:b.city,country:b.country_name,countryCode:b.country_code,county:"",postalCode:b.zipcode,premises:"",region:b.region_name,street:"",streetNumber:""}},h())},error:function(){e--;h()}}),clearTimeout(l),!window.google||!window.google.loader?l=setTimeout(function(){if(k.destroyWrite)document.write=n,document.writeln=n;c(document).one("google-loader",p);c.webshims.loader.loadScript("http://www.google.com/jsapi",
-!1,"google-loader")},800):e--,f=g&&g.timeout?setTimeout(function(){j();d&&d({code:3,message:"TIMEOUT"})},g.timeout):setTimeout(function(){e=0;h()},1E4))},clearWatch:c.noop};i.watchPosition=function(a,c,g){i.getCurrentPosition(a,c,g);f++;return f};return i}();c.webshims.isReady("geolocation",!0)}})(jQuery);
+(function(e){if(navigator.geolocation)return;var t=function(){setTimeout(function(){throw"document.write is overwritten by geolocation shim. This method is incompatible with this plugin"},1)},n=0,r=e.webshims.cfg.geolocation.options||{};navigator.geolocation=function(){var i,s={getCurrentPosition:function(n,s,o){var u=2,a,f,l,c=function(){if(l)return;if(i){l=!0,n(e.extend({timestamp:(new Date).getTime()},i)),p();if(window.JSON&&window.sessionStorage)try{sessionStorage.setItem("storedGeolocationData654321",JSON.stringify(i))}catch(t){}}else s&&!u&&(l=!0,p(),s({code:2,message:"POSITION_UNAVAILABLE"}))},h=function(){u--,d(),c()},p=function(){e(document).unbind("google-loader",p),clearTimeout(f),clearTimeout(a)},d=function(){if(i||!window.google||!google.loader||!google.loader.ClientLocation)return!1;var t=google.loader.ClientLocation;return i={coords:{latitude:t.latitude,longitude:t.longitude,altitude:null,accuracy:43e3,altitudeAccuracy:null,heading:parseInt("NaN",10),velocity:null},address:e.extend({streetNumber:"",street:"",premises:"",county:"",postalCode:""},t.address)},!0},v=function(){if(i)return;d();if(i||!window.JSON||!window.sessionStorage)return;try{i=sessionStorage.getItem("storedGeolocationData654321"),i=i?JSON.parse(i):!1,i.coords||(i=!1)}catch(e){i=!1}};v();if(!!i){setTimeout(c,1);return}if(r.confirmText&&!confirm(r.confirmText.replace("{location}",location.hostname))){s&&s({code:1,message:"PERMISSION_DENIED"});return}e.ajax({url:"http://freegeoip.net/json/",dataType:"jsonp",cache:!0,jsonp:"callback",success:function(e){u--;if(!e)return;i=i||{coords:{latitude:e.latitude,longitude:e.longitude,altitude:null,accuracy:43e3,altitudeAccuracy:null,heading:parseInt("NaN",10),velocity:null},address:{city:e.city,country:e.country_name,countryCode:e.country_code,county:"",postalCode:e.zipcode,premises:"",region:e.region_name,street:"",streetNumber:""}},c()},error:function(){u--,c()}}),clearTimeout(f),!window.google||!window.google.loader?f=setTimeout(function(){r.destroyWrite&&(document.write=t,document.writeln=t),e(document).one("google-loader",h),e.webshims.loader.loadScript("http://www.google.com/jsapi",!1,"google-loader")},800):u--,o&&o.timeout?a=setTimeout(function(){p(),s&&s({code:3,message:"TIMEOUT"})},o.timeout):a=setTimeout(function(){u=0,c()},1e4)},clearWatch:e.noop};return s.watchPosition=function(e,t,r){return s.getCurrentPosition(e,t,r),n++,n},s}(),e.webshims.isReady("geolocation",!0)})(jQuery);
\ No newline at end of file