Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
aeb81059
Unverified
Commit
aeb81059
authored
Jan 12, 2020
by
Liang Ding
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
324e6fc6
3ff1550d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
src/main/resources/js/common.js
src/main/resources/js/common.js
+2
-1
src/main/resources/js/common.min.js
src/main/resources/js/common.min.js
+1
-1
No files found.
src/main/resources/js/common.js
View file @
aeb81059
...
...
@@ -20,7 +20,7 @@
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.0.
0.0, Jan 5
, 2020
* @version 2.0.
1.0, Jan 12
, 2020
*/
/**
...
...
@@ -107,6 +107,7 @@ var Util = {
callback
:
function
()
{
Util
.
parseMarkdown
()
Util
.
parseLanguage
()
Util
.
uvstat
.
addStat
()
Util
.
uvstat
.
renderStat
()
cb
&&
cb
()
},
...
...
src/main/resources/js/common.min.js
View file @
aeb81059
var
Util
=
{
uvstat
:
void
0
,
initViewCnt
:
function
(){
Util
.
uvstat
=
new
Uvstat
,
Util
.
uvstat
.
addStat
(),
Util
.
uvstat
.
renderStat
()},
isArticlePage
:
function
(
e
){
var
t
=!
0
;
return
e
.
indexOf
(
Label
.
servePath
+
"
/tags/
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/tags.html
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/category/
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/archives.html
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/archives/
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/links.html
"
)
>-
1
&&
(
t
=!
1
),
e
===
Label
.
servePath
&&
(
t
=!
1
),
/^
[
0-9
]
*$/
.
test
(
e
.
replace
(
Label
.
servePath
+
"
/
"
,
""
))
&&
(
t
=!
1
),
t
},
initPjax
:
function
(
e
){
1
===
$
(
"
#pjax
"
).
length
&&
(
$
.
pjax
({
selector
:
"
a
"
,
container
:
"
#pjax
"
,
show
:
""
,
cache
:
!
1
,
storage
:
!
0
,
titleSuffix
:
""
,
filter
:
function
(
e
,
t
){
return
!
e
||
(
"
_blank
"
===
t
.
getAttribute
(
"
target
"
)
||
(
e
===
Label
.
servePath
+
"
/rss.xml
"
||
e
.
indexOf
(
Label
.
servePath
+
"
/admin-index.do
"
)
>-
1
||
(
0
===
e
.
indexOf
(
"
#
"
)
||!
(
t
.
href
.
indexOf
(
Label
.
servePath
)
>-
1
))))},
callback
:
function
(){
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
Util
.
uvstat
.
renderStat
(),
e
&&
e
()}}),
NProgress
.
configure
({
showSpinner
:
!
1
}),
$
(
"
#pjax
"
).
bind
(
"
pjax.start
"
,(
function
(){
NProgress
.
start
()})),
$
(
"
#pjax
"
).
bind
(
"
pjax.end
"
,(
function
(){
window
.
scroll
(
window
.
scrollX
,
0
),
NProgress
.
done
()})))},
previewImg
:
function
(){
$
(
"
body
"
).
on
(
"
click
"
,
"
.vditor-reset img
"
,(
function
(){
$
(
this
).
hasClass
(
"
prevent
"
)
||
window
.
open
(
this
.
src
)}))},
addStyle
:
function
(
e
,
t
){
if
(
!
document
.
getElementById
(
t
)){
var
i
=
document
.
createElement
(
"
link
"
);
i
.
id
=
t
,
i
.
setAttribute
(
"
rel
"
,
"
stylesheet
"
),
i
.
setAttribute
(
"
type
"
,
"
text/css
"
),
i
.
setAttribute
(
"
href
"
,
e
),
document
.
getElementsByTagName
(
"
head
"
)[
0
].
appendChild
(
i
)}},
addScript
:
function
(
e
,
t
){
if
(
!
document
.
getElementById
(
t
)){
var
i
=
new
XMLHttpRequest
;
i
.
open
(
"
GET
"
,
e
,
!
1
),
i
.
setRequestHeader
(
"
Accept
"
,
"
text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01
"
),
i
.
send
(
""
);
var
n
=
document
.
createElement
(
"
script
"
);
n
.
id
=
t
,
n
.
type
=
"
text/javascript
"
,
n
.
text
=
i
.
responseText
,
document
.
getElementsByTagName
(
"
head
"
)[
0
].
appendChild
(
n
)}},
parseLanguage
:
function
(){
Vditor
.
highlightRender
({
style
:
Label
.
hljsStyle
,
enable
:
!
Label
.
luteAvailable
},
document
)},
parseMarkdown
:
function
(){
"
undefined
"
==
typeof
Vditor
&&
Util
.
addScript
(
"
https://cdn.jsdelivr.net/npm/vditor@2.0.15/dist/method.min.js
"
,
"
vditorPreviewScript
"
),
Vditor
.
codeRender
(
document
.
body
,
Label
.
langLabel
),
Label
.
luteAvailable
?
Vditor
.
mathRenderByLute
(
document
.
body
):
Vditor
.
mathRender
(
document
.
body
),
Vditor
.
abcRender
(),
Vditor
.
chartRender
(),
Vditor
.
mediaRender
(
document
.
body
),
Vditor
.
mermaidRender
(
document
.
body
),
document
.
querySelectorAll
(
"
.vditor-reset
"
).
forEach
(
e
=>
{
Vditor
.
speechRender
(
e
,
Label
.
langLabel
)})},
killIE
:
function
(
e
){
var
t
=
navigator
.
userAgent
.
split
(
"
MSIE
"
)[
1
];
t
&&
(
e
||
(
e
=
7
),
parseFloat
(
t
.
split
(
"
;
"
))
<=
e
&&
function
(){
try
{
var
e
=
'
<div class="killIEIframe" style=
\'
display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110
\'
></div><iframe class="killIEIframe" style=
\'
left:
'
+
(
$
(
window
).
width
()
-
781
)
/
2
+
"
px;z-index:120;top:
"
+
(
$
(
window
).
height
()
-
680
)
/
2
+
"
px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='
"
+
Label
.
servePath
+
"
/kill-browser'></iframe>
"
;
$
(
"
body
"
).
append
(
e
)}
catch
(
t
){
e
=
'
<div class="killIEIframe" style=
\'
display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110
\'
></div><iframe class="killIEIframe" style=
\'
left:
'
+
10
+
"
px;z-index:120;top:
"
+
0
+
"
px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='
"
+
Label
.
servePath
+
"
/kill-browser'></iframe>
"
;
document
.
body
.
innerHTML
=
document
.
body
.
innerHTML
+
e
}}())},
setTopBar
:
function
(){
var
e
=
$
(
"
#top
"
);
if
(
1
===
e
.
length
){
var
t
=
$
(
"
#showTop
"
);
t
.
click
((
function
(){
e
.
slideDown
(),
t
.
hide
()})),
$
(
"
#hideTop
"
).
click
((
function
(){
e
.
slideUp
(),
t
.
show
()}))}},
goTop
:
function
(){
$
(
"
html, body
"
).
animate
({
scrollTop
:
0
},
800
)},
goBottom
:
function
(
e
){
e
||
(
e
=
0
),
$
(
"
html, body
"
).
animate
({
scrollTop
:
$
(
document
).
height
()
-
$
(
window
).
height
()
-
e
},
800
)},
init
:
function
(){
Util
.
killIE
(),
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
Util
.
initSW
(),
Util
.
previewImg
(),
Util
.
initDebugInfo
(),
Util
.
initViewCnt
()},
initDebugInfo
:
function
(){
console
.
log
(
"
%cSolo%c
\n
\
ud83c
\
udfb8
\
u4e00
\
u6b3e
\
u5c0f
\
u800c
\
u7f8e
\
u7684
\
u535a
\
u5ba2
\
u7cfb
\
u7edf
\
uff0c
\
u4e13
\
u4e3a
\
u7a0b
\
u5e8f
\
u5458
\
u8bbe
\
u8ba1
\
u3002
\n\n
solo.b3log.org v
"
+
Label
.
version
+
"
\n
Copyright
\
xa9 2010-present
"
,
"
font-size:96px;color:#3b3e43
"
,
"
font-size:12px;color:#4285f4;
"
)},
initSW
:
function
(){
navigator
.
serviceWorker
&&
navigator
.
serviceWorker
.
register
(
"
/sw.js
"
,{
scope
:
"
/
"
})},
buildTags
:
function
(
e
){
e
=
e
||
"
tags
"
;
for
(
var
t
=
[
"
tags1
"
,
"
tags2
"
,
"
tags3
"
,
"
tags4
"
,
"
tags5
"
],
i
=
$
(
"
#
"
+
e
+
"
b
"
).
get
(),
n
=
parseInt
(
$
(
"
#
"
+
e
+
"
b
"
).
last
().
text
()),
a
=
Math
.
ceil
(
n
/
t
.
length
),
r
=
0
;
r
<
i
.
length
;
r
++
)
for
(
var
o
=
parseInt
(
i
[
r
].
innerHTML
),
l
=
0
;
l
<
t
.
length
;
l
++
)
if
(
o
>
l
*
a
&&
o
<=
(
l
+
1
)
*
a
){
i
[
r
].
parentNode
.
className
=
t
[
l
];
break
}
$
(
"
#
"
+
e
).
html
(
$
(
"
#
"
+
e
+
"
li
"
).
get
().
sort
((
function
(
e
,
t
){
var
i
=
$
(
e
).
find
(
"
span
"
).
text
().
toLowerCase
(),
n
=
$
(
t
).
find
(
"
span
"
).
text
().
toLowerCase
();
return
i
.
localeCompare
(
n
)})))}};
\ No newline at end of file
var
Util
=
{
uvstat
:
void
0
,
initViewCnt
:
function
(){
Util
.
uvstat
=
new
Uvstat
,
Util
.
uvstat
.
addStat
(),
Util
.
uvstat
.
renderStat
()},
isArticlePage
:
function
(
e
){
var
t
=!
0
;
return
e
.
indexOf
(
Label
.
servePath
+
"
/tags/
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/tags.html
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/category/
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/archives.html
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/archives/
"
)
>-
1
&&
(
t
=!
1
),
e
.
indexOf
(
Label
.
servePath
+
"
/links.html
"
)
>-
1
&&
(
t
=!
1
),
e
===
Label
.
servePath
&&
(
t
=!
1
),
/^
[
0-9
]
*$/
.
test
(
e
.
replace
(
Label
.
servePath
+
"
/
"
,
""
))
&&
(
t
=!
1
),
t
},
initPjax
:
function
(
e
){
1
===
$
(
"
#pjax
"
).
length
&&
(
$
.
pjax
({
selector
:
"
a
"
,
container
:
"
#pjax
"
,
show
:
""
,
cache
:
!
1
,
storage
:
!
0
,
titleSuffix
:
""
,
filter
:
function
(
e
,
t
){
return
!
e
||
(
"
_blank
"
===
t
.
getAttribute
(
"
target
"
)
||
(
e
===
Label
.
servePath
+
"
/rss.xml
"
||
e
.
indexOf
(
Label
.
servePath
+
"
/admin-index.do
"
)
>-
1
||
(
0
===
e
.
indexOf
(
"
#
"
)
||!
(
t
.
href
.
indexOf
(
Label
.
servePath
)
>-
1
))))},
callback
:
function
(){
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
Util
.
uvstat
.
addStat
(),
Util
.
uvstat
.
renderStat
(),
e
&&
e
()}}),
NProgress
.
configure
({
showSpinner
:
!
1
}),
$
(
"
#pjax
"
).
bind
(
"
pjax.start
"
,(
function
(){
NProgress
.
start
()})),
$
(
"
#pjax
"
).
bind
(
"
pjax.end
"
,(
function
(){
window
.
scroll
(
window
.
scrollX
,
0
),
NProgress
.
done
()})))},
previewImg
:
function
(){
$
(
"
body
"
).
on
(
"
click
"
,
"
.vditor-reset img
"
,(
function
(){
$
(
this
).
hasClass
(
"
prevent
"
)
||
window
.
open
(
this
.
src
)}))},
addStyle
:
function
(
e
,
t
){
if
(
!
document
.
getElementById
(
t
)){
var
i
=
document
.
createElement
(
"
link
"
);
i
.
id
=
t
,
i
.
setAttribute
(
"
rel
"
,
"
stylesheet
"
),
i
.
setAttribute
(
"
type
"
,
"
text/css
"
),
i
.
setAttribute
(
"
href
"
,
e
),
document
.
getElementsByTagName
(
"
head
"
)[
0
].
appendChild
(
i
)}},
addScript
:
function
(
e
,
t
){
if
(
!
document
.
getElementById
(
t
)){
var
i
=
new
XMLHttpRequest
;
i
.
open
(
"
GET
"
,
e
,
!
1
),
i
.
setRequestHeader
(
"
Accept
"
,
"
text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01
"
),
i
.
send
(
""
);
var
a
=
document
.
createElement
(
"
script
"
);
a
.
id
=
t
,
a
.
type
=
"
text/javascript
"
,
a
.
text
=
i
.
responseText
,
document
.
getElementsByTagName
(
"
head
"
)[
0
].
appendChild
(
a
)}},
parseLanguage
:
function
(){
Vditor
.
highlightRender
({
style
:
Label
.
hljsStyle
,
enable
:
!
Label
.
luteAvailable
},
document
)},
parseMarkdown
:
function
(){
"
undefined
"
==
typeof
Vditor
&&
Util
.
addScript
(
"
https://cdn.jsdelivr.net/npm/vditor@2.0.15/dist/method.min.js
"
,
"
vditorPreviewScript
"
),
Vditor
.
codeRender
(
document
.
body
,
Label
.
langLabel
),
Label
.
luteAvailable
?
Vditor
.
mathRenderByLute
(
document
.
body
):
Vditor
.
mathRender
(
document
.
body
),
Vditor
.
abcRender
(),
Vditor
.
chartRender
(),
Vditor
.
mediaRender
(
document
.
body
),
Vditor
.
mermaidRender
(
document
.
body
),
document
.
querySelectorAll
(
"
.vditor-reset
"
).
forEach
(
e
=>
{
Vditor
.
speechRender
(
e
,
Label
.
langLabel
)})},
killIE
:
function
(
e
){
var
t
=
navigator
.
userAgent
.
split
(
"
MSIE
"
)[
1
];
t
&&
(
e
||
(
e
=
7
),
parseFloat
(
t
.
split
(
"
;
"
))
<=
e
&&
function
(){
try
{
var
e
=
'
<div class="killIEIframe" style=
\'
display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110
\'
></div><iframe class="killIEIframe" style=
\'
left:
'
+
(
$
(
window
).
width
()
-
781
)
/
2
+
"
px;z-index:120;top:
"
+
(
$
(
window
).
height
()
-
680
)
/
2
+
"
px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='
"
+
Label
.
servePath
+
"
/kill-browser'></iframe>
"
;
$
(
"
body
"
).
append
(
e
)}
catch
(
t
){
e
=
'
<div class="killIEIframe" style=
\'
display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110
\'
></div><iframe class="killIEIframe" style=
\'
left:
'
+
10
+
"
px;z-index:120;top:
"
+
0
+
"
px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='
"
+
Label
.
servePath
+
"
/kill-browser'></iframe>
"
;
document
.
body
.
innerHTML
=
document
.
body
.
innerHTML
+
e
}}())},
setTopBar
:
function
(){
var
e
=
$
(
"
#top
"
);
if
(
1
===
e
.
length
){
var
t
=
$
(
"
#showTop
"
);
t
.
click
((
function
(){
e
.
slideDown
(),
t
.
hide
()})),
$
(
"
#hideTop
"
).
click
((
function
(){
e
.
slideUp
(),
t
.
show
()}))}},
goTop
:
function
(){
$
(
"
html, body
"
).
animate
({
scrollTop
:
0
},
800
)},
goBottom
:
function
(
e
){
e
||
(
e
=
0
),
$
(
"
html, body
"
).
animate
({
scrollTop
:
$
(
document
).
height
()
-
$
(
window
).
height
()
-
e
},
800
)},
init
:
function
(){
Util
.
killIE
(),
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
Util
.
initSW
(),
Util
.
previewImg
(),
Util
.
initDebugInfo
(),
Util
.
initViewCnt
()},
initDebugInfo
:
function
(){
console
.
log
(
"
%cSolo%c
\n
\
ud83c
\
udfb8
\
u4e00
\
u6b3e
\
u5c0f
\
u800c
\
u7f8e
\
u7684
\
u535a
\
u5ba2
\
u7cfb
\
u7edf
\
uff0c
\
u4e13
\
u4e3a
\
u7a0b
\
u5e8f
\
u5458
\
u8bbe
\
u8ba1
\
u3002
\n\n
solo.b3log.org v
"
+
Label
.
version
+
"
\n
Copyright
\
xa9 2010-present
"
,
"
font-size:96px;color:#3b3e43
"
,
"
font-size:12px;color:#4285f4;
"
)},
initSW
:
function
(){
navigator
.
serviceWorker
&&
navigator
.
serviceWorker
.
register
(
"
/sw.js
"
,{
scope
:
"
/
"
})},
buildTags
:
function
(
e
){
e
=
e
||
"
tags
"
;
for
(
var
t
=
[
"
tags1
"
,
"
tags2
"
,
"
tags3
"
,
"
tags4
"
,
"
tags5
"
],
i
=
$
(
"
#
"
+
e
+
"
b
"
).
get
(),
a
=
parseInt
(
$
(
"
#
"
+
e
+
"
b
"
).
last
().
text
()),
n
=
Math
.
ceil
(
a
/
t
.
length
),
r
=
0
;
r
<
i
.
length
;
r
++
)
for
(
var
o
=
parseInt
(
i
[
r
].
innerHTML
),
l
=
0
;
l
<
t
.
length
;
l
++
)
if
(
o
>
l
*
n
&&
o
<=
(
l
+
1
)
*
n
){
i
[
r
].
parentNode
.
className
=
t
[
l
];
break
}
$
(
"
#
"
+
e
).
html
(
$
(
"
#
"
+
e
+
"
li
"
).
get
().
sort
((
function
(
e
,
t
){
var
i
=
$
(
e
).
find
(
"
span
"
).
text
().
toLowerCase
(),
a
=
$
(
t
).
find
(
"
span
"
).
text
().
toLowerCase
();
return
i
.
localeCompare
(
a
)})))}};
\ 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