polyfills.navigator.geolocation.min.js Maven / Gradle / Ivy
The newest version!
!function(t){function e(){this.getCurrentPosition=c}function o(t){var e=new Date;this.coords=new a(t),this.timestamp=e.getTime()}function i(t){this.code=t,this.message="Network location provider at '"+l+"' : "+r[t-1]}function n(t){this.timeout=parseFloat(t.timeout)||d}function a(t){this.latitude=t.latitude,this.longitude=t.longitude}function c(e,a,c){if(!(m=m||confirm(s)))return void setTimeout(function(){a.call(t,new i(1))});var r=document.head.appendChild(document.createElement("script")),d=new n(c||{});h.timeout=setTimeout(function(){setTimeout(function(){document.head.removeChild(r)}),delete h.callback,a.call(t,new i(3))},d.timeout),h.callback=function(i){clearTimeout(h.timeout),setTimeout(function(){document.head.removeChild(r)}),delete h.callback,e.call(t,new o(i))},r.addEventListener("error",function(){setTimeout(function(){document.head.removeChild(r)}),delete h.callback,a.call(t,new i(2))}),r.src=l+u}i.prototype.PERMISSION_DENIED=1,i.prototype.POSITION_UNAVAILABLE=2,i.prototype.TIMEOUT=3;var l="http://freegeoip.net/",u="json/?callback=navigator.geolocation.callback",r=["Permission denied","Position undetermined","Timeout elapsed"],d=6e4,s="This page wants to track your physical location.\nDo you allow it?",m=!1,h=navigator.geolocation=new e}(this);