Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
3b32d2181a3a782d237bc8978e70327aa8bccc31
2 parents
f4f9b394
d8e39997
remove code for footer position calculation and add SQL attack prevent for enter…
… key. code review by LZF
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
50 deletions
static/js/index/channel.js
static/js/index/channel.js
View file @
3b32d21
...
...
@@ -10,24 +10,12 @@ var $searchBox = $('.search-box'),
$box
=
$
(
'.box'
),
$indexSearch
=
$
(
'.index-search'
),
$indexLogo
=
$
(
'.index-logo'
),
$channelLink
=
$
(
'.index-channel a'
),
$win
=
$
(
window
),
$doc
=
$
(
document
),
$appFloatLayer
=
$
(
'#float-layer-app'
);
$channelLink
=
$
(
'.index-channel a'
);
var
$search
=
$searchBox
.
children
(
'input[type="text"]'
),
$cancelSearch
=
$box
.
children
(
'.no-search'
),
$searchIcon
=
$searchBox
.
children
(
'.search-icon'
);
// variables for calculate the app download layer position
var
layerInit
=
false
,
windowViewHeight
=
0
,
layerContentHeight
=
$appFloatLayer
.
height
(),
layerPaddingTop
=
parseInt
(
$appFloatLayer
.
css
(
'padding-top'
)),
layerPaddingBottom
=
parseInt
(
$appFloatLayer
.
css
(
'padding-bottom'
)),
layerHeight
=
layerContentHeight
+
layerPaddingTop
+
layerPaddingBottom
,
layerNewPos
;
require
(
'../common'
);
$search
.
on
(
'focus'
,
function
()
{
...
...
@@ -59,6 +47,15 @@ $searchBox.children('.search-icon').on('touchstart', function() {
$indexSearch
.
submit
();
});
$searchBox
.
keyup
(
function
(
e
)
{
if
(
e
.
keyCode
===
13
)
{
if
(
security
.
hasDangerInput
())
{
return
false
;
}
$indexSearch
.
submit
();
}
});
$
(
'.index-channel img'
).
on
(
'load error'
,
function
()
{
window
.
rePosFooter
&&
window
.
rePosFooter
();
});
...
...
@@ -81,40 +78,3 @@ $channelLink.on('touchstart', function() {
borderColor
:
'#fff'
});
});
function
updateLayerPosition
()
{
var
winHeight
=
window
.
innerHeight
,
bodyHeight
=
$doc
.
height
(),
scrollTopPosition
=
$win
.
scrollTop
();
if
(
layerInit
)
{
//keyboard is shown
if
(
windowViewHeight
-
winHeight
>
200
)
{
if
(
scrollTopPosition
+
windowViewHeight
+
layerHeight
>=
bodyHeight
)
{
layerNewPos
=
0
;
}
else
{
layerNewPos
=
bodyHeight
-
windowViewHeight
-
scrollTopPosition
-
layerHeight
;
}
}
else
{
layerNewPos
=
bodyHeight
-
winHeight
-
scrollTopPosition
;
}
}
else
{
windowViewHeight
=
winHeight
;
layerNewPos
=
bodyHeight
-
winHeight
-
scrollTopPosition
+
layerHeight
;
layerInit
=
true
;
}
$appFloatLayer
.
css
({
position
:
'relative'
,
bottom
:
layerNewPos
+
'px'
});
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
updateLayerPosition
);
});
$doc
.
on
(
'ready'
,
updateLayerPosition
);
...
...
Please
register
or
login
to post a comment