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
2abf0df2
Unverified
Commit
2abf0df2
authored
Jun 07, 2019
by
Van
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#12796
parent
9b0e610b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
11 deletions
+11
-11
package-lock.json
package-lock.json
+3
-3
package.json
package.json
+1
-1
src/main/webapp/admin/admin-index.ftl
src/main/webapp/admin/admin-index.ftl
+1
-1
src/main/webapp/js/common.js
src/main/webapp/js/common.js
+3
-3
src/main/webapp/js/common.min.js
src/main/webapp/js/common.min.js
+1
-1
src/main/webapp/js/page.js
src/main/webapp/js/page.js
+1
-1
src/main/webapp/js/page.min.js
src/main/webapp/js/page.min.js
+1
-1
No files found.
package-lock.json
View file @
2abf0df2
...
...
@@ -5485,9 +5485,9 @@
"dev"
:
true
},
"vditor"
:
{
"version"
:
"1.5.
2
"
,
"resolved"
:
"https://registry.npmjs.org/vditor/-/vditor-1.5.
2
.tgz"
,
"integrity"
:
"sha512-
NOmvjkg6NgEZUKTQB4lqlZoZTJcJ9tDoj+7odtcWO2fpi1RpRmrBnJjhDbuJy5mstM8KBXD9k17gSrlDT+UbeA
=="
,
"version"
:
"1.5.
4
"
,
"resolved"
:
"https://registry.npmjs.org/vditor/-/vditor-1.5.
4
.tgz"
,
"integrity"
:
"sha512-
LaykVAMCW+PwI2ujBhhs5gS0xvqPF665B5hLYPQuT4DeN9eUtUiHGKjFc5icB9eI/jcvXDy786cvz8G+/+WFjg
=="
,
"requires"
:
{
"echarts"
:
"^4.2.1"
,
"highlight.js"
:
"^9.15.6"
,
...
...
package.json
View file @
2abf0df2
...
...
@@ -36,6 +36,6 @@
"
gulp-uglify
"
:
"
^3.0.2
"
},
"dependencies"
:
{
"
vditor
"
:
"
^1.5.
2
"
"
vditor
"
:
"
^1.5.
4
"
}
}
src/main/webapp/admin/admin-index.ftl
View file @
2abf0df2
...
...
@@ -165,7 +165,7 @@
</div>
</div>
<script
src=
"${staticServePath}/js/lib/compress/admin-lib.min.js"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/vditor@1.5.
2
/dist/index.min.js"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/vditor@1.5.
4
/dist/index.min.js"
></script>
<script
src=
"${staticServePath}/js/common${miniPostfix}.js"
></script>
<
#if
""
==
miniPostfix
>
<script
src=
"${staticServePath}/js/admin/admin.js"
></script>
...
...
src/main/webapp/js/common.js
View file @
2abf0df2
...
...
@@ -147,7 +147,7 @@ var Util = {
if
(
$
(
'
.vditor-reset pre > code
'
).
length
===
0
)
{
return
}
Util
.
addStyle
(
'
https://cdn.jsdelivr.net/npm/vditor@1.5.
2
/dist/js/highlight.js@9.15.8/styles/
'
+
Util
.
addStyle
(
'
https://cdn.jsdelivr.net/npm/vditor@1.5.
4
/dist/js/highlight.js@9.15.8/styles/
'
+
Label
.
hljsStyle
+
'
.css
'
,
'
vditorHljsStyle
'
)
var
initHljs
=
function
()
{
...
...
@@ -158,7 +158,7 @@ var Util = {
if
(
!
Label
.
markedAvailable
)
{
if
(
typeof
hljs
===
'
undefined
'
)
{
$
.
ajax
({
url
:
'
https://cdn.jsdelivr.net/npm/vditor@1.5.
2
/dist/js/highlight.js@9.15.8/highlight.pack.js
'
,
url
:
'
https://cdn.jsdelivr.net/npm/vditor@1.5.
4
/dist/js/highlight.js@9.15.8/highlight.pack.js
'
,
dataType
:
'
script
'
,
cache
:
true
,
success
:
function
()
{
...
...
@@ -182,7 +182,7 @@ var Util = {
return
}
Util
.
addScript
(
'
https://cdn.jsdelivr.net/npm/vditor@1.5.
2
/dist/index.min.js
'
,
Util
.
addScript
(
'
https://cdn.jsdelivr.net/npm/vditor@1.5.
4
/dist/index.min.js
'
,
'
vditorScript
'
)
Vditor
.
mermaidRender
(
document
.
body
)
...
...
src/main/webapp/js/common.min.js
View file @
2abf0df2
var
Util
=
{
isArticlePage
:
function
(
e
){
var
t
=!
0
;
return
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/tags/
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/tags.html
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/category/
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/archives.html
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/archives/
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/links.html
"
)
&&
(
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
){
return
e
===
Label
.
servePath
+
"
/rss.xml
"
||-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/admin-index.do
"
)
||!
(
-
1
<
e
.
indexOf
(
Label
.
servePath
))},
callback
:
function
(){
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
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
(){
if
(
0
!==
$
(
"
.vditor-reset pre > code
"
).
length
){
Util
.
addStyle
(
"
https://cdn.jsdelivr.net/npm/vditor@1.5.2/dist/js/highlight.js@9.15.8/styles/
"
+
Label
.
hljsStyle
+
"
.css
"
,
"
vditorHljsStyle
"
);
function
e
(){
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
()}
Label
.
markedAvailable
||
(
"
undefined
"
==
typeof
hljs
?
$
.
ajax
({
url
:
"
https://cdn.jsdelivr.net/npm/vditor@1.5.2/dist/js/highlight.js@9.15.8/highlight.pack.js
"
,
dataType
:
"
script
"
,
cache
:
!
0
,
success
:
function
(){
e
()}}):
e
())}},
parseMarkdown
:
function
(){
var
e
=
$
(
"
.vditor-reset
"
).
text
();(
0
!==
$
(
"
.vditor-reset pre > code
"
).
length
||
2
<
e
.
split
(
"
$
"
).
length
||
1
<
e
.
split
(
"
\\
(
"
).
length
&&
1
<
e
.
split
(
"
\\
)
"
).
length
)
&&
(
Util
.
addScript
(
"
https://cdn.jsdelivr.net/npm/vditor@1.5.2/dist/index.min.js
"
,
"
vditorScript
"
),
Vditor
.
mermaidRender
(
document
.
body
),
Vditor
.
mathRender
(
document
.
body
),
Vditor
.
codeRender
(
document
.
body
,
Label
.
langLabel
))},
killIE
:
function
(
e
){
var
t
=
navigator
.
userAgent
.
split
(
"
MSIE
"
)[
1
];
t
&&
(
e
||
(
e
=
7
),
parseFloat
(
t
.
split
(
"
;
"
))
<=
e
&&
function
(){
if
(
""
===
Cookie
.
readCookie
(
"
showKill
"
))
try
{
var
t
=
"
<div 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 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
(
t
)}
catch
(
e
){
t
=
"
<div 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 style='left:10px;z-index:120;top: 0px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='
"
+
Label
.
servePath
+
"
/kill-browser'></iframe>
"
,
document
.
body
.
innerHTML
=
document
.
body
.
innerHTML
+
t
}}())},
switchMobile
:
function
(
e
){
Cookie
.
createCookie
(
"
btouch_switch_toggle
"
,
e
,
365
),
setTimeout
(
function
(){
location
.
reload
()},
1250
)},
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
()},
initDebugInfo
:
function
(){
console
.
log
(
"
%cSolo%c
\n
🎸一款小而美的博客系统,专为程序员设计。
"
+
Label
.
version
+
"
©
"
+
(
new
Date
).
getFullYear
(),
"
font-size:96px;color:#3b3e43
"
,
"
font-size:12px;color:rgba(0,0,0,0.38);
"
)},
initSW
:
function
(){
navigator
.
serviceWorker
&&
navigator
.
serviceWorker
.
register
(
"
/sw.js
"
,{
scope
:
"
/
"
})},
replaceSideEm
:
function
(
e
){
for
(
var
t
=
0
;
t
<
e
.
length
;
t
++
){
var
i
=
$
(
e
[
t
]);
i
.
html
(
i
.
html
())}},
buildTags
:
function
(
e
){
e
=
e
||
"
tags
"
;
for
(
var
t
=
[
"
tags1
"
,
"
tags2
"
,
"
tags3
"
,
"
tags4
"
,
"
tags5
"
],
i
=
$
(
"
#
"
+
e
+
"
b
"
).
get
(),
n
=
parseInt
(
$
(
"
#
"
+
e
+
"
b
"
).
last
().
text
()),
o
=
Math
.
ceil
(
n
/
t
.
length
),
a
=
0
;
a
<
i
.
length
;
a
++
)
for
(
var
r
=
parseInt
(
i
[
a
].
innerHTML
),
s
=
0
;
s
<
t
.
length
;
s
++
)
if
(
s
*
o
<
r
&&
r
<=
(
s
+
1
)
*
o
){
i
[
a
].
parentNode
.
className
=
t
[
s
];
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
)}))},
toDate
:
function
(
e
,
t
){
var
i
=
new
Date
(
e
),
n
=
{
"
M+
"
:
i
.
getMonth
()
+
1
,
"
d+
"
:
i
.
getDate
(),
"
H+
"
:
i
.
getHours
(),
"
m+
"
:
i
.
getMinutes
(),
"
s+
"
:
i
.
getSeconds
(),
"
q+
"
:
Math
.
floor
((
i
.
getMonth
()
+
3
)
/
3
),
S
:
i
.
getMilliseconds
()};
for
(
var
o
in
/
(
y+
)
/
.
test
(
t
)
&&
(
t
=
t
.
replace
(
RegExp
.
$1
,(
i
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
))),
n
)
new
RegExp
(
"
(
"
+
o
+
"
)
"
).
test
(
t
)
&&
(
t
=
t
.
replace
(
RegExp
.
$1
,
1
==
RegExp
.
$1
.
length
?
n
[
o
]:(
"
00
"
+
n
[
o
]).
substr
((
""
+
n
[
o
]).
length
)));
return
t
}};
if
(
!
Cookie
)
var
Cookie
=
{
readCookie
:
function
(
e
){
for
(
var
t
=
e
+
"
=
"
,
i
=
document
.
cookie
.
split
(
"
;
"
),
n
=
0
;
n
<
i
.
length
;
n
++
){
for
(
var
o
=
i
[
n
];
"
"
==
o
.
charAt
(
0
);)
o
=
o
.
substring
(
1
,
o
.
length
);
if
(
0
==
o
.
indexOf
(
t
))
return
decodeURIComponent
(
o
.
substring
(
t
.
length
,
o
.
length
))}
return
""
},
eraseCookie
:
function
(
e
){
this
.
createCookie
(
e
,
""
,
-
1
)},
createCookie
:
function
(
e
,
t
,
i
){
var
n
=
""
;
if
(
i
){
var
o
=
new
Date
;
o
.
setTime
(
o
.
getTime
()
+
24
*
i
*
60
*
60
*
1
e3
),
n
=
"
; expires=
"
+
o
.
toGMTString
()}
document
.
cookie
=
e
+
"
=
"
+
encodeURIComponent
(
t
)
+
n
+
"
; path=/
"
}};
\ No newline at end of file
var
Util
=
{
isArticlePage
:
function
(
e
){
var
t
=!
0
;
return
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/tags/
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/tags.html
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/category/
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/archives.html
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/archives/
"
)
&&
(
t
=!
1
),
-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/links.html
"
)
&&
(
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
){
return
e
===
Label
.
servePath
+
"
/rss.xml
"
||-
1
<
e
.
indexOf
(
Label
.
servePath
+
"
/admin-index.do
"
)
||!
(
-
1
<
e
.
indexOf
(
Label
.
servePath
))},
callback
:
function
(){
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
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
(){
if
(
0
!==
$
(
"
.vditor-reset pre > code
"
).
length
){
Util
.
addStyle
(
"
https://cdn.jsdelivr.net/npm/vditor@1.5.4/dist/js/highlight.js@9.15.8/styles/
"
+
Label
.
hljsStyle
+
"
.css
"
,
"
vditorHljsStyle
"
);
function
e
(){
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
()}
Label
.
markedAvailable
||
(
"
undefined
"
==
typeof
hljs
?
$
.
ajax
({
url
:
"
https://cdn.jsdelivr.net/npm/vditor@1.5.4/dist/js/highlight.js@9.15.8/highlight.pack.js
"
,
dataType
:
"
script
"
,
cache
:
!
0
,
success
:
function
(){
e
()}}):
e
())}},
parseMarkdown
:
function
(){
var
e
=
$
(
"
.vditor-reset
"
).
text
();(
0
!==
$
(
"
.vditor-reset pre > code
"
).
length
||
2
<
e
.
split
(
"
$
"
).
length
||
1
<
e
.
split
(
"
\\
(
"
).
length
&&
1
<
e
.
split
(
"
\\
)
"
).
length
)
&&
(
Util
.
addScript
(
"
https://cdn.jsdelivr.net/npm/vditor@1.5.4/dist/index.min.js
"
,
"
vditorScript
"
),
Vditor
.
mermaidRender
(
document
.
body
),
Vditor
.
chartRender
(),
Vditor
.
mathRender
(
document
.
body
),
Vditor
.
codeRender
(
document
.
body
,
Label
.
langLabel
))},
killIE
:
function
(
e
){
var
t
=
navigator
.
userAgent
.
split
(
"
MSIE
"
)[
1
];
t
&&
(
e
||
(
e
=
7
),
parseFloat
(
t
.
split
(
"
;
"
))
<=
e
&&
function
(){
if
(
""
===
Cookie
.
readCookie
(
"
showKill
"
))
try
{
var
t
=
"
<div 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 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
(
t
)}
catch
(
e
){
t
=
"
<div 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 style='left:10px;z-index:120;top: 0px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='
"
+
Label
.
servePath
+
"
/kill-browser'></iframe>
"
,
document
.
body
.
innerHTML
=
document
.
body
.
innerHTML
+
t
}}())},
switchMobile
:
function
(
e
){
Cookie
.
createCookie
(
"
btouch_switch_toggle
"
,
e
,
365
),
setTimeout
(
function
(){
location
.
reload
()},
1250
)},
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
()},
initDebugInfo
:
function
(){
console
.
log
(
"
%cSolo%c
\n
🎸一款小而美的博客系统,专为程序员设计。
"
+
Label
.
version
+
"
©
"
+
(
new
Date
).
getFullYear
(),
"
font-size:96px;color:#3b3e43
"
,
"
font-size:12px;color:rgba(0,0,0,0.38);
"
)},
initSW
:
function
(){
navigator
.
serviceWorker
&&
navigator
.
serviceWorker
.
register
(
"
/sw.js
"
,{
scope
:
"
/
"
})},
replaceSideEm
:
function
(
e
){
for
(
var
t
=
0
;
t
<
e
.
length
;
t
++
){
var
i
=
$
(
e
[
t
]);
i
.
html
(
i
.
html
())}},
buildTags
:
function
(
e
){
e
=
e
||
"
tags
"
;
for
(
var
t
=
[
"
tags1
"
,
"
tags2
"
,
"
tags3
"
,
"
tags4
"
,
"
tags5
"
],
i
=
$
(
"
#
"
+
e
+
"
b
"
).
get
(),
n
=
parseInt
(
$
(
"
#
"
+
e
+
"
b
"
).
last
().
text
()),
o
=
Math
.
ceil
(
n
/
t
.
length
),
r
=
0
;
r
<
i
.
length
;
r
++
)
for
(
var
a
=
parseInt
(
i
[
r
].
innerHTML
),
s
=
0
;
s
<
t
.
length
;
s
++
)
if
(
s
*
o
<
a
&&
a
<=
(
s
+
1
)
*
o
){
i
[
r
].
parentNode
.
className
=
t
[
s
];
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
)}))},
toDate
:
function
(
e
,
t
){
var
i
=
new
Date
(
e
),
n
=
{
"
M+
"
:
i
.
getMonth
()
+
1
,
"
d+
"
:
i
.
getDate
(),
"
H+
"
:
i
.
getHours
(),
"
m+
"
:
i
.
getMinutes
(),
"
s+
"
:
i
.
getSeconds
(),
"
q+
"
:
Math
.
floor
((
i
.
getMonth
()
+
3
)
/
3
),
S
:
i
.
getMilliseconds
()};
for
(
var
o
in
/
(
y+
)
/
.
test
(
t
)
&&
(
t
=
t
.
replace
(
RegExp
.
$1
,(
i
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
))),
n
)
new
RegExp
(
"
(
"
+
o
+
"
)
"
).
test
(
t
)
&&
(
t
=
t
.
replace
(
RegExp
.
$1
,
1
==
RegExp
.
$1
.
length
?
n
[
o
]:(
"
00
"
+
n
[
o
]).
substr
((
""
+
n
[
o
]).
length
)));
return
t
}};
if
(
!
Cookie
)
var
Cookie
=
{
readCookie
:
function
(
e
){
for
(
var
t
=
e
+
"
=
"
,
i
=
document
.
cookie
.
split
(
"
;
"
),
n
=
0
;
n
<
i
.
length
;
n
++
){
for
(
var
o
=
i
[
n
];
"
"
==
o
.
charAt
(
0
);)
o
=
o
.
substring
(
1
,
o
.
length
);
if
(
0
==
o
.
indexOf
(
t
))
return
decodeURIComponent
(
o
.
substring
(
t
.
length
,
o
.
length
))}
return
""
},
eraseCookie
:
function
(
e
){
this
.
createCookie
(
e
,
""
,
-
1
)},
createCookie
:
function
(
e
,
t
,
i
){
var
n
=
""
;
if
(
i
){
var
o
=
new
Date
;
o
.
setTime
(
o
.
getTime
()
+
24
*
i
*
60
*
60
*
1
e3
),
n
=
"
; expires=
"
+
o
.
toGMTString
()}
document
.
cookie
=
e
+
"
=
"
+
encodeURIComponent
(
t
)
+
n
+
"
; path=/
"
}};
\ No newline at end of file
src/main/webapp/js/page.js
View file @
2abf0df2
...
...
@@ -102,7 +102,7 @@ $.extend(Page.prototype, {
if
(
!
$
(
'
#soloEditorComment
'
).
hasClass
(
'
vditor
'
))
{
var
that
=
this
Util
.
addScript
(
'
https://cdn.jsdelivr.net/npm/vditor@1.5.
2
/dist/index.min.js
'
,
'
vditorScript
'
)
Util
.
addScript
(
'
https://cdn.jsdelivr.net/npm/vditor@1.5.
4
/dist/index.min.js
'
,
'
vditorScript
'
)
window
.
vditor
=
new
Vditor
(
'
soloEditorComment
'
,
{
placeholder
:
that
.
tips
.
commentContentCannotEmptyLabel
,
height
:
180
,
...
...
src/main/webapp/js/page.min.js
View file @
2abf0df2
var
Page
=
function
(
t
){
this
.
currentCommentId
=
""
,
this
.
tips
=
t
};
$
.
extend
(
Page
.
prototype
,{
share
:
function
(){
var
t
=
$
(
"
.article__share
"
);
if
(
0
!==
t
.
length
){
var
e
=
t
.
find
(
"
.item__qr
"
),
o
=
t
.
data
(
"
url
"
),
i
=
t
.
data
(
"
avatar
"
),
n
=
encodeURIComponent
(
t
.
data
(
"
title
"
)
+
"
-
"
+
t
.
data
(
"
blogtitle
"
)),
r
=
encodeURIComponent
(
o
),
a
=
{};
a
.
tencent
=
"
http://share.v.t.qq.com/index.php?c=share&a=index&title=
"
+
n
+
"
&url=
"
+
r
+
"
&pic=
"
+
i
,
a
.
weibo
=
"
http://v.t.sina.com.cn/share/share.php?title=
"
+
n
+
"
&url=
"
+
r
+
"
&pic=
"
+
i
,
a
.
qqz
=
"
https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=
"
+
r
+
"
&sharesource=qzone&title=
"
+
n
+
"
&pics=
"
+
i
,
a
.
twitter
=
"
https://twitter.com/intent/tweet?status=
"
+
n
+
"
"
+
r
,
t
.
find
(
"
span
"
).
click
(
function
(){
var
t
=
$
(
this
).
data
(
"
type
"
);
if
(
t
)
return
"
wechat
"
===
t
?(
0
===
e
.
find
(
"
canvas
"
).
length
?(
Util
.
addScript
(
Label
.
staticServePath
+
"
/js/lib/jquery.qrcode.min.js
"
,
"
qrcodeScript
"
),
e
.
qrcode
({
width
:
128
,
height
:
128
,
text
:
o
})):
e
.
slideToggle
(),
!
1
):
void
window
.
open
(
a
[
t
],
"
_blank
"
,
"
top=100,left=200,width=648,height=618
"
)})}},
load
:
function
(){
var
t
=
this
;
$
(
"
#comment
"
).
click
(
function
(){
t
.
toggleEditor
()}).
attr
(
"
readonly
"
,
"
readonly
"
),
$
(
"
#soloEditorCancel
"
).
click
(
function
(){
t
.
toggleEditor
()}),
$
(
"
#soloEditorAdd
"
).
click
(
function
(){
t
.
submitComment
()})},
toggleEditor
:
function
(
t
,
e
){
var
o
=
$
(
"
#soloEditor
"
);
if
(
0
!==
o
.
length
){
if
(
!
$
(
"
#soloEditorComment
"
).
hasClass
(
"
vditor
"
)){
Util
.
addScript
(
"
https://cdn.jsdelivr.net/npm/vditor@1.5.2/dist/index.min.js
"
,
"
vditorScript
"
),
window
.
vditor
=
new
Vditor
(
"
soloEditorComment
"
,{
placeholder
:
this
.
tips
.
commentContentCannotEmptyLabel
,
height
:
180
,
tab
:
"
\t
"
,
hint
:{
emojiPath
:
Label
.
staticServePath
+
"
/images/emoji
"
},
esc
:
function
(){
$
(
"
#soloEditorCancel
"
).
click
()},
ctrlEnter
:
function
(){
$
(
"
#soloEditorAdd
"
).
click
()},
preview
:{
delay
:
500
,
show
:
!
1
,
url
:
Label
.
servePath
+
"
/console/markdown/2html
"
,
hljs
:{
enable
:
!
0
,
style
:
Label
.
hljsStyle
},
parse
:
function
(
t
){
"
none
"
!==
t
.
style
.
display
&&
Util
.
parseLanguage
()}},
counter
:
500
,
resize
:{
enable
:
!
0
,
position
:
"
top
"
,
after
:
function
(){
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
$
(
"
#soloEditor
"
).
outerHeight
())}},
lang
:
Label
.
langLabel
,
toolbar
:[
"
emoji
"
,
"
headings
"
,
"
bold
"
,
"
italic
"
,
"
strike
"
,
"
|
"
,
"
line
"
,
"
quote
"
,
"
|
"
,
"
list
"
,
"
ordered-list
"
,
"
check
"
,
"
|
"
,
"
code
"
,
"
inline-code
"
,
"
|
"
,
"
undo
"
,
"
redo
"
,
"
|
"
,
"
link
"
,
"
table
"
,
"
|
"
,
"
preview
"
,
"
fullscreen
"
,
"
info
"
,
"
help
"
]}),
vditor
.
focus
()}
"
0px
"
===
$
(
"
body
"
).
css
(
"
padding-bottom
"
)
||
t
?(
$
(
"
#soloEditorError
"
).
text
(
""
),
o
.
css
({
bottom
:
"
0
"
,
opacity
:
1
}),
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
"
238px
"
),
this
.
currentCommentId
=
t
,
$
(
"
#soloEditorReplyTarget
"
).
text
(
e
?
"
@
"
+
e
:
""
),
"
undefined
"
!=
typeof
vditor
&&
vditor
.
focus
()):(
o
.
css
({
bottom
:
"
-300px
"
,
opacity
:
0
}),
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
0
))}
else
location
.
href
=
Label
.
servePath
+
"
/start
"
},
loadRandomArticles
:
function
(
s
){
var
c
=
this
.
tips
.
randomArticles1Label
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/articles/random
"
,
type
:
"
POST
"
,
success
:
function
(
t
,
e
){
var
o
=
t
.
randomArticles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
r
=
o
[
n
],
a
=
r
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
Label
.
servePath
+
r
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
l
=
(
s
||
"
<h4>
"
+
c
+
"
</h4>
"
)
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#randomArticles
"
).
append
(
l
)}
else
$
(
"
#randomArticles
"
).
remove
()}})},
loadRelevantArticles
:
function
(
t
,
s
){
$
.
ajax
({
url
:
Label
.
servePath
+
"
/article/id/
"
+
t
+
"
/relevant/articles
"
,
type
:
"
GET
"
,
success
:
function
(
t
,
e
){
var
o
=
t
.
relevantArticles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
r
=
o
[
n
],
a
=
r
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
Label
.
servePath
+
r
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
l
=
s
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#relevantArticles
"
).
append
(
l
)}
else
$
(
"
#relevantArticles
"
).
remove
()},
error
:
function
(){
$
(
"
#relevantArticles
"
).
remove
()}})},
loadExternalRelevantArticles
:
function
(
t
,
s
){
var
c
=
this
.
tips
;
try
{
$
.
ajax
({
url
:
"
https://rhythm.b3log.org/get-articles-by-tags.do?tags=
"
+
t
+
"
&blogHost=
"
+
c
.
blogHost
+
"
&paginationPageSize=
"
+
c
.
externalRelevantArticlesDisplayCount
,
type
:
"
GET
"
,
cache
:
!
0
,
dataType
:
"
jsonp
"
,
error
:
function
(){
$
(
"
#externalRelevantArticles
"
).
remove
()},
success
:
function
(
t
,
e
){
var
o
=
t
.
articles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
r
=
o
[
n
],
a
=
r
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' target='_blank' href='
"
+
r
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
l
=
(
s
||
"
<h4>
"
+
c
.
externalRelevantArticles1Label
+
"
</h4>
"
)
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#externalRelevantArticles
"
).
append
(
l
)}
else
$
(
"
#externalRelevantArticles
"
).
remove
()}})}
catch
(
t
){}},
submitComment
:
function
(){
var
e
=
this
,
t
=
this
.
tips
;
if
(
1
<
vditor
.
getValue
().
length
&&
vditor
.
getValue
().
length
<
500
){
$
(
"
#soloEditorAdd
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
var
o
=
{
oId
:
t
.
oId
,
commentContent
:
vditor
.
getValue
()};
this
.
currentCommentId
&&
(
o
.
commentOriginalCommentId
=
this
.
currentCommentId
),
$
.
ajax
({
type
:
"
POST
"
,
url
:
Label
.
servePath
+
"
/article/comments
"
,
cache
:
!
1
,
contentType
:
"
application/json
"
,
data
:
JSON
.
stringify
(
o
),
success
:
function
(
t
){
$
(
"
#soloEditorAdd
"
).
removeAttr
(
"
disabled
"
),
t
.
sc
?(
e
.
toggleEditor
(),
vditor
.
setValue
(
""
),
e
.
addCommentAjax
(
t
.
cmtTpl
)):
$
(
"
#soloEditorError
"
).
html
(
t
.
msg
)}})}
else
$
(
"
#soloEditorError
"
).
text
(
e
.
tips
.
commentContentCannotEmptyLabel
)},
addReplyForm
:
function
(
t
,
e
){
this
.
currentCommentId
=
t
,
this
.
toggleEditor
(
t
,
e
)},
hideComment
:
function
(
t
){
$
(
"
#commentRef
"
+
t
).
hide
()},
showComment
:
function
(
t
,
e
,
o
,
i
){
var
n
=
parseInt
(
$
(
t
).
position
().
top
);
if
(
i
&&
(
n
=
parseInt
(
$
(
t
).
parents
(
i
).
position
().
top
)),
0
<
$
(
"
#commentRef
"
+
e
).
length
)
$
(
"
#commentRef
"
+
e
).
show
().
css
(
"
top
"
,
n
+
o
+
"
px
"
);
else
{
var
r
=
$
(
"
#
"
+
e
).
clone
();
r
.
addClass
(
"
comment-body-ref
"
).
attr
(
"
id
"
,
"
commentRef
"
+
e
),
r
.
find
(
"
#replyForm
"
).
remove
(),
$
(
"
#comments
"
).
append
(
r
),
$
(
"
#commentRef
"
+
e
).
css
(
"
top
"
,
n
+
o
+
"
px
"
)}},
addCommentAjax
:
function
(
t
){
0
<
$
(
"
#comments
"
).
children
().
length
?
$
(
$
(
"
#comments
"
).
children
()[
0
]).
before
(
t
):
$
(
"
#comments
"
).
html
(
t
),
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
window
.
location
.
hash
=
"
#comments
"
}});
\ No newline at end of file
var
Page
=
function
(
t
){
this
.
currentCommentId
=
""
,
this
.
tips
=
t
};
$
.
extend
(
Page
.
prototype
,{
share
:
function
(){
var
t
=
$
(
"
.article__share
"
);
if
(
0
!==
t
.
length
){
var
e
=
t
.
find
(
"
.item__qr
"
),
o
=
t
.
data
(
"
url
"
),
i
=
t
.
data
(
"
avatar
"
),
n
=
encodeURIComponent
(
t
.
data
(
"
title
"
)
+
"
-
"
+
t
.
data
(
"
blogtitle
"
)),
r
=
encodeURIComponent
(
o
),
a
=
{};
a
.
tencent
=
"
http://share.v.t.qq.com/index.php?c=share&a=index&title=
"
+
n
+
"
&url=
"
+
r
+
"
&pic=
"
+
i
,
a
.
weibo
=
"
http://v.t.sina.com.cn/share/share.php?title=
"
+
n
+
"
&url=
"
+
r
+
"
&pic=
"
+
i
,
a
.
qqz
=
"
https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=
"
+
r
+
"
&sharesource=qzone&title=
"
+
n
+
"
&pics=
"
+
i
,
a
.
twitter
=
"
https://twitter.com/intent/tweet?status=
"
+
n
+
"
"
+
r
,
t
.
find
(
"
span
"
).
click
(
function
(){
var
t
=
$
(
this
).
data
(
"
type
"
);
if
(
t
)
return
"
wechat
"
===
t
?(
0
===
e
.
find
(
"
canvas
"
).
length
?(
Util
.
addScript
(
Label
.
staticServePath
+
"
/js/lib/jquery.qrcode.min.js
"
,
"
qrcodeScript
"
),
e
.
qrcode
({
width
:
128
,
height
:
128
,
text
:
o
})):
e
.
slideToggle
(),
!
1
):
void
window
.
open
(
a
[
t
],
"
_blank
"
,
"
top=100,left=200,width=648,height=618
"
)})}},
load
:
function
(){
var
t
=
this
;
$
(
"
#comment
"
).
click
(
function
(){
t
.
toggleEditor
()}).
attr
(
"
readonly
"
,
"
readonly
"
),
$
(
"
#soloEditorCancel
"
).
click
(
function
(){
t
.
toggleEditor
()}),
$
(
"
#soloEditorAdd
"
).
click
(
function
(){
t
.
submitComment
()})},
toggleEditor
:
function
(
t
,
e
){
var
o
=
$
(
"
#soloEditor
"
);
if
(
0
!==
o
.
length
){
if
(
!
$
(
"
#soloEditorComment
"
).
hasClass
(
"
vditor
"
)){
Util
.
addScript
(
"
https://cdn.jsdelivr.net/npm/vditor@1.5.4/dist/index.min.js
"
,
"
vditorScript
"
),
window
.
vditor
=
new
Vditor
(
"
soloEditorComment
"
,{
placeholder
:
this
.
tips
.
commentContentCannotEmptyLabel
,
height
:
180
,
tab
:
"
\t
"
,
hint
:{
emojiPath
:
Label
.
staticServePath
+
"
/images/emoji
"
},
esc
:
function
(){
$
(
"
#soloEditorCancel
"
).
click
()},
ctrlEnter
:
function
(){
$
(
"
#soloEditorAdd
"
).
click
()},
preview
:{
delay
:
500
,
show
:
!
1
,
url
:
Label
.
servePath
+
"
/console/markdown/2html
"
,
hljs
:{
enable
:
!
0
,
style
:
Label
.
hljsStyle
},
parse
:
function
(
t
){
"
none
"
!==
t
.
style
.
display
&&
Util
.
parseLanguage
()}},
counter
:
500
,
resize
:{
enable
:
!
0
,
position
:
"
top
"
,
after
:
function
(){
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
$
(
"
#soloEditor
"
).
outerHeight
())}},
lang
:
Label
.
langLabel
,
toolbar
:[
"
emoji
"
,
"
headings
"
,
"
bold
"
,
"
italic
"
,
"
strike
"
,
"
|
"
,
"
line
"
,
"
quote
"
,
"
|
"
,
"
list
"
,
"
ordered-list
"
,
"
check
"
,
"
|
"
,
"
code
"
,
"
inline-code
"
,
"
|
"
,
"
undo
"
,
"
redo
"
,
"
|
"
,
"
link
"
,
"
table
"
,
"
|
"
,
"
preview
"
,
"
fullscreen
"
,
"
info
"
,
"
help
"
]}),
vditor
.
focus
()}
"
0px
"
===
$
(
"
body
"
).
css
(
"
padding-bottom
"
)
||
t
?(
$
(
"
#soloEditorError
"
).
text
(
""
),
o
.
css
({
bottom
:
"
0
"
,
opacity
:
1
}),
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
"
238px
"
),
this
.
currentCommentId
=
t
,
$
(
"
#soloEditorReplyTarget
"
).
text
(
e
?
"
@
"
+
e
:
""
),
"
undefined
"
!=
typeof
vditor
&&
vditor
.
focus
()):(
o
.
css
({
bottom
:
"
-300px
"
,
opacity
:
0
}),
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
0
))}
else
location
.
href
=
Label
.
servePath
+
"
/start
"
},
loadRandomArticles
:
function
(
s
){
var
c
=
this
.
tips
.
randomArticles1Label
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/articles/random
"
,
type
:
"
POST
"
,
success
:
function
(
t
,
e
){
var
o
=
t
.
randomArticles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
r
=
o
[
n
],
a
=
r
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
Label
.
servePath
+
r
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
l
=
(
s
||
"
<h4>
"
+
c
+
"
</h4>
"
)
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#randomArticles
"
).
append
(
l
)}
else
$
(
"
#randomArticles
"
).
remove
()}})},
loadRelevantArticles
:
function
(
t
,
s
){
$
.
ajax
({
url
:
Label
.
servePath
+
"
/article/id/
"
+
t
+
"
/relevant/articles
"
,
type
:
"
GET
"
,
success
:
function
(
t
,
e
){
var
o
=
t
.
relevantArticles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
r
=
o
[
n
],
a
=
r
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
Label
.
servePath
+
r
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
l
=
s
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#relevantArticles
"
).
append
(
l
)}
else
$
(
"
#relevantArticles
"
).
remove
()},
error
:
function
(){
$
(
"
#relevantArticles
"
).
remove
()}})},
loadExternalRelevantArticles
:
function
(
t
,
s
){
var
c
=
this
.
tips
;
try
{
$
.
ajax
({
url
:
"
https://rhythm.b3log.org/get-articles-by-tags.do?tags=
"
+
t
+
"
&blogHost=
"
+
c
.
blogHost
+
"
&paginationPageSize=
"
+
c
.
externalRelevantArticlesDisplayCount
,
type
:
"
GET
"
,
cache
:
!
0
,
dataType
:
"
jsonp
"
,
error
:
function
(){
$
(
"
#externalRelevantArticles
"
).
remove
()},
success
:
function
(
t
,
e
){
var
o
=
t
.
articles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
r
=
o
[
n
],
a
=
r
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' target='_blank' href='
"
+
r
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
l
=
(
s
||
"
<h4>
"
+
c
.
externalRelevantArticles1Label
+
"
</h4>
"
)
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#externalRelevantArticles
"
).
append
(
l
)}
else
$
(
"
#externalRelevantArticles
"
).
remove
()}})}
catch
(
t
){}},
submitComment
:
function
(){
var
e
=
this
,
t
=
this
.
tips
;
if
(
1
<
vditor
.
getValue
().
length
&&
vditor
.
getValue
().
length
<
500
){
$
(
"
#soloEditorAdd
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
var
o
=
{
oId
:
t
.
oId
,
commentContent
:
vditor
.
getValue
()};
this
.
currentCommentId
&&
(
o
.
commentOriginalCommentId
=
this
.
currentCommentId
),
$
.
ajax
({
type
:
"
POST
"
,
url
:
Label
.
servePath
+
"
/article/comments
"
,
cache
:
!
1
,
contentType
:
"
application/json
"
,
data
:
JSON
.
stringify
(
o
),
success
:
function
(
t
){
$
(
"
#soloEditorAdd
"
).
removeAttr
(
"
disabled
"
),
t
.
sc
?(
e
.
toggleEditor
(),
vditor
.
setValue
(
""
),
e
.
addCommentAjax
(
t
.
cmtTpl
)):
$
(
"
#soloEditorError
"
).
html
(
t
.
msg
)}})}
else
$
(
"
#soloEditorError
"
).
text
(
e
.
tips
.
commentContentCannotEmptyLabel
)},
addReplyForm
:
function
(
t
,
e
){
this
.
currentCommentId
=
t
,
this
.
toggleEditor
(
t
,
e
)},
hideComment
:
function
(
t
){
$
(
"
#commentRef
"
+
t
).
hide
()},
showComment
:
function
(
t
,
e
,
o
,
i
){
var
n
=
parseInt
(
$
(
t
).
position
().
top
);
if
(
i
&&
(
n
=
parseInt
(
$
(
t
).
parents
(
i
).
position
().
top
)),
0
<
$
(
"
#commentRef
"
+
e
).
length
)
$
(
"
#commentRef
"
+
e
).
show
().
css
(
"
top
"
,
n
+
o
+
"
px
"
);
else
{
var
r
=
$
(
"
#
"
+
e
).
clone
();
r
.
addClass
(
"
comment-body-ref
"
).
attr
(
"
id
"
,
"
commentRef
"
+
e
),
r
.
find
(
"
#replyForm
"
).
remove
(),
$
(
"
#comments
"
).
append
(
r
),
$
(
"
#commentRef
"
+
e
).
css
(
"
top
"
,
n
+
o
+
"
px
"
)}},
addCommentAjax
:
function
(
t
){
0
<
$
(
"
#comments
"
).
children
().
length
?
$
(
$
(
"
#comments
"
).
children
()[
0
]).
before
(
t
):
$
(
"
#comments
"
).
html
(
t
),
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
window
.
location
.
hash
=
"
#comments
"
}});
\ 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