Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
王水玲
9 years ago
Commit
7419394918476619e1e15b0d7634262b1ecd8df3
2 parents
b86b2485
acb61cbc
Merge branch 'master' into feature/passport
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
4 deletions
doraemon/views/partial/header.hbs
package.json
public/js/header.js
doraemon/views/partial/header.hbs
View file @
7419394
...
...
@@ -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"
>
...
...
package.json
View file @
7419394
{
"name"
:
"yohobuy-node"
,
"version"
:
"1.0.
0
"
,
"version"
:
"1.0.
1
"
,
"private"
:
true
,
"description"
:
"A New Yohobuy Project With Express"
,
"repository"
:
{
...
...
public/js/header.js
View file @
7419394
...
...
@@ -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
();
...
...
Please
register
or
login
to post a comment