...
|
...
|
@@ -867,14 +867,16 @@ function actionAddKeyWords() { |
|
|
function searchSuggestHistory() {
|
|
|
|
|
|
let $queryKey = $('#query-key');
|
|
|
$.getJSON('//search.yohobuy.com/product/search/history?query=' + encodeURIComponent($queryKey.val()), function(jsonData) {
|
|
|
|
|
|
$.getJSON('//search.yohobuy.com/product/search/history?query=' +
|
|
|
encodeURIComponent($queryKey.val()), function(jsonData) {
|
|
|
var searchSuggestHistoryHtml;
|
|
|
|
|
|
searchSuggestHistoryHtml = handlebars.compile($searchHistoryHbs.html() || '');
|
|
|
$searchHistory.html(searchSuggestHistoryHtml(jsonData)).show();
|
|
|
searchSuggestHistoryHtml = handlebars.compile($searchHistoryHbs.html() || '');
|
|
|
$searchHistory.html(searchSuggestHistoryHtml(jsonData)).show();
|
|
|
|
|
|
$(".search-suggest-title .searchDel").click(function(){
|
|
|
window.setCookie('_History','',{domain:'.yohobuy.com'});
|
|
|
$('.search-suggest-title .searchDel').click(function() {
|
|
|
window.setCookie('_History', '', {domain: '.yohobuy.com'});
|
|
|
$(this).closest('.search-suggest-history').hide();
|
|
|
return false;
|
|
|
});
|
...
|
...
|
@@ -888,35 +890,23 @@ function searchSuggestHistory() { |
|
|
|
|
|
$searchKey.keydown(function() {
|
|
|
|
|
|
}).focus(function(e) {
|
|
|
}).focus(function() {
|
|
|
|
|
|
// if(e.keyCode === 13){
|
|
|
var val = $.trim($(this).val());
|
|
|
searchSuggestHistory();
|
|
|
if (val === '') {
|
|
|
if ($searchHistory && $searchHistory.length) {
|
|
|
val = val.replace(new RegExp('\'', 'gm'), ''); // 去掉特殊字符
|
|
|
searchSuggestHistory(val);
|
|
|
}
|
|
|
var val = $.trim($(this).val());
|
|
|
|
|
|
searchSuggestHistory();
|
|
|
if (val === '') {
|
|
|
if ($searchHistory && $searchHistory.length) {
|
|
|
val = val.replace(new RegExp('\'', 'gm'), ''); // 去掉特殊字符
|
|
|
searchSuggestHistory(val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// }
|
|
|
|
|
|
});
|
|
|
|
|
|
// $searchKey.keydown(function() {
|
|
|
//
|
|
|
// }).focus(function() {
|
|
|
//
|
|
|
// var val = $.trim($(this).val());
|
|
|
// searchSuggestHistory();
|
|
|
// if (val === '') {
|
|
|
// if ($searchHistory && $searchHistory.length) {
|
|
|
// val = val.replace(new RegExp('\'', 'gm'), ''); // 去掉特殊字符
|
|
|
// searchSuggestHistory(val);
|
|
|
// }
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
/**
|
|
|
* 搜索 热门搜索和默认搜索 api
|
|
|
* @return {[type]} [description]
|
...
|
...
|
|