PageSourceSearch

https://17uxi.com/yhxy/yhxy_files/sq_010.js

js 17uxi.com collected 2026-10-04 08:20:55 UTC 6,603 bytes, 1 lines download raw bytes

1!function(a,b,c){var d,e,f,g,h=b.Class(b.Widget);h.include({version:"1.2.2",template:"<option {selected} value='{value}'>{name}</option>",options:{country:{selector:"",def:"",height:300},city:{selector:"",def:"",height:300},district:{selector:"",def:"",height:300},province:{selector:"",def:"",height:300},firstOption:"请选择",url:"http://my.37.com/controller/user/addressinfo.php"},data:{},init:function(b){var c=this.options=a.extend(!0,{},this.options,b);return null===c.province||null===c.city?alert("缺少省市 select"):(a.each(["country","province","city","district"],function(b,d){c[d].element=c[d].selector.fn&&c[d].fn.selector.jquery?c[d].selector:a(c[d].selector)}),void this._init())},_init:function(){this.options.city.element.length&&this.options.city.element.html("<option value=''>先选省</option>"),this.options.district.element.length&&this.options.district.element.html("<option value=''>先选市</option>"),this._parseProvince()},_parseProvince:function(){var b=this;e?b.__parseProvince():a.get(b.options.url,function(a){1===a.code?(e=a.data,b.__parseProvince()):alert(a.msg)},"jsonp").fail(function(){alert("获取数据失败,请稍后尝试")})},__parseProvince:function(){this.options.province.element.html(this._parseTemplate(e,"province")),this._parseSelectMenu()},_parseSelectMenu:function(){var a=this;this.options.country.element.length&&a._parseCountry(),this.menuPR=new b.Selectmenu(this.options.province),this.menuPR.bind("change",function(b){a._parseCity(b.value);var c=a.options.city.element.val();a.menuDI&&a.menuDI.element.length&&!a.menuDI.options.disabled&&!c&&a.__parseDistrict("")}),this.menuCI=new b.Selectmenu(this.options.city),this.menuCI.disable(),this.menuCI.bind("change",function(b){a.menuDI&&(a._parseDistrict(b.value),a.menuDI.options.disabled&&a.menuDI.enable())}),this.options.district.element.length&&(this.menuDI=new b.Selectmenu(this.options.district),this.menuDI.disable());var c=this.options.province.def;c&&this._parseCity(this._getCodeByName(c,e))},_parseCountry:function(){var b=this;d?b.__parseCountry():a.get(b.options.url+"?type=country",function(a){1===a.code?(d=a.data,b.__parseCountry()):alert(a.msg)},"jsonp").fail(function(){alert("获取国家数据失败,请稍后尝试")})},__parseCountry:function(){var c=this;this.options.country.element.html(this._parseCountryTemplate(d,"country",!1)),this.options.country.isInput=!0,this.menuCO=new b.Selectmenu(this.options.country),this.menuCO.bind("change",function(b){"z245"!==b.value?(a(c.options.district.selector).next(".sq-selectmenu").hide(),a(c.options.city.selector).next(".sq-selectmenu").hide(),a(c.options.province.selector).next(".sq-selectmenu").hide(),a("#address-tip").show()):(a("#address-tip").hide(),c.options.province.selector&&a(c.options.province.selector).next(".sq-selectmenu").show(),c.options.city.selector&&a(c.options.city.selector).next(".sq-selectmenu").show(),c.options.district.selector&&a(c.options.district.selector).next(".sq-selectmenu").show())}),"中国"!==this.options.country.def&&(a(c.options.district.selector).next(".sq-selectmenu").hide(),a(c.options.city.selector).next(".sq-selectmenu").hide(),a(c.options.province.selector).next(".sq-selectmenu").hide(),a("#address-tip").show()),a(c.options.country.selector).next(".sq-selectmenu").find("input").on("keyup",function(b){0==a(this).val().length&&c._refreshCountry(""),8!==b.keyCode&&c._refreshCountry(a(this).val())})},_refreshCountry:function(b){var c=b.substring(0,1).toLowerCase(),e=[];d&&(a(d).each(function(a){d[a].TYPE==c&&e.push(d[a])}),0==e.length&&(e=d),this.options.country.element.html(this._parseCountryTemplate(e,"country",!0)),this.menuCO.refresh(null,!0))},_parseCity:function(b){var c=this;f?c.__parseCity(b):a.get(this.options.url,{type:"city"},function(a){1===a.code?(f=a.data,c.__parseCity(b)):alert(a.msg)},"jsonp").fail(function(){alert("获取数据(市)失败,请稍后再试")})},__parseCity:function(b){var c=""===b?"<option value=''>先选省</option>":this._parseTemplate(this._findCity(b),"city");this.options.city.element.html(c),this._isIE6()&&setTimeout(a.proxy(function(){this.options.city.element.show().hide()},this),10),this.menuCI.options.disabled&&this.menuCI.enable(),this.menuCI.refresh();var d=this.options.city.def,e=this.options.city.element.val();e?this._parseDistrict(e):d&&this._parseDistrict(this._getCodeByName(d,f))},_findCity:function(a){for(var b=0,c=f.length,d=[];c>b;b++)f[b].CODE.substring(0,2)===a.substring(0,2)&&d.push(f[b]);return d},_parseDistrict:function(b){var c=this;c.menuDI&&(g?c.__parseDistrict(b):a.get(this.options.url,{type:"area"},function(a){1===a.code?(g=a.data,c.__parseDistrict(b)):alert(a.msg)},"jsonp").fail(function(){alert("获取数据(区)失败,请稍后再试")}
1))},__parseDistrict:function(b){var c=""===b?"<option value=''>先选市</option>":this._parseTemplate(this._findDistrict(b),"district");this.options.district.element.html(c),this._isIE6()&&setTimeout(a.proxy(function(){this.options.district.element.show().hide()},this),10),this.menuDI.options.disabled&&this.menuDI.enable(),this.menuDI.refresh()},_findDistrict:function(a){for(var b=0,c=g.length,d=[];c>b;b++)g[b].CODE.substring(0,4)===a.substring(0,4)&&d.push(g[b]);return d},_isSelected:function(a,b){var c=this.options[b].def;return!!c&&a.indexOf(c)>-1},_parseTemplate:function(a,b){var c=a.length,d=0,e=[],f=this.options.firstOption;for(f&&e.push("<option value=''>"+f+"</option>");c>d;d++)e.push(this.template.replace("{value}",a[d].CODE).replace("{selected}",this._isSelected(a[d].NAME,b)?"selected":0===d&&"city"===b?"selected":"").replace("{name}",a[d].NAME));return e.join("")},_parseCountryTemplate:function(a,b,c){var d=a.length,e=0,f=[],g="",h=this.options.firstOption;for(h&&f.push("<option value=''>"+h+"</option>");d>e;e++)g!=a[e].TYPE&&(g=a[e].TYPE,f.push('<option disabled="disabled" style="text-align:center;">'+g.toUpperCase()+"</option>")),f.push(this.template.replace("{value}",a[e].CODE).replace("{selected}",this._isSelected(a[e].NAME,b)&&!c?"selected":"").replace("{name}",a[e].NAME));return f.join("")},_getCodeByName:function(a,b){for(var c=0,d=b.length;d>c;c++)if(b[c].NAME.indexOf(a)>-1)return b[c].CODE;return""},getAddress:function(b,c){b=b||" ";var d=[],e=this,f=e.options.country.element.length>0?["country","province","city","district"]:["province","city","district"];return a.each(f,function(a,b){c?d.push(e.options[b].element.val()):d.push(e.options[b].element.find(":checked").text())}),d.join(b)},_isIE6:function(){return a.browser.msie&&"6.0"==a.browser.version}}),b.Address=h}(jQuery,SQ);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.