Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
php
/
pingan-charity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
52a3f4b3
authored
Feb 24, 2020
by
doszhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dos
parent
9cf9bcde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
205 additions
and
184 deletions
+205
-184
Public/static/js/common.js
+205
-184
No files found.
Public/static/js/common.js
View file @
52a3f4b3
...
...
@@ -101,207 +101,228 @@ const video3 = document.getElementById("video3");
$
(
'.page1'
).
show
();
preloadimages
(
preloadImageList
,
function
()
{},
function
(
progress
)
{});
$
(
document
).
ready
(
function
()
{
for
(
let
i
=
0
;
i
<
21
;
i
++
)
{
$
(
'.read'
+
i
).
hide
();
}
reading
=
getCookie
(
'reading'
);
if
(
reading
!=
null
)
{
readingJson
=
JSON
.
parse
(
reading
);
for
(
let
key
in
readingJson
)
{
$
(
'.read'
+
key
.
replace
(
/link/
,
""
)).
show
()
;
var
EventUtil
=
{
addHandler
:
function
(
element
,
type
,
handler
)
{
if
(
element
.
addEventListener
)
{
element
.
addEventListener
(
type
,
handler
,
false
);
}
else
if
(
element
.
attachEvent
)
{
element
.
attachEvent
(
"on"
+
type
,
handler
);
}
else
{
element
[
"on"
+
type
]
=
handler
;
}
}
};
(
function
()
{
var
showCount
=
0
;
EventUtil
.
addHandler
(
window
,
"load"
,
function
()
{});
EventUtil
.
addHandler
(
window
,
"pageshow"
,
function
(
event
)
{
showCount
++
;
alert
(
"Show has been fired "
+
showCount
+
" times."
);
});
video1
.
addEventListener
(
'pause'
,
function
()
{
if
(
video1
.
paused
&&
video2
.
paused
&&
video3
.
paused
)
{
$
(
'#music'
)[
0
].
play
();
}
});
video2
.
addEventListener
(
'pause'
,
function
()
{
if
(
video1
.
paused
&&
video2
.
paused
&&
video3
.
paused
)
{
$
(
'#music'
)[
0
].
play
();
}
});
$
(
document
).
ready
(
function
()
{
for
(
let
i
=
0
;
i
<
21
;
i
++
)
{
$
(
'.read'
+
i
).
hide
();
}
reading
=
getCookie
(
'reading'
);
if
(
reading
!=
null
)
{
readingJson
=
JSON
.
parse
(
reading
);
for
(
let
key
in
readingJson
)
{
$
(
'.read'
+
key
.
replace
(
/link/
,
""
)).
show
();
}
}
video3
.
addEventListener
(
'pause'
,
function
()
{
if
(
video1
.
paused
&&
video2
.
paused
&&
video3
.
paused
)
{
$
(
'#music'
)[
0
].
play
();
}
});
video1
.
addEventListener
(
'pause'
,
function
()
{
if
(
video1
.
paused
&&
video2
.
paused
&&
video3
.
paused
)
{
$
(
'#music'
)[
0
].
play
();
}
});
video1
.
addEventListener
(
'play'
,
function
()
{
play
=
'video1'
;
$
(
'#music'
)[
0
].
pause
();
video2
.
pause
();
videoBreak
=
true
;
video3
.
pause
();
video2
.
addEventListener
(
'pause'
,
function
()
{
if
(
video1
.
paused
&&
video2
.
paused
&&
video3
.
paused
)
{
$
(
'#music'
)[
0
].
play
();
}
});
});
video3
.
addEventListener
(
'pause'
,
function
()
{
if
(
video1
.
paused
&&
video2
.
paused
&&
video3
.
paused
)
{
$
(
'#music'
)[
0
].
play
();
}
});
video2
.
addEventListener
(
'play'
,
function
()
{
play
=
'video2'
;
$
(
'#music'
)[
0
].
pause
();
video1
.
pause
();
videoBreak
=
true
;
video3
.
pause
();
});
video1
.
addEventListener
(
'play'
,
function
()
{
play
=
'video1'
;
$
(
'#music'
)[
0
].
pause
();
video2
.
pause
();
videoBreak
=
true
;
video3
.
pause
();
video3
.
addEventListener
(
'play'
,
function
()
{
play
=
'video3'
;
$
(
'#music'
)[
0
].
pause
();
video1
.
pause
();
videoBreak
=
true
;
video2
.
pause
();
});
});
$
(
'.btn-clear'
).
on
(
'click'
,
function
()
{
setCookie
(
'reading'
,
'{}'
);
});
video2
.
addEventListener
(
'play'
,
function
()
{
play
=
'video2'
;
$
(
'#music'
)[
0
].
pause
();
video1
.
pause
();
videoBreak
=
true
;
video3
.
pause
();
});
$
(
'.link0'
).
on
(
'click'
,
{
link
:
linkAddress
.
link0
,
index
:
0
},
jumpTolink
);
$
(
'.link1'
).
on
(
'click'
,
{
link
:
linkAddress
.
link1
,
index
:
1
},
jumpTolink
);
$
(
'.link2'
).
on
(
'click'
,
{
link
:
linkAddress
.
link2
,
index
:
2
},
jumpTolink
);
$
(
'.link3'
).
on
(
'click'
,
{
link
:
linkAddress
.
link3
,
index
:
3
},
jumpTolink
);
$
(
'.link4'
).
on
(
'click'
,
{
link
:
linkAddress
.
link4
,
index
:
4
},
jumpTolink
);
$
(
'.link5'
).
on
(
'click'
,
{
link
:
linkAddress
.
link5
,
index
:
5
},
jumpTolink
);
$
(
'.link6'
).
on
(
'click'
,
{
link
:
linkAddress
.
link6
,
index
:
6
},
jumpTolink
);
$
(
'.link7'
).
on
(
'click'
,
{
link
:
linkAddress
.
link7
,
index
:
7
},
jumpTolink
);
$
(
'.link8'
).
on
(
'click'
,
{
link
:
linkAddress
.
link8
,
index
:
8
},
jumpTolink
);
$
(
'.link9'
).
on
(
'click'
,
{
link
:
linkAddress
.
link9
,
index
:
9
},
jumpTolink
);
$
(
'.link10'
).
on
(
'click'
,
{
link
:
linkAddress
.
link10
,
index
:
10
},
jumpTolink
);
$
(
'.link11'
).
on
(
'click'
,
{
link
:
linkAddress
.
link11
,
index
:
11
},
jumpTolink
);
$
(
'.link12'
).
on
(
'click'
,
{
link
:
linkAddress
.
link12
,
index
:
12
},
jumpTolink
);
$
(
'.link13'
).
on
(
'click'
,
{
link
:
linkAddress
.
link13
,
index
:
13
},
jumpTolink
);
$
(
'.link14'
).
on
(
'click'
,
{
link
:
linkAddress
.
link14
,
index
:
14
},
jumpTolink
);
$
(
'.link15'
).
on
(
'click'
,
{
link
:
linkAddress
.
link15
,
index
:
15
},
jumpTolink
);
$
(
'.link16'
).
on
(
'click'
,
{
link
:
linkAddress
.
link16
,
index
:
16
},
jumpTolink
);
$
(
'.link17'
).
on
(
'click'
,
{
link
:
linkAddress
.
link17
,
index
:
17
},
jumpTolink
);
$
(
'.link18'
).
on
(
'click'
,
{
link
:
linkAddress
.
link18
,
index
:
18
},
jumpTolink
);
$
(
'.link19'
).
on
(
'click'
,
{
link
:
linkAddress
.
link19
,
index
:
19
},
jumpTolink
);
$
(
'.link20'
).
on
(
'click'
,
{
link
:
linkAddress
.
link20
,
index
:
20
},
jumpTolink
);
});
function
jumpTolink
(
event
)
{
const
link
=
event
.
data
.
link
;
if
(
event
.
data
.
index
||
event
.
data
.
index
==
0
)
{
const
index
=
event
.
data
.
index
;
readingJson
[
'link'
+
index
]
=
1
;
setCookie
(
'reading'
,
JSON
.
stringify
(
readingJson
));
$
(
'.read'
+
index
).
show
();
}
setTimeout
(
function
()
{
window
.
location
.
href
=
link
;
},
100
);
video3
.
addEventListener
(
'play'
,
function
()
{
play
=
'video3'
;
$
(
'#music'
)[
0
].
pause
();
video1
.
pause
();
videoBreak
=
true
;
video2
.
pause
();
});
}
$
(
'.btn-clear'
).
on
(
'click'
,
function
()
{
setCookie
(
'reading'
,
'{}'
);
});
$
(
'.link0'
).
on
(
'click'
,
{
link
:
linkAddress
.
link0
,
index
:
0
},
jumpTolink
);
function
getTranslateDistance
(
cardinal
=
0
,
abs
=
false
)
{
var
wrapInnerTransform
=
$
(
'.wrap-inner'
).
css
(
'transform'
);
var
wrapInnertop
=
parseFloat
(
$
(
'.wrap-inner'
).
css
(
'top'
));
wrapInnerTransform
=
wrapInnerTransform
.
match
(
/^matrix
\(
1,
\s
0,
\s
0,
\s
1,
\s
0,
\s\-?(\d
+
)
/
);
wrapInnerTransform
=
parseFloat
(
wrapInnerTransform
[
1
]);
if
(
abs
)
{
var
wrapInnerjl
=
Math
.
abs
(
wrapInnertop
-
wrapInnerTransform
);
}
else
{
var
wrapInnerjl
=
wrapInnertop
-
wrapInnerTransform
;
}
$
(
'.link1'
).
on
(
'click'
,
{
link
:
linkAddress
.
link1
,
index
:
1
},
jumpTolink
);
$
(
'.link2'
).
on
(
'click'
,
{
link
:
linkAddress
.
link2
,
index
:
2
},
jumpTolink
);
$
(
'.link3'
).
on
(
'click'
,
{
link
:
linkAddress
.
link3
,
index
:
3
},
jumpTolink
);
$
(
'.link4'
).
on
(
'click'
,
{
link
:
linkAddress
.
link4
,
index
:
4
},
jumpTolink
);
$
(
'.link5'
).
on
(
'click'
,
{
link
:
linkAddress
.
link5
,
index
:
5
},
jumpTolink
);
$
(
'.link6'
).
on
(
'click'
,
{
link
:
linkAddress
.
link6
,
index
:
6
},
jumpTolink
);
$
(
'.link7'
).
on
(
'click'
,
{
link
:
linkAddress
.
link7
,
index
:
7
},
jumpTolink
);
$
(
'.link8'
).
on
(
'click'
,
{
link
:
linkAddress
.
link8
,
index
:
8
},
jumpTolink
);
$
(
'.link9'
).
on
(
'click'
,
{
link
:
linkAddress
.
link9
,
index
:
9
},
jumpTolink
);
$
(
'.link10'
).
on
(
'click'
,
{
link
:
linkAddress
.
link10
,
index
:
10
},
jumpTolink
);
$
(
'.link11'
).
on
(
'click'
,
{
link
:
linkAddress
.
link11
,
index
:
11
},
jumpTolink
);
$
(
'.link12'
).
on
(
'click'
,
{
link
:
linkAddress
.
link12
,
index
:
12
},
jumpTolink
);
$
(
'.link13'
).
on
(
'click'
,
{
link
:
linkAddress
.
link13
,
index
:
13
},
jumpTolink
);
$
(
'.link14'
).
on
(
'click'
,
{
link
:
linkAddress
.
link14
,
index
:
14
},
jumpTolink
);
$
(
'.link15'
).
on
(
'click'
,
{
link
:
linkAddress
.
link15
,
index
:
15
},
jumpTolink
);
$
(
'.link16'
).
on
(
'click'
,
{
link
:
linkAddress
.
link16
,
index
:
16
},
jumpTolink
);
$
(
'.link17'
).
on
(
'click'
,
{
link
:
linkAddress
.
link17
,
index
:
17
},
jumpTolink
);
$
(
'.link18'
).
on
(
'click'
,
{
link
:
linkAddress
.
link18
,
index
:
18
},
jumpTolink
);
$
(
'.link19'
).
on
(
'click'
,
{
link
:
linkAddress
.
link19
,
index
:
19
},
jumpTolink
);
$
(
'.link20'
).
on
(
'click'
,
{
link
:
linkAddress
.
link20
,
index
:
20
},
jumpTolink
);
});
return
wrapInnerjl
+
cardinal
+
'px'
;
}
function
jumpTolink
(
event
)
{
const
link
=
event
.
data
.
link
;
if
(
event
.
data
.
index
||
event
.
data
.
index
==
0
)
{
const
index
=
event
.
data
.
index
;
readingJson
[
'link'
+
index
]
=
1
;
setCookie
(
'reading'
,
JSON
.
stringify
(
readingJson
));
$
(
'.read'
+
index
).
show
();
}
setTimeout
(
function
()
{
window
.
location
.
href
=
link
;
},
100
);
//获取随机数方法
//min 最小值
//max 最大值
function
RandomNumBoth
(
Min
,
Max
)
{
var
Range
=
Max
-
Min
;
var
Rand
=
Math
.
random
();
var
num
=
Min
+
Math
.
round
(
Rand
*
Range
);
//四舍五入
return
num
;
}
}
//写cookies
function
setCookie
(
name
,
value
)
{
var
Days
=
30
;
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
+
Days
*
24
*
60
*
60
*
1000
);
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
exp
.
toGMTString
();
}
function
getTranslateDistance
(
cardinal
=
0
,
abs
=
false
)
{
var
wrapInnerTransform
=
$
(
'.wrap-inner'
).
css
(
'transform'
);
var
wrapInnertop
=
parseFloat
(
$
(
'.wrap-inner'
).
css
(
'top'
));
wrapInnerTransform
=
wrapInnerTransform
.
match
(
/^matrix
\(
1,
\s
0,
\s
0,
\s
1,
\s
0,
\s\-?(\d
+
)
/
);
wrapInnerTransform
=
parseFloat
(
wrapInnerTransform
[
1
]);
if
(
abs
)
{
var
wrapInnerjl
=
Math
.
abs
(
wrapInnertop
-
wrapInnerTransform
);
}
else
{
var
wrapInnerjl
=
wrapInnertop
-
wrapInnerTransform
;
}
return
wrapInnerjl
+
cardinal
+
'px'
;
}
//获取随机数方法
//min 最小值
//max 最大值
function
RandomNumBoth
(
Min
,
Max
)
{
var
Range
=
Max
-
Min
;
var
Rand
=
Math
.
random
();
var
num
=
Min
+
Math
.
round
(
Rand
*
Range
);
//四舍五入
return
num
;
}
//写cookies
function
setCookie
(
name
,
value
)
{
var
Days
=
30
;
var
exp
=
new
Date
();
exp
.
setTime
(
exp
.
getTime
()
+
Days
*
24
*
60
*
60
*
1000
);
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
exp
.
toGMTString
();
}
//读取cookies
function
getCookie
(
name
)
{
var
arr
,
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
//读取cookies
function
getCookie
(
name
)
{
var
arr
,
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
if
(
arr
=
document
.
cookie
.
match
(
reg
))
if
(
arr
=
document
.
cookie
.
match
(
reg
))
return
unescape
(
arr
[
2
]);
else
return
null
;
}
\ No newline at end of file
return
unescape
(
arr
[
2
]);
else
return
null
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment