<! –
1
“;
$(” UI-自动完成 “)。追加(”
“);
}
其他{
var no_result_found =“
点击这里获取更多结果
“;
响应([{ label: no_result_found, val: -1}]);
}
}
});
},
search:function(){
$(本).addClass(“头搜索,自动完成负载”);
$( “UI-自动填充 ”)除去(“ li.autocomplete – 响应 – 文本”);
},
minLength:1,
select:function(event,ui){
self.location = ui.item.link
},
open:function(event,ui){
$('。ui-autocomplete')。css('width',“310px”);
$('。ui-autocomplete')。css('height','300px');
$('。ui-autocomplete')。css('overflow-y','scroll');
$('。ui-autocomplete')。css('z-index','10000');
$(本).removeClass(“头搜索,自动完成负载”);
}
})
.data(“ui-autocomplete”)._ renderItem = function(ul,item){
var sub =“”;
var html =“”;
if(item.category){
var li;
if(item.category!= currentCategory){
ul.append(“
“+ item.category +”
“);
currentCategory = item.category;
}
}
if(item.icon){
var html ='“;
html + ='“;
html + ='“;
}
html + ='
html + ='
'+ item.label +'
“;
如果(item.location){
html + ='
'+ item.location +'
“;
}
html + ='
“;
返回$(“
.data(“ui-autocomplete-item”,item)
.append(HTML)
.appendTo($(UL).addClass( “导航栏搜索列表”));
};
$(“新的移动头搜索”)。自动完成({
source:function(request,response){
$就({
url:“https://e27.co/index/main_search_new”,
//网址:“http://e27beta.co/index/main_search_new”,
// url:“http://e27beta.co/_html/header_search.json”,
dataType:“json”,
数据:{
q:request.term
},
成功:函数(数据){
//console.log("search“);
$(“#statssaver”)。attr(“src”,“https://e27.co/stats/log”);
尝试{
ga('send','pageview',“/ index / main_search_new?q =”+ searchq);
}
捕捉(E){
}
if(data.length> 0){
响应(数据);
var footer =“
点击这里获取更多结果
“;
$(” UI-自动完成 “)。追加(”
“);
}
其他{
var no_result_found =“
点击这里获取更多结果
“;
响应([{ label: no_result_found, val: -1}]);
}
}
});
},
search:function(){
$(本).addClass(“头搜索,自动完成负载”);
$( “UI-自动填充 ”)除去(“ li.autocomplete – 响应 – 文本”);
},
minLength:1,
select:function(event,ui){
self.location = ui.item.link
},
open:function(event,ui){
$('。ui-autocomplete')。css('width',“100%”);
$('。ui-autocomplete')。css('height','300px');
$('。ui-autocomplete')。css('overflow-y','scroll');
$('。ui-autocomplete')。css('z-index','10000');
$(本).removeClass(“头搜索,自动完成负载”);
}
})
.data(“ui-autocomplete”)._ renderItem = function(ul,item){
var sub =“”;
var html =“”;
if(item.category){
var li;
if(item.category!= currentCategory){
ul.append(“
“+ item.category +”
“);
currentCategory = item.category;
}
}
if(item.icon){
var html ='“;
html + ='“;
html + ='“;
}
html + ='
html + ='
'+ item.label +'
“;
如果(item.location){
html + ='
'+ item.location +'
“;
}
html + ='
“;
返回$(“
.data(“ui-autocomplete-item”,item)
.append(HTML)
.appendTo($(UL).addClass( “导航栏搜索列表”));
};
});
GlobalJS.onLoad(函数(){
$('。navbar-mobile> .dropdown> .dropdown-menu')。click(function(e){
e.stopPropagation();
});
$('。navbar-click a')。click(function(e){
var ulElem = $(this).parent()。find('ul');
if(ulElem.hasClass('navbar-open')){
。ulElem.removeClass( '导航栏开')addClass( '导航栏闭');
}
其他{
ulElem.removeClass(“导航栏闭”)addClass(“导航栏开”);
}
});
});
function viewAnnoucement(){
}
阅读更多