vendor/assets/javascripts/webshims/minified/shims/geolocation.js in webshims-rails-0.4.6 vs vendor/assets/javascripts/webshims/minified/shims/geolocation.js in webshims-rails-0.4.7

- old
+ new

@@ -1 +1 @@ -(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); +(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||{};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