diff --git a/ajaxzip3.js b/ajaxzip3.js index f952601..c2918d5 100644 --- a/ajaxzip3.js +++ b/ajaxzip3.js @@ -1,2 +1,3 @@ +//tttt var CACHE=[],YubinBango;!function(e){var t=function(){function e(e,t){if(void 0===e&&(e=""),this.URL="https://yubinbango.github.io/yubinbango-data/data",this.REGION=[null,"北海道","青森県","岩手県","宮城県","秋田県","山形県","福島県","茨城県","栃木県","群馬県","埼玉県","千葉県","東京都","神奈川県","新潟県","富山県","石川県","福井県","山梨県","長野県","岐阜県","静岡県","愛知県","三重県","滋賀県","京都府","大阪府","兵庫県","奈良県","和歌山県","鳥取県","島根県","岡山県","広島県","山口県","徳島県","香川県","愛媛県","高知県","福岡県","佐賀県","長崎県","熊本県","大分県","宮崎県","鹿児島県","沖縄県"],e){var n=e.replace(/[0-9]/g,function(e){return String.fromCharCode(e.charCodeAt(0)-65248)}),i=n.match(/\d/g),r=i.join(""),o=this.chk7(r);o?this.getAddr(o,t):t(this.addrDic())}}return e.prototype.chk7=function(e){return 7===e.length?e:void 0},e.prototype.addrDic=function(e,t,o,n,i){return void 0===e&&(e=""),void 0===t&&(t=""),void 0===o&&(o=""),void 0===n&&(n=""),void 0===i&&(i=""),{region_id:e,region:t,locality:o,street:n,extended:i}},e.prototype.selectAddr=function(e){return e&&e[0]&&e[1]?this.addrDic(e[0],this.REGION[e[0]],e[1],e[2],e[3]):this.addrDic()},e.prototype.jsonp=function(t,o){window.$yubin=function(e){return o(e)};var e=document.createElement("script");e.setAttribute("type","text/javascript"),e.setAttribute("charset","UTF-8"),e.setAttribute("src",t),document.head.appendChild(e)},e.prototype.getAddr=function(t,o){var n=this,e=t.substr(0,3);return e in CACHE&&t in CACHE[e]?o(this.selectAddr(CACHE[e][t])):void this.jsonp(this.URL+"/"+e+".js",function(i){return CACHE[e]=i,o(n.selectAddr(i[t]))})},e}();e.Core=t}(YubinBango||(YubinBango={}));var YubinBango;!function(e){var t=function(){function t(){this.prev=""}return t.prototype.getAddr=function(t,o){return(new e.Core).getAddr(t,o)},t.prototype.zip2addr=function(c,a,o,n,i,r,t){var d=this,e={};if(e.postalcode01=c?this.getElementByName(c):void 0,e.postalcode02=a?this.getElementByName(a,e.postalcode01):void 0,e.region=o?this.getElementByName(o,e.postalcode01):void 0,e.locality=n?this.getElementByName(n,e.postalcode01):void 0,e.street=i?this.getElementByName(i,e.postalcode01):void 0,e.extended=r?this.getElementByName(r,e.postalcode01):void 0,e.ffocus=void 0===t?!0:t,e.postalcode01&&e.region){var s=e.postalcode01?e.postalcode01.value:"",u=e.postalcode02?e.postalcode02.value:"",l=s+u;l&&this.getAddr(l,function(t){d.apply(e,t)})}},t.prototype.apply=function(t,e){e.extended||(e.extended="");var o=t.locality;if("select-one"==t.region.type||"select-multiple"==t.region.type)for(var i=t.region.options,n=0;n1&&o&&o.form))return n[0];for(var i=o.form.elements,t=0;t