Authored by uedxwg

upadte

framework @ 75bbc3b0
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
... ...
... ... @@ -14,7 +14,8 @@ var swiper,
var searchH = $('.newbrand-search').outerHeight(),
headerH = $('.yoho-header').outerHeight(),
brandSwipe = parseInt(searchH) + parseInt(headerH) - 1;
brandSwipe = parseInt(searchH) + parseInt(headerH) - 1,
searchArray = [];
var brandsData,
$keyword,
... ... @@ -100,15 +101,16 @@ function searchResult() {
brandHtml.push('</h2></div>');
$.each(v, function(i, brand) {
// brandHtml.push('<p><a href="' + brand.url + '">' + brand.name);
brandHtml.push('<p><span>' + brand.name);
brandHtml.push('<p><a href="' + brand.url + '">' + brand.name);
// brandHtml.push('<p><span>' + brand.name);
if (brand.isNew) {
brandHtml.push('<i class="icon-hot">Hot</i>');
}
if (brand.isHot) {
brandHtml.push('<i class="icon-new">New</i>');
}
brandHtml.push('</span></p>');
brandHtml.push('</a></p>');
});
brandHtml.push('</div>');
html += brandHtml.join('');
... ... @@ -132,19 +134,18 @@ function searchResult() {
if (Object.keys(result).length > 0) {
rightBarBindClick();
}
console.log($('.search-result .brand-list p').length);
$('.search-result .brand-list p').each(function (index) {
// $('.search-result .brand-list').eq(index).find('p span').click(function () {
// console.log(index);
// })
searchList = new Hammer($('.search-result .brand-list p').eq(index)[0]);
searchList.on('tap', function() {
// var $el = $(e.target);
// console.log($el.closest('sapn')).html();
console.log($('.search-result .brand-list p').eq(index).find('span').html());
if (localStorage.getItem('yohoHistory')) {
yohoHistory = localStorage.getItem('yohoHistory');
searchArray.push(yohoHistory)
}
searchArray.push('{"searchName":"' +
$('.search-result .brand-list p').eq(index).find('a').html() +
'","searchHref":"' + $('.search-result .brand-list p')
.eq(index).find('a').attr('href') + '"}');
localStorage.setItem('yohoHistory', searchArray);
});
});
}
... ... @@ -182,13 +183,14 @@ if ($('.brand-search-page').length) {
return false;
});
if (localStorage) {
yohoHistory = localStorage.getItem('yohoHistory');
// if (yohoHistory) {
// for (var i = 1; i < yohoHistory.split(" ").length - 1; i++) {
// $("<a href='#'>" + yohoHistory.split(" ")[i] + "</a>").appendTo(".historyList");
// }
// }
yohoHistory = $.parseJSON('[' + localStorage.getItem('yohoHistory') + ']');
console.log(yohoHistory);
if (yohoHistory) {
$.each(yohoHistory, function(index, content) {
$('<a href="' + content.searchHref + '">' + content.searchName + '</a>').appendTo('.historyList');
})
}
}
removeHistory = new Hammer($('.removeHistory')[0]);
... ... @@ -196,18 +198,4 @@ if ($('.brand-search-page').length) {
$('.historyList').html(' ');
localStorage.clear();
});
// clearHistoryHammer = new Hammer($('#clear-text')[0]);
// clearHistoryHammer.on('tap', function() {
// // setcookie('h_brands', '', {
// // expire: -1,
// // path: '/',
// // domain: '.m.yohobuy.com'
// // });
// $('#history-keyword').remove();
// $(this).hide();
// });
}
... ...