text: define("list:widget/city_search/city_search.js",function(t,i,n){function e(t){if(t!==y){var i=t.getAttribute("data-index");p.style.display="none",(p=v[i]).style.display="block",y.className=y.className.replace(" tab-active",""),(y=t).className+=" tab-active"}}function a(t){location.href=h+t}function o(t){var i=t.getAttribute("data-domain-url");f.val(t.innerHTML),a(i)}function c(){var t=m[0],i=f.offset();t.style.top=i.top+f.innerHeight()+"px",t.style.left=i.left+"px"}function r(t){(m=$(document.getElementById(t).innerHTML).appendTo("body")).on("click",function(t){var i=t.target;switch(i.getAttribute("data-type")){case"cityTab":e(i);break;case"cityItem":o(i)}}),c(),v=m.find("div.city-list-wrap").get(),p=v[0],y=m.find("a.tab-item")[0],f.on("click",function(){c(),d.isShow()&&d.hide(),w||(m.show(),w=!0),$(this).select()}),$("body").on("click",function(t){var i=t.target;"cityTab"!=i.getAttribute("data-type")&&i.id!=g&&w&&(m.hide(),w=!1)}),$(window).on("resize",function(){c()})}function s(t){d=new b("#"+t,{delay:100,className:"city-suggestion",itemTem:'<a class="j-suggestion-item suggestion-item" data-domain-url="${domain_url}">${city_name}</a>',url:T,isCatch:!1,onconfirm:function(t){var i=t.target,n=i.getAttribute("data-domain-url");"找不到相关城市"!==i.innerHTML&&(f.attr("data-domain-url",n).val(i.innerHTML),a(n))},formatParam:function(t){return{kw:$.trim(t)}},formatRespons:function(t){var i=[],n=t.data.list;return 0===t.errno?n:i},onShow:function(){m.hide(),w=!1},onDataEmpty:function(){return'<p class="city-no-result">找不到相关城市</p>'},onActiveItem:function(t){var i=t.target;"找不到相关城市"===i.innerHTML?($(".city-no-result").removeClass(this.activeItemClass),f.select()):f.attr("data-domain-url",i.getAttribute("data-domain-url")).val(i.innerHTML)}})}function u(t){""!=t.searchBtnId&&$("#"+t.searchBtnId).on("click",function(){var t;(t=f.attr("data-domain-url"))&&a(t)})}function l(t){g=t.inputId,f=$("#"+t.inputId),h="//"+location.host+"/",s(g),r(t.cityFilterId),u(t)}var d,m,f,g,y,p,v,h,b=t("common:widget/ui/suggestion/suggestion.js"),w=!1,T="/pcindex/main/citysug";n.exports={init:l}});