Authored by 阿达

搜索bug fix2

... ... @@ -44,6 +44,7 @@ var $clearHistory = $('#clear-history');
var writeSearch = require('./write-search');
var ranToken = writeSearch.getRanToken();
var ranToken2 = writeSearch.getRanToken2();
var chHammer;
... ... @@ -339,7 +340,8 @@ if ($('.brand-search-page').length > 0) {
var html = '',
history,
historys, i,
brand, url, locate;
localHistory,
brand,url;
if (localStorage) {
historys = localStorage.getItem('historys-brand');
... ... @@ -352,17 +354,10 @@ if ($('.brand-search-page').length > 0) {
if (history === '') {
continue;
}
locate = history.indexOf('http://');
if (locate === -1) {
brand = history;
url = '';
} else {
brand = history.substr(0, locate);
url = history.substr(locate, history.length - locate);
}
localHistory = history.split(ranToken2);
brand = localHistory[0];
url = localHistory[1];
html += '<li><a href="' + url + '">' + brand + '</li>';
$historySearch.removeClass('hide');
... ...
... ... @@ -5,6 +5,7 @@
*/
var ranToken = ' ??++ ';
var ranToken2 = ' ???+++ ';
var $ = require('jquery');
//获取分隔符
... ... @@ -12,6 +13,10 @@ function getRanToken() {
return ranToken;
}
function getRanToken2() {
return ranToken2;
}
/**
* 增加单条记录
*/
... ... @@ -32,7 +37,7 @@ function bindWirteLocal($brandList) {
$brandList.on('click', 'p , li', function(e) {
var brandName, brandId, brandDomain, url;
var a = $(this).find('a');
var query = a.attr('brandName') + a.attr('href'),
var query = a.attr('brandName') + ranToken2 + a.attr('href'),
historys;
brandName = a.attr('brandName');
... ... @@ -78,5 +83,6 @@ function bindWirteLocal($brandList) {
exports.getRanToken = getRanToken;
exports.getRanToken2 = getRanToken2;
exports.bindWirteLocal = bindWirteLocal;
\ No newline at end of file
... ...