...
|
...
|
@@ -102,6 +102,18 @@ function searchInput() { |
|
|
searchResult();
|
|
|
}
|
|
|
|
|
|
function isLocalStorageSupported() {
|
|
|
var testKey = 'test',
|
|
|
storage = Window.prototype.localStorage;
|
|
|
try {
|
|
|
storage.setItem(testKey, 'testValue');
|
|
|
storage.removeItem(testKey);
|
|
|
return true;
|
|
|
} catch (error) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//绑定提交前的存local操作
|
|
|
function bindWirteLocal($brandList, list) {
|
|
|
$brandList.on('click', 'p , li', function(e) {
|
...
|
...
|
@@ -227,7 +239,10 @@ function searchResult() { |
|
|
// 插入 dom,绑定事件
|
|
|
$('.search-result').html(html);
|
|
|
changeBackground();
|
|
|
bindWirteLocal($('.brand-list'), true);
|
|
|
|
|
|
if (isLocalStorageSupported){
|
|
|
bindWirteLocal($('.brand-list'), true);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
loading.showLoadingMask();
|
...
|
...
|
|