Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大白技术控
yanglr2010
提交
1ab2fb6f
Y
yanglr2010
项目概览
大白技术控
/
yanglr2010
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yanglr2010
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1ab2fb6f
编写于
7月 18, 2019
作者:
EvanOne(文一)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
style: Format code with prettier & lint with standard rules
上级
67787f23
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
215 addition
and
168 deletion
+215
-168
source/js/algolia-search.js
source/js/algolia-search.js
+36
-29
source/js/copy.js
source/js/copy.js
+18
-14
source/js/header.js
source/js/header.js
+8
-6
source/js/post.js
source/js/post.js
+19
-14
source/js/scroll.js
source/js/scroll.js
+35
-21
source/js/sidebar.js
source/js/sidebar.js
+77
-70
source/js/utils.js
source/js/utils.js
+22
-14
未找到文件。
source/js/algolia-search.js
浏览文件 @
1ab2fb6f
$
(
document
).
ready
(
function
()
{
$
(
'
.header-nav-search
'
).
click
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'
.header-nav-search
'
).
click
(
function
()
{
$
(
'
body
'
).
css
(
'
overflow
'
,
'
hidden
'
);
$
(
'
.algolia-popup
'
).
velocity
(
'
stop
'
)
$
(
'
.algolia-popup
'
)
.
velocity
(
'
stop
'
)
.
velocity
(
'
transition.expandIn
'
,
{
duration
:
300
,
complete
:
function
()
{
$
(
'
.algolia-popup input
'
).
focus
()
$
(
'
.algolia-popup input
'
).
focus
()
;
}
})
$
(
'
.algolia-mask
'
).
velocity
(
'
stop
'
)
});
$
(
'
.algolia-mask
'
)
.
velocity
(
'
stop
'
)
.
velocity
(
'
transition.fadeIn
'
,
{
duration
:
300
})
});
});
$
(
'
.algolia-mask, .algolia-close
'
).
on
(
'
click
'
,
function
()
{
closeSearch
();
});
$
(
'
.algolia-mask, .algolia-close
'
)
.
on
(
'
click
'
,
function
()
{
closeSearch
();
});
$
(
document
).
on
(
'
keydown
'
,
function
(
e
)
{
var
e
=
e
||
window
.
event
;
var
e
v
=
e
||
window
.
event
;
// Escape <=> 27
if
(
e
.
keyCode
===
codeToKeyCode
(
'
Escape
'
))
{
if
(
e
v
.
keyCode
===
codeToKeyCode
(
'
Escape
'
))
{
closeSearch
();
}
});
var
algolia
=
CONFIG
.
algolia
;
if
(
!
(
algolia
.
appId
&&
algolia
.
apiKey
&&
algolia
.
indexName
))
{
return
console
.
error
(
'
Algolia setting is invalid.
'
);
}
...
...
@@ -65,19 +66,21 @@ $(document).ready(function() {
container
:
'
#algolia-hits
'
,
templates
:
{
item
:
function
(
data
)
{
var
link
=
data
.
permalink
?
data
.
permalink
:
(
CONFIG
.
root
+
data
.
path
)
var
link
=
data
.
permalink
?
data
.
permalink
:
CONFIG
.
root
+
data
.
path
;
return
(
'
<a href="
'
+
link
+
'
" class="algolia-hit-item-link">
'
+
'
<a href="
'
+
link
+
'
" class="algolia-hit-item-link">
'
+
data
.
_highlightResult
.
title
.
value
+
'
</a>
'
)
)
;
},
empty
:
function
(
data
)
{
return
(
'
<div id="algolia-hits-empty">
'
+
algolia
.
languages
.
hits_empty
.
replace
(
/
\$\{
query}/
,
data
.
query
)
+
'
</div>
'
)
)
;
}
},
cssClasses
:
{
...
...
@@ -85,9 +88,9 @@ $(document).ready(function() {
}
})
);
// The stats of search results.
if
(
!!
$
(
'
#algolia-stats
'
)[
0
])
{
if
(
$
(
'
#algolia-stats
'
)[
0
])
{
search
.
addWidget
(
instantsearch
.
widgets
.
stats
({
container
:
'
#algolia-stats
'
,
...
...
@@ -95,11 +98,13 @@ $(document).ready(function() {
body
:
function
(
data
)
{
var
stats
=
algolia
.
languages
.
hits_stats
.
replace
(
/
\$\{
hits}/
,
data
.
nbHits
)
.
replace
(
/
\$\{
time}/
,
data
.
processingTimeMS
)
.
replace
(
/
\$\{
time}/
,
data
.
processingTimeMS
)
;
return
(
stats
+
'
<span class="algolia-logo pull-right">
'
+
'
<img src="
'
+
CONFIG
.
root
+
'
images/algolia.svg" alt="Algolia" />
'
+
'
<img src="
'
+
CONFIG
.
root
+
'
images/algolia.svg" alt="Algolia" />
'
+
'
</span>
'
);
}
...
...
@@ -132,15 +137,17 @@ $(document).ready(function() {
search
.
start
();
function
closeSearch
()
{
function
closeSearch
()
{
$
(
'
body
'
).
css
(
'
overflow
'
,
'
auto
'
);
$
(
'
.algolia-popup
'
).
velocity
(
'
stop
'
)
$
(
'
.algolia-popup
'
)
.
velocity
(
'
stop
'
)
.
velocity
(
'
transition.expandOut
'
,
{
duration
:
300
})
$
(
'
.algolia-mask
'
).
velocity
(
'
stop
'
)
});
$
(
'
.algolia-mask
'
)
.
velocity
(
'
stop
'
)
.
velocity
(
'
transition.fadeOut
'
,
{
duration
:
300
})
})
;
}
});
source/js/copy.js
浏览文件 @
1ab2fb6f
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
test
()
{
var
CODEBLOCK_CLASS_NAME
=
'
highlight
'
;
var
$codeBlocks
=
$
(
'
figure.highlight
'
);
$codeBlocks
.
each
(
function
(
index
,
item
)
{
$codeBlocks
.
each
(
function
test
(
index
,
item
)
{
if
(
!
$
(
item
).
find
(
'
figcaption
'
)[
0
])
{
var
lang
=
item
.
getAttribute
(
'
class
'
)
.
split
(
/
\s
/
).
filter
(
e
=>
e
!==
CODEBLOCK_CLASS_NAME
);
var
lang
=
item
.
getAttribute
(
'
class
'
)
.
split
(
/
\s
/
)
.
filter
(
e
=>
e
!==
CODEBLOCK_CLASS_NAME
);
var
codeHeader
=
$
(
`
<figcaption class="custom">
<span>
${
lang
}
</span>
</figcaption>`
)[
0
];
item
.
insertBefore
(
codeHeader
,
$
(
item
).
find
(
'
table
'
)[
0
]);
}
});
...
...
@@ -19,12 +21,14 @@ $(document).ready(function() {
<div class="copy-button">
<i class="fa fa-clipboard"></i>
</div>`
);
$
(
'
figure.highlight figcaption
'
).
append
(
$copyIcon
);
$
(
'
.copy-button
'
).
on
(
'
click
'
,
function
()
{
var
codeContainer
=
$
(
this
).
parent
(
'
figcaption
'
)
.
siblings
(
'
table
'
).
find
(
'
td.code
'
)[
0
];
$
(
'
.copy-button
'
).
on
(
'
click
'
,
function
()
{
var
codeContainer
=
$
(
this
)
.
parent
(
'
figcaption
'
)
.
siblings
(
'
table
'
)
.
find
(
'
td.code
'
)[
0
];
if
(
copy
(
codeContainer
))
{
popAlert
(
'
success
'
,
'
复制成功
'
,
4
);
}
else
{
...
...
@@ -36,16 +40,16 @@ $(document).ready(function() {
* Copy code
* @param {HTMLElement} container Container of code.
*/
function
copy
(
container
)
{
function
copy
(
container
)
{
try
{
var
selection
=
window
.
getSelection
();
var
range
=
document
.
createRange
();
// Select text by the content of node.
range
.
selectNodeContents
(
container
);
selection
.
removeAllRanges
();
selection
.
addRange
(
range
);
var
text
=
selection
.
toString
();
var
input
=
document
.
createElement
(
'
input
'
);
...
...
source/js/header.js
浏览文件 @
1ab2fb6f
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
var
$menu
=
$
(
'
.header-nav-menu
'
);
$
(
document
).
click
(
function
()
{
$
(
document
).
click
(
function
()
{
$menu
.
removeClass
(
'
show
'
);
});
[
1
,
2
,
3
].
forEach
(
item
=>
item
);
$
(
'
.header-nav-menu a
'
).
click
(
function
(
e
)
{
var
e
=
e
||
window
.
event
;
e
.
stopPropagation
();
$
(
'
.header-nav-menu a
'
).
click
(
function
(
e
)
{
var
ev
=
e
||
window
.
event
;
ev
.
stopPropagation
();
});
$
(
'
.header-nav-menu-icon
'
).
click
(
function
()
{
$
(
'
.header-nav-menu-icon
'
).
click
(
function
()
{
$menu
.
toggleClass
(
'
show
'
);
return
false
;
...
...
source/js/post.js
浏览文件 @
1ab2fb6f
$
(
document
).
ready
(
function
()
{
$
(
'
img
'
).
each
(
function
(
index
,
img
)
{
$
(
document
).
ready
(
function
()
{
$
(
'
img
'
).
each
(
function
(
index
,
img
)
{
if
(
img
.
src
.
includes
(
'
?size=
'
))
{
var
size
=
img
.
src
.
split
(
'
?size=
'
)[
1
]
&&
img
.
src
.
split
(
'
?size=
'
)[
1
].
toLowerCase
();
var
size
=
img
.
src
.
split
(
'
?size=
'
)[
1
]
&&
img
.
src
.
split
(
'
?size=
'
)[
1
]
.
toLowerCase
();
var
w
=
size
.
split
(
'
x
'
)[
0
];
var
h
=
size
.
split
(
'
x
'
)[
1
];
...
...
@@ -11,26 +11,31 @@ $(document).ready(function() {
}
});
$
(
'
.reward-button
'
).
click
(
function
()
{
$
(
'
.reward-button
'
).
click
(
function
()
{
if
(
$
(
'
.reward-qr-wrapper
'
).
css
(
'
display
'
)
===
'
block
'
)
{
$
(
'
.reward-qr-wrapper
'
).
css
(
'
display
'
,
'
none
'
);
}
else
{
$
(
'
.reward-qr-wrapper
'
).
velocity
(
'
stop
'
)
$
(
'
.reward-qr-wrapper
'
)
.
velocity
(
'
stop
'
)
.
velocity
(
'
transition.slideDownBigIn
'
,
{
duration
:
300
});
}
});
$
(
document
).
on
(
'
keydown
'
,
function
(
e
)
{
var
e
=
e
||
window
.
event
;
$
(
document
).
on
(
'
keydown
'
,
function
(
e
)
{
var
e
v
=
e
||
window
.
event
;
// ArrowLeft <=> 37
if
(
e
.
keyCode
===
codeToKeyCode
(
'
ArrowLeft
'
))
{
$
(
'
.article-prev
'
).
find
(
'
a
'
)[
0
].
click
();
}
// ArrowRight <=> 39
else
if
(
e
.
keyCode
===
codeToKeyCode
(
'
ArrowRight
'
))
{
$
(
'
.article-next
'
).
find
(
'
a
'
)[
0
].
click
();
if
(
ev
.
keyCode
===
codeToKeyCode
(
'
ArrowLeft
'
))
{
// ArrowLeft <=> 37
$
(
'
.article-prev
'
)
.
find
(
'
a
'
)[
0
]
.
click
();
}
else
if
(
ev
.
keyCode
===
codeToKeyCode
(
'
ArrowRight
'
))
{
// ArrowRight <=> 39
$
(
'
.article-next
'
)
.
find
(
'
a
'
)[
0
]
.
click
();
}
});
});
source/js/scroll.js
浏览文件 @
1ab2fb6f
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
// The previous distance from the page to the top.
var
prevScrollTop
=
0
;
// Initial run.
headerNavScroll
();
backToTop
();
$
(
window
).
scroll
(
throttle
(
function
()
{
headerNavScroll
();
backToTop
();
},
20
,
100
));
$
(
window
).
scroll
(
throttle
(
function
()
{
headerNavScroll
();
backToTop
();
},
20
,
100
)
);
// Click the heading.
$
(
'
.main-content
'
)
.
find
(
'
h1,h2,h3,h4,h5,h6
'
)
.
on
(
'
click
'
,
function
()
{
scrollHeadingToTop
(
'
#
'
+
$
(
this
).
attr
(
'
id
'
))
scrollHeadingToTop
(
'
#
'
+
$
(
this
).
attr
(
'
id
'
))
;
});
// Click the post toc.
$
(
'
.toc-link
'
).
on
(
'
click
'
,
function
(
e
)
{
e
.
preventDefault
()
;
var
ev
=
e
||
window
.
event
;
ev
.
preventDefault
();
scrollHeadingToTop
(
$
(
this
).
attr
(
'
href
'
));
});
$
(
'
#back-top
'
).
click
(
function
()
{
$
(
'
body
'
).
velocity
(
'
stop
'
)
$
(
'
body
'
)
.
velocity
(
'
stop
'
)
.
velocity
(
'
scroll
'
,
{
duration
:
500
,
easing
:
'
easeOutQuart
'
});
if
(
CONFIG
.
back2top_animation
)
{
$
(
'
#back-top
'
).
velocity
({
translateY
:
'
-100vh
'
,
},
{
duration
:
500
}).
velocity
(
'
reverse
'
,
{
duration
:
10
});
$
(
'
#back-top
'
)
.
velocity
(
{
translateY
:
'
-100vh
'
},
{
duration
:
500
}
)
.
velocity
(
'
reverse
'
,
{
duration
:
10
});
}
});
function
headerNavScroll
()
{
function
headerNavScroll
()
{
var
scrollTop
=
$
(
window
).
scrollTop
();
var
delta
=
scrollTop
-
prevScrollTop
;
...
...
@@ -70,15 +83,16 @@ $(document).ready(function() {
prevScrollTop
=
scrollTop
;
}
function
scrollHeadingToTop
(
anchor
)
{
$
(
anchor
).
velocity
(
'
stop
'
)
function
scrollHeadingToTop
(
anchor
)
{
$
(
anchor
)
.
velocity
(
'
stop
'
)
.
velocity
(
'
scroll
'
,
{
duration
:
500
,
easing
:
'
easeOutSine
'
});
}
function
backToTop
()
{
function
backToTop
()
{
var
scrollTop
=
$
(
window
).
scrollTop
();
if
(
scrollTop
!==
0
)
{
...
...
source/js/sidebar.js
浏览文件 @
1ab2fb6f
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
var
$toc
=
$
(
'
.sidebar-toc
'
);
var
$view
=
$
(
'
.sidebar-overview
'
);
// The heading that reached the top currently.
var
currHeading
=
null
;
// The heading that reached the top last time.
...
...
@@ -11,14 +11,13 @@ $(document).ready(function() {
var
isTocScroll
=
false
;
// Distance from sidebar to top.
var
SIDEBAR_STICKY_TOP
=
parseInt
(
CONFIG
.
sidebar_offsetTop
);
var
SIDEBAR_STICKY_TOP
=
parseInt
(
CONFIG
.
sidebar_offsetTop
);
// Is toc in anime.
var
isAnime
=
false
;
// Is toc in max heihgt.
var
isMaxH
=
true
;
// Initial run
autoSpreadToc
();
scrollTocToMiddle
();
...
...
@@ -33,14 +32,14 @@ $(document).ready(function() {
sidebarSticky
();
sidebarAdjustHeight
();
});
$
(
'
.sidebar-nav-toc
'
).
click
(
function
()
{
$
(
'
.sidebar-nav-toc
'
).
toggleClass
(
'
current
'
);
$
(
'
.sidebar-nav-overview
'
).
toggleClass
(
'
current
'
);
$toc
.
css
(
'
display
'
,
'
block
'
);
$toc
.
velocity
(
'
fadeIn
'
);
$view
.
css
(
'
display
'
,
'
none
'
);
$view
.
velocity
(
'
fadeOut
'
);
});
...
...
@@ -56,34 +55,36 @@ $(document).ready(function() {
$view
.
velocity
(
'
fadeIn
'
);
});
if
(
$
(
'
.main-content, .main-content-layout
'
).
height
()
<
$
(
'
#sidebar
'
).
height
())
{
if
(
$
(
'
.main-content, .main-content-layout
'
).
height
()
<
$
(
'
#sidebar
'
).
height
()
)
{
$
(
'
#main
'
).
css
(
'
min-height
'
,
$
(
'
#main
'
).
height
());
}
// Automatically expand items in the article directory
// based on the scrolling of heading in the article.
function
autoSpreadToc
()
{
function
autoSpreadToc
()
{
var
$postBody
=
$
(
'
.post-body
'
);
var
$firsetChild
=
$postBody
.
find
(
'
h1,h2,h3,h4,h5,h6
'
).
first
();
// All heading are not to the top.
if
(
$postBody
[
0
]
&&
(
!!
$firsetChild
[
0
]
&&
$firsetChild
.
offset
().
top
-
$
(
window
).
scrollTop
()
>
0
))
{
if
(
$postBody
[
0
]
&&
(
!!
$firsetChild
[
0
]
&&
$firsetChild
.
offset
().
top
-
$
(
window
).
scrollTop
()
>
0
)
)
{
$
(
'
.sidebar-toc li
'
).
removeClass
(
'
active current
'
);
return
;
}
$postBody
.
find
(
'
h1,h2,h3,h4,h5,h6
'
)
.
each
(
function
(
index
,
item
)
{
if
(
item
&&
(
item
.
getBoundingClientRect
().
top
<
0
))
{
currHeading
=
$
(
item
).
attr
(
'
id
'
);
}
});
$postBody
.
find
(
'
h1,h2,h3,h4,h5,h6
'
).
each
(
function
(
index
,
item
)
{
if
(
item
&&
item
.
getBoundingClientRect
().
top
<
0
)
{
currHeading
=
$
(
item
).
attr
(
'
id
'
);
}
});
if
(
currHeading
===
lastHeading
)
{
return
;
}
else
{
var
targetLink
=
$
(
`.sidebar-toc a[href="#
${
currHeading
}
"]`
);
...
...
@@ -100,32 +101,30 @@ $(document).ready(function() {
}
// Scroll the post toc to the middle.
function
scrollTocToMiddle
()
{
function
scrollTocToMiddle
()
{
var
$toc
=
$
(
'
.sidebar-toc
'
);
var
$currLink
=
$
(
'
.sidebar-toc .current a
'
);
if
(
$currLink
[
0
]
&&
$toc
[
0
])
{
var
tocTop
=
$currLink
.
offset
().
top
-
$toc
.
offset
().
top
;
isTocScroll
=
(
tocTop
>
$toc
.
height
()
||
tocTop
<
0
)
?
true
:
false
;
isTocScroll
=
!!
(
tocTop
>
$toc
.
height
()
||
tocTop
<
0
);
}
if
(
isTocScroll
)
{
$currLink
.
velocity
(
'
stop
'
)
.
velocity
(
'
scroll
'
,
{
container
:
$toc
,
offset
:
-
(
$toc
.
height
()
/
2
),
duration
:
500
,
easing
:
'
easeOutQuart
'
});
$currLink
.
velocity
(
'
stop
'
).
velocity
(
'
scroll
'
,
{
container
:
$toc
,
offset
:
-
(
$toc
.
height
()
/
2
),
duration
:
500
,
easing
:
'
easeOutQuart
'
});
}
}
// Sticky the sidebar when it arrived the top.
function
sidebarSticky
()
{
function
sidebarSticky
()
{
var
mainInner
=
$
(
'
.main-inner
'
)[
0
];
if
(
mainInner
)
{
var
targetY
=
mainInner
.
getBoundingClientRect
().
top
;
...
...
@@ -138,50 +137,58 @@ $(document).ready(function() {
}
// Auto adjust the height of sidebar when it arrive footer.
function
sidebarAdjustHeight
()
{
var
footerTop
=
$
(
'
#footer
'
).
offset
().
top
function
sidebarAdjustHeight
()
{
var
footerTop
=
$
(
'
#footer
'
).
offset
().
top
;
var
footerH
=
$
(
'
#footer
'
)[
0
].
getBoundingClientRect
().
height
;
var
sidebarTop
=
$
(
'
.sidebar-inner
'
).
offset
().
top
var
sidebarTop
=
$
(
'
.sidebar-inner
'
).
offset
().
top
;
var
sidebarH
=
$
(
'
.sidebar-inner
'
)[
0
].
getBoundingClientRect
().
height
;
if
(
!
isAnime
&&
sidebarTop
+
sidebarH
>
footerTop
)
{
var
targetTocH
=
parseInt
(
$
(
'
.sidebar-toc
'
).
css
(
'
max-height
'
))
-
footerH
;
var
targetTocH
=
parseInt
(
$
(
'
.sidebar-toc
'
).
css
(
'
max-height
'
))
-
footerH
;
isAnime
=
true
;
$
(
'
.sidebar-toc
'
).
velocity
({
maxHeight
:
targetTocH
},
{
duration
:
300
,
complete
:
function
()
{
isAnime
=
false
;
isMaxH
=
false
;
$
(
'
.sidebar-toc
'
).
velocity
(
{
maxHeight
:
targetTocH
},
{
duration
:
300
,
complete
:
function
()
{
isAnime
=
false
;
isMaxH
=
false
;
}
}
});
}
else
if
(
!
isMaxH
&&
!
isAnime
&&
$
(
window
).
height
()
<
$
(
'
#footer
'
)[
0
].
getBoundingClientRect
().
top
)
{
);
}
else
if
(
!
isMaxH
&&
!
isAnime
&&
$
(
window
).
height
()
<
$
(
'
#footer
'
)[
0
].
getBoundingClientRect
().
top
)
{
isAnime
=
true
;
$
(
'
.sidebar-toc
'
).
velocity
({
maxHeight
:
'
70vh
'
},
{
duration
:
240
,
complete
:
function
()
{
isAnime
=
false
;
isMaxH
=
true
;
$
(
'
.sidebar-toc
'
).
velocity
(
{
maxHeight
:
'
70vh
'
},
{
duration
:
240
,
complete
:
function
()
{
isAnime
=
false
;
isMaxH
=
true
;
}
}
}
);
);
}
}
// Update the reading progress lines of post.
function
readProgress
()
{
function
readProgress
()
{
var
$post
=
$
(
'
.main-content
'
);
var
scrollH
=
(
$post
[
0
]
&&
$post
[
0
].
getBoundingClientRect
().
top
*
-
1
)
||
0
;
var
percent
=
parseInt
((
scrollH
/
Math
.
abs
((
$post
.
height
()
-
$
(
window
).
height
())))
*
100
);
var
scrollH
=
(
$post
[
0
]
&&
$post
[
0
].
getBoundingClientRect
().
top
*
-
1
)
||
0
;
var
percent
=
parseInt
(
(
scrollH
/
Math
.
abs
(
$post
.
height
()
-
$
(
window
).
height
()))
*
100
);
percent
=
percent
>
100
?
100
:
percent
<
0
?
0
:
percent
;
percent
+=
'
%
'
;
...
...
source/js/utils.js
浏览文件 @
1ab2fb6f
...
...
@@ -51,8 +51,14 @@ function throttle(func, wait, mustRun) {
function
isMobile
()
{
var
check
=
false
;
(
function
(
a
)
{
if
(
/
(
android|bb
\d
+|meego
)
.+mobile|avantgo|bada
\/
|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip
(
hone|od
)
|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m
(
ob|in
)
i|palm
(
os
)?
|phone|p
(
ixi|re
)\/
|plucker|pocket|psp|series
(
4|6
)
0|symbian|treo|up
\.(
browser|link
)
|vodafone|wap|windows ce|xda|xiino/i
.
test
(
a
)
||
/1207|6310|6590|3gso|4thp|50
[
1-6
]
i|770s|802s|a wa|abac|ac
(
er|oo|s
\-)
|ai
(
ko|rn
)
|al
(
av|ca|co
)
|amoi|an
(
ex|ny|yw
)
|aptu|ar
(
ch|go
)
|as
(
te|us
)
|attw|au
(
di|
\-
m|r |s
)
|avan|be
(
ck|ll|nq
)
|bi
(
lb|rd
)
|bl
(
ac|az
)
|br
(
e|v
)
w|bumb|bw
\-(
n|u
)
|c55
\/
|capi|ccwa|cdm
\-
|cell|chtm|cldc|cmd
\-
|co
(
mp|nd
)
|craw|da
(
it|ll|ng
)
|dbte|dc
\-
s|devi|dica|dmob|do
(
c|p
)
o|ds
(
12|
\-
d
)
|el
(
49|ai
)
|em
(
l2|ul
)
|er
(
ic|k0
)
|esl8|ez
([
4-7
]
0|os|wa|ze
)
|fetc|fly
(\-
|_
)
|g1 u|g560|gene|gf
\-
5|g
\-
mo|go
(\.
w|od
)
|gr
(
ad|un
)
|haie|hcit|hd
\-(
m|p|t
)
|hei
\-
|hi
(
pt|ta
)
|hp
(
i|ip
)
|hs
\-
c|ht
(
c
(\-
| |_|a|g|p|s|t
)
|tp
)
|hu
(
aw|tc
)
|i
\-(
20|go|ma
)
|i230|iac
(
|
\-
|
\/)
|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja
(
t|v
)
a|jbro|jemu|jigs|kddi|keji|kgt
(
|
\/)
|klon|kpt |kwc
\-
|kyo
(
c|k
)
|le
(
no|xi
)
|lg
(
g|
\/(
k|l|u
)
|50|54|
\-[
a-w
])
|libw|lynx|m1
\-
w|m3ga|m50
\/
|ma
(
te|ui|xo
)
|mc
(
01|21|ca
)
|m
\-
cr|me
(
rc|ri
)
|mi
(
o8|oa|ts
)
|mmef|mo
(
01|02|bi|de|do|t
(\-
| |o|v
)
|zz
)
|mt
(
50|p1|v
)
|mwbp|mywa|n10
[
0-2
]
|n20
[
2-3
]
|n30
(
0|2
)
|n50
(
0|2|5
)
|n7
(
0
(
0|1
)
|10
)
|ne
((
c|m
)\-
|on|tf|wf|wg|wt
)
|nok
(
6|i
)
|nzph|o2im|op
(
ti|wv
)
|oran|owg1|p800|pan
(
a|d|t
)
|pdxg|pg
(
13|
\-([
1-8
]
|c
))
|phil|pire|pl
(
ay|uc
)
|pn
\-
2|po
(
ck|rt|se
)
|prox|psio|pt
\-
g|qa
\-
a|qc
(
07|12|21|32|60|
\-[
2-7
]
|i
\-)
|qtek|r380|r600|raks|rim9|ro
(
ve|zo
)
|s55
\/
|sa
(
ge|ma|mm|ms|ny|va
)
|sc
(
01|h
\-
|oo|p
\-)
|sdk
\/
|se
(
c
(\-
|0|1
)
|47|mc|nd|ri
)
|sgh
\-
|shar|sie
(\-
|m
)
|sk
\-
0|sl
(
45|id
)
|sm
(
al|ar|b3|it|t5
)
|so
(
ft|ny
)
|sp
(
01|h
\-
|v
\-
|v
)
|sy
(
01|mb
)
|t2
(
18|50
)
|t6
(
00|10|18
)
|ta
(
gt|lk
)
|tcl
\-
|tdg
\-
|tel
(
i|m
)
|tim
\-
|t
\-
mo|to
(
pl|sh
)
|ts
(
70|m
\-
|m3|m5
)
|tx
\-
9|up
(\.
b|g1|si
)
|utst|v400|v750|veri|vi
(
rg|te
)
|vk
(
40|5
[
0-3
]
|
\-
v
)
|vm40|voda|vulc|vx
(
52|53|60|61|70|80|81|83|85|98
)
|w3c
(\-
|
)
|webc|whit|wi
(
g |nc|nw
)
|wmlb|wonu|x700|yas
\-
|your|zeto|zte
\-
/i
.
test
(
a
.
substr
(
0
,
4
)))
if
(
/
(
android|bb
\d
+|meego
)
.+mobile|avantgo|bada
\/
|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip
(
hone|od
)
|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m
(
ob|in
)
i|palm
(
os
)?
|phone|p
(
ixi|re
)\/
|plucker|pocket|psp|series
(
4|6
)
0|symbian|treo|up
\.(
browser|link
)
|vodafone|wap|windows ce|xda|xiino/i
.
test
(
a
)
||
/1207|6310|6590|3gso|4thp|50
[
1-6
]
i|770s|802s|a wa|abac|ac
(
er|oo|s
\-)
|ai
(
ko|rn
)
|al
(
av|ca|co
)
|amoi|an
(
ex|ny|yw
)
|aptu|ar
(
ch|go
)
|as
(
te|us
)
|attw|au
(
di|
\-
m|r |s
)
|avan|be
(
ck|ll|nq
)
|bi
(
lb|rd
)
|bl
(
ac|az
)
|br
(
e|v
)
w|bumb|bw
\-(
n|u
)
|c55
\/
|capi|ccwa|cdm
\-
|cell|chtm|cldc|cmd
\-
|co
(
mp|nd
)
|craw|da
(
it|ll|ng
)
|dbte|dc
\-
s|devi|dica|dmob|do
(
c|p
)
o|ds
(
12|
\-
d
)
|el
(
49|ai
)
|em
(
l2|ul
)
|er
(
ic|k0
)
|esl8|ez
([
4-7
]
0|os|wa|ze
)
|fetc|fly
(\-
|_
)
|g1 u|g560|gene|gf
\-
5|g
\-
mo|go
(\.
w|od
)
|gr
(
ad|un
)
|haie|hcit|hd
\-(
m|p|t
)
|hei
\-
|hi
(
pt|ta
)
|hp
(
i|ip
)
|hs
\-
c|ht
(
c
(\-
| |_|a|g|p|s|t
)
|tp
)
|hu
(
aw|tc
)
|i
\-(
20|go|ma
)
|i230|iac
(
|
\-
|
\/)
|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja
(
t|v
)
a|jbro|jemu|jigs|kddi|keji|kgt
(
|
\/)
|klon|kpt |kwc
\-
|kyo
(
c|k
)
|le
(
no|xi
)
|lg
(
g|
\/(
k|l|u
)
|50|54|
\-[
a-w
])
|libw|lynx|m1
\-
w|m3ga|m50
\/
|ma
(
te|ui|xo
)
|mc
(
01|21|ca
)
|m
\-
cr|me
(
rc|ri
)
|mi
(
o8|oa|ts
)
|mmef|mo
(
01|02|bi|de|do|t
(\-
| |o|v
)
|zz
)
|mt
(
50|p1|v
)
|mwbp|mywa|n10
[
0-2
]
|n20
[
2-3
]
|n30
(
0|2
)
|n50
(
0|2|5
)
|n7
(
0
(
0|1
)
|10
)
|ne
((
c|m
)\-
|on|tf|wf|wg|wt
)
|nok
(
6|i
)
|nzph|o2im|op
(
ti|wv
)
|oran|owg1|p800|pan
(
a|d|t
)
|pdxg|pg
(
13|
\-([
1-8
]
|c
))
|phil|pire|pl
(
ay|uc
)
|pn
\-
2|po
(
ck|rt|se
)
|prox|psio|pt
\-
g|qa
\-
a|qc
(
07|12|21|32|60|
\-[
2-7
]
|i
\-)
|qtek|r380|r600|raks|rim9|ro
(
ve|zo
)
|s55
\/
|sa
(
ge|ma|mm|ms|ny|va
)
|sc
(
01|h
\-
|oo|p
\-)
|sdk
\/
|se
(
c
(\-
|0|1
)
|47|mc|nd|ri
)
|sgh
\-
|shar|sie
(\-
|m
)
|sk
\-
0|sl
(
45|id
)
|sm
(
al|ar|b3|it|t5
)
|so
(
ft|ny
)
|sp
(
01|h
\-
|v
\-
|v
)
|sy
(
01|mb
)
|t2
(
18|50
)
|t6
(
00|10|18
)
|ta
(
gt|lk
)
|tcl
\-
|tdg
\-
|tel
(
i|m
)
|tim
\-
|t
\-
mo|to
(
pl|sh
)
|ts
(
70|m
\-
|m3|m5
)
|tx
\-
9|up
(\.
b|g1|si
)
|utst|v400|v750|veri|vi
(
rg|te
)
|vk
(
40|5
[
0-3
]
|
\-
v
)
|vm40|voda|vulc|vx
(
52|53|60|61|70|80|81|83|85|98
)
|w3c
(\-
|
)
|webc|whit|wi
(
g |nc|nw
)
|wmlb|wonu|x700|yas
\-
|your|zeto|zte
\-
/i
.
test
(
a
.
substr
(
0
,
4
)
)
)
check
=
true
;
})(
navigator
.
userAgent
||
navigator
.
vendor
||
window
.
opera
);
return
check
;
...
...
@@ -64,9 +70,9 @@ function isMobile() {
*/
function
codeToKeyCode
(
code
)
{
var
codes
=
{
'
ArrowLeft
'
:
37
,
'
ArrowRight
'
:
39
,
'
Escape
'
:
27
ArrowLeft
:
37
,
ArrowRight
:
39
,
Escape
:
27
};
return
codes
[
code
];
...
...
@@ -80,12 +86,12 @@ function codeToKeyCode(code) {
*/
function
popAlert
(
status
,
text
,
delay
)
{
var
icon
=
{
'
success
'
:
'
check-circle
'
,
'
info
'
:
'
exclamation-circle
'
,
'
warning
'
:
'
exclamation-circle
'
,
'
error
'
:
'
times-circle
'
success
:
'
check-circle
'
,
info
:
'
exclamation-circle
'
,
warning
:
'
exclamation-circle
'
,
error
:
'
times-circle
'
};
if
(
!
$
(
'
.stun-alert
'
)[
0
])
{
var
$alert
=
$
(
`
<div class="stun-message">
...
...
@@ -95,21 +101,23 @@ function popAlert(status, text, delay) {
</div>
</div>
`
);
$
(
'
body
'
).
append
(
$alert
);
}
$
(
document
).
ready
(
function
()
{
$
(
'
.stun-alert
'
).
velocity
(
'
stop
'
)
$
(
'
.stun-alert
'
)
.
velocity
(
'
stop
'
)
.
velocity
(
'
transition.slideDownBigIn
'
,
{
duration
:
300
}).
velocity
(
'
reverse
'
,
{
})
.
velocity
(
'
reverse
'
,
{
delay
:
delay
*
1000
||
5000
,
duration
:
260
,
complete
:
function
()
{
$
(
'
.stun-alert
'
).
css
(
'
display
'
,
'
none
'
);
}
})
})
;
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录