Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
c0edf61e069b5d1b12c0700d88d213f69305560f
1 parent
9b21e15c
fix conflict
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
85 deletions
static/js/index/channel.js
static/js/index/search.js
static/js/me/address-act.js
static/js/plugin/security.js
static/js/index/channel.js
View file @
c0edf61
...
...
@@ -16,8 +16,17 @@ var $searchBox = $('.search-box'),
$appFloatLayer
=
$
(
'#float-layer-app'
);
var
$search
=
$searchBox
.
children
(
'input[type="text"]'
),
$cancelSearch
=
$box
.
children
(
'.no-search'
),
$searchIcon
=
$searchBox
.
children
(
'.search-icon'
);
$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'
);
...
...
@@ -45,15 +54,7 @@ $searchBox.children('.clear-text').on('touchstart', function() {
$searchBox
.
children
(
'.search-icon'
).
on
(
'touchstart'
,
function
()
{
if
(
security
.
hasDangerInput
())
{
<<<<<<<
HEAD
<<<<<<<
HEAD
return
false
;
=======
return
false
;
>>>>>>>
3685878
e28b5f0a7fbf2ebdb250a96a5ecc47f52
=======
return
false
;
>>>>>>>
70676
b75c6237c141c6f2f4e47518bcd80ea47d8
}
$indexSearch
.
submit
();
});
...
...
@@ -80,32 +81,40 @@ $channelLink.on('touchstart', function() {
borderColor
:
'#fff'
});
});
var
updateLayerPosition
=
(
function
()
{
var
init
=
false
;
return
function
()
{
var
winHeight
=
window
.
innerHeight
;
var
bodyHeight
=
$doc
.
height
();
var
scrollTopPosition
=
$win
.
scrollTop
();
var
layerHeight
=
$appFloatLayer
.
height
();
var
layerPaddingTop
=
parseInt
(
$appFloatLayer
.
css
(
'padding-top'
));
var
layerPaddingBottom
=
parseInt
(
$appFloatLayer
.
css
(
'padding-bottom'
));
var
newPosition
;
if
(
init
){
newPosition
=
bodyHeight
-
winHeight
-
scrollTopPosition
;
}
else
{
init
=
true
;
newPosition
=
bodyHeight
-
winHeight
-
scrollTopPosition
+
layerHeight
+
layerPaddingTop
+
layerPaddingBottom
;
}
$appFloatLayer
.
css
({
'position'
:
'relative'
,
'bottom'
:
newPosition
+
'px'
});
};
})();
$win
.
scroll
(
function
()
{
updateLayerPosition
();
});
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
);
...
...
static/js/index/search.js
View file @
c0edf61
...
...
@@ -49,15 +49,7 @@ cHammer.on('tap', function() {
$
(
'#search'
).
on
(
'touchend'
,
function
()
{
if
(
security
.
hasDangerInput
())
{
<<<<<<<
HEAD
<<<<<<<
HEAD
return
false
;
=======
return
false
;
>>>>>>>
3685878
e28b5f0a7fbf2ebdb250a96a5ecc47f52
=======
return
false
;
>>>>>>>
70676
b75c6237c141c6f2f4e47518bcd80ea47d8
}
$
(
this
).
closest
(
'form'
).
submit
();
return
false
;
...
...
static/js/me/address-act.js
View file @
c0edf61
...
...
@@ -55,11 +55,7 @@ $addressForm.on('submit', function() {
}
if
(
security
.
hasDangerInput
(
false
))
{
<<<<<<<
HEAD
return
false
;
=======
return
false
;
>>>>>>>
3685878
e28b5f0a7fbf2ebdb250a96a5ecc47f52
}
// 简单的表单校验
...
...
@@ -168,15 +164,12 @@ $addressListPage.find('.address-last').each(function(i, elem) {
});
});
<<<<<<<
HEAD
=======
$addressListPage
.
on
(
'touchstart'
,
'li'
,
function
()
{
$
(
this
).
addClass
(
'highlight'
);
}).
on
(
'touchend touchcancel'
,
'li'
,
function
()
{
$
(
this
).
removeClass
(
'highlight'
);
});
>>>>>>>
3685878
e28b5f0a7fbf2ebdb250a96a5ecc47f52
$
(
'input, textarea'
).
on
(
'focus'
,
function
()
{
$footer
.
hide
();
}).
on
(
'blur'
,
function
()
{
...
...
static/js/plugin/security.js
View file @
c0edf61
...
...
@@ -14,33 +14,7 @@ var $ = require('jquery'),
* @return {Bool} true/false If the input have danger value
*/
function
hasDangerInput
(
needConvert
)
{
<<<<<<<
HEAD
<<<<<<<
HEAD
=======
>>>>>>>
70676
b75c6237c141c6f2f4e47518bcd80ea47d8
var
validationPartten
=
/
[
'"<>&
\|]
|--/g
;
var
inputs
=
$
(
'input[type!=hidden], textarea'
);
var
inputsLength
=
inputs
.
length
;
// to set if the input value should be coverted, and its default value is true;
var
willConvert
=
needConvert
===
undefined
||
typeof
needConvert
!==
'boolean'
?
true
:
needConvert
;
for
(
var
i
=
0
;
i
<
inputsLength
;
i
++
)
{
var
val
=
inputs
.
eq
(
i
).
val
();
if
(
validationPartten
.
test
(
val
))
{
if
(
willConvert
)
{
inputs
.
eq
(
i
).
val
(
val
.
replace
(
validationPartten
,
' '
));
}
else
{
var
matchChars
=
val
.
match
(
validationPartten
).
join
(
' '
);
tip
.
show
(
'不可以输入 '
+
matchChars
+
' 哦!'
);
}
return
!
willConvert
&&
true
;
<<<<<<<
HEAD
}
}
return
false
;
=======
var
$inputs
=
$
(
'input[type!=hidden], textarea'
);
var
validationPartten
=
/
[
'"<>&
\|]
|--/g
,
...
...
@@ -66,18 +40,10 @@ function hasDangerInput(needConvert) {
return
!
willConvert
&&
true
;
}
=======
>>>>>>>
70676
b75c6237c141c6f2f4e47518bcd80ea47d8
}
}
<<<<<<<
HEAD
return
false
;
>>>>>>>
3685878
e28b5f0a7fbf2ebdb250a96a5ecc47f52
=======
return
false
;
>>>>>>>
70676
b75c6237c141c6f2f4e47518bcd80ea47d8
}
...
...
Please
register
or
login
to post a comment