Authored by 王水玲

Merge branch 'master' into feature/passport

... ... @@ -84,8 +84,9 @@
<ul class="search-suggest"></ul>
<div class="search-2016">
<form action="//search.yohobuy.com" method="get" id="search-form">
<input type="text" name="query" class="search-key" autocomplete="off">
<a class="search-btn"></a>
<input type="hidden" id="defaultsearch">
<input class="search-key" type="text" name="query" id="query-key" autocomplete="off" x-webkit-speech="" lang="zh-CN" x-webkit-grammar="builtin:translate" value="" onfocus="if(this.value==this.defaultValue){this.value='';this.style.color='#333'}" onblur="if(this.value==''){this.value=this.defaultValue;this.style.color='#999'}" maxlength="30">
<a class="search-btn" href="javascript:submitSearch();"></a>
</form>
</div>
<div class="go-cart">
... ...
{
"name": "yohobuy-node",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -28,7 +28,10 @@ var thirdLineNum = 9,
requestFrame;
var logoAngle = 0,
loopTime = 500;
loopTime = 500,
keyword = '',
link = '',
reg = /^[\^\!\+\-\(\)\:\[\]\\\{\}\~\*\?\|\&\;\/]{0,}$/g;
var dataLayer = [];
... ... @@ -705,4 +708,32 @@ function actionCover() {
}
}
window.submitSearch = function() {
var $keywordinput = $('#query-key').val();
var $defaultsearch = $('#defaultsearch').val();
var column = 'Search';
var postition = 'Head Search';
var event = 'Search';
var $formatkeyword,
$formatkeywordinput;
$formatkeyword = $.trim(keyword.toLowerCase());
$formatkeywordinput = $.trim($keywordinput.toLowerCase());
getSource(column, postition, event);
if (link !== '' && keyword !== '' && $formatkeyword === $formatkeywordinput) {
location.href = link.replace('\'', '');
} else {
if (reg.test($keywordinput) && $keywordinput !== '') {
location.href = 'http://search.yohobuy.com/error?query=' + $keywordinput + '&result=error';
} else {
if ($keywordinput === '') {
$('#query-key').val($defaultsearch);
}
$searchForm.submit();
return false;
}
}
};
actionCover();
... ...