geoctrl_xprajs.js 4.0 KB

1
  1. _jsload2&&_jsload2('geoctrl', 'z.extend(Zb.prototype,{initialize:function(a){var b=this;Vb.prototype.initialize.call(b,a);b.Aa();b.pr={"default":B.ka+"images/geolocation-control/mobile/default-40x40.png",loading:B.ka+"images/geolocation-control/mobile/loading-40x40.gif",success:B.ka+"images/geolocation-control/mobile/success-40x40.png",fail:B.ka+"images/geolocation-control/mobile/fail-40x40.png"};b.ij=b.C.children[0];b.FD=b.ij.children[0];b.Xo=b.FD.children[0];b.DD=b.ij.children[1];b.vL=b.DD.children[0].children[0];var c;b.B.addEventListener("moveend", function(){if(c){var a=b.B.Ka();a.lng===c.lng&&a.lat===c.lat?b.Lr(b.pr.success):(b.Lr(b.pr["default"]),b.VQ())}});z.M(b.Xo,"click",function(){b.Lr(b.pr.loading);(new Geolocation({timeout:1E4})).getCurrentPosition(function(e){b.Lr(b.pr.success);if(e.address&&b.j.O_){var f="";e.address.city?f+=e.address.city:e.address.province&&(f+=e.address.province);e.address.district&&(f+=e.address.district);e.address.street&&(f+=e.address.street);e.address.street_number&&(f+=e.address.street_number);b.xU(f)}var f= new J(e.longitude,e.latitude),g=new U(f,{icon:b.j.bN?b.j.bN:new qc(B.ka+"images/geolocation-control/point/position-icon-14x14.png",new O(14,14))});c=f;b.GD=f;a.Ga(g);a.Fd(f,15);e.address&&(b.ds={province:e.address.province||"",city:e.address.city||"",district:e.address.district||"",street:e.address.street||"",streetNumber:e.address.street_number||""},Ra(7001,{longitude:e.longitude,latitude:e.latitude,accuracy:e.accuracy}));e=new P("locationSuccess");e.point=b.GD;e.addressComponent=b.ds;b.dispatchEvent(e)}, function(a){b.Lr(b.pr.fail);var c=new P("locationError");c.code=a.errorCode;c.message=a.uk;b.dispatchEvent(c)})});return b.C},location:function(){var a=this;a.I0.push({});(new Geolocation({timeout:1E4})).getCurrentPosition(function(b){a.GD=new J(b.longitude,b.latitude);b.address&&(a.ds={province:b.address.province||"",city:b.address.city||"",district:b.address.district||"",street:b.address.street||"",streetNumber:b.address.street_number||""});b=new P("locationSuccess");b.point=a.GD;b.addressComponent= a.ds;a.dispatchEvent(b)},function(b){var c=new P("locationError");c.code=b.errorCode;c.message=b.uk;a.dispatchEvent(c)})},xX:function(){return this.ds?this.ds:s},sQ:function(){this.B?this.He(this.B):this.map&&this.He(this.map)},Aa:function(){Vb.prototype.Aa.call(this);this.C.style.cssText="height: 32px;";this.C.innerHTML=this.Vq()},Vq:function(){return[\'<div class="BMap_geolocationContainer" style="height: 32px; margin: 0px; box-sizing: border-box; border: 1px solid #d9d7d5; border-radius: 3px; -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.2); overflow: hidden;">\', \'<div class="BMap_geolocationIconBackground" style="float: left; width: 32px; height: 32px; background-image: url(\\\'\'+B.ka+"images/geolocation-control/mobile/gradient-bg-1x64.png\'); background-size: 1px 32px; background-repeat: repeat-x;\\">",\'<div class="BMap_geolocationIcon" style="width: 32px; height: 32px; cursor: pointer; background-image: url(\\\'\'+B.ka+"images/geolocation-control/mobile/default-40x40.png\'); background-size: 20px 20px; background-repeat: no-repeat; background-position: center center;\\"></div>", "</div>",\'<div class="BMap_geolocationAddress" style="display: none; float: left; min-width: 50px; padding-left: 10px; padding-right: 10px; border-left: 1px solid #d9d7d5; background-image: url(\'+B.ka+\'images/geolocation-control/mobile/gradient-bg-1x64.png); background-size: 1px 32px; background-repeat: repeat-x;">\',\'<div style="height: 32px; display: table-cell; vertical-align: middle;"><div class="BMap_geolocationAddressText" style="font-size: 12px; color: #666666; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; display: block; min-width: 50px; max-width: 200px;"></div></div></div></div>\'].join("")}, Lr:function(a){this.Xo.style.backgroundImage="url(\'"+a+"\')"},xU:function(a){this.DD.style.display="block";this.vL.textContent=a},VQ:function(){this.vL.textContent="";this.DD.style.display="none"}});Zb.prototype.location=Zb.prototype.location;Zb.prototype.getAddressComponent=Zb.prototype.xX; ');