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
3872023c
Unverified
Commit
3872023c
authored
Jan 02, 2020
by
Van
Browse files
Options
Browse Files
Download
Plain Diff
Merge branches '3.6.8-dev' and 'master' of
https://github.com/88250/solo
into 3.6.8-dev
parents
2f090cda
98a29d30
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
9 additions
and
9 deletions
+9
-9
package-lock.json
package-lock.json
+3
-3
package.json
package.json
+1
-1
src/main/resources/admin/admin-index.ftl
src/main/resources/admin/admin-index.ftl
+1
-1
src/main/resources/js/common.js
src/main/resources/js/common.js
+1
-1
src/main/resources/js/common.min.js
src/main/resources/js/common.min.js
+1
-1
src/main/resources/js/page.js
src/main/resources/js/page.js
+1
-1
src/main/resources/js/page.min.js
src/main/resources/js/page.min.js
+1
-1
No files found.
package-lock.json
View file @
3872023c
...
...
@@ -5256,9 +5256,9 @@
"dev"
:
true
},
"vditor"
:
{
"version"
:
"2.0.
6
"
,
"resolved"
:
"https://registry.npmjs.org/vditor/-/vditor-2.0.
6
.tgz"
,
"integrity"
:
"sha512-
R3FYFq9GhojcXdkiUhdIXcX2WyNoSr+R9YQoOvXKPSW0dBIzSDvofq/o/5uxini2AIxsWyBgsAJZlvvVxogm1w
=="
,
"version"
:
"2.0.
7
"
,
"resolved"
:
"https://registry.npmjs.org/vditor/-/vditor-2.0.
7
.tgz"
,
"integrity"
:
"sha512-
VwgBJZSlq2yxEz+3M3RHFB6aV7S4DLguVoZBGUNj/VicYp7lM5wOv0OdMefXiVOeLS8pB4heGha8x7TvXdepNA
=="
,
"requires"
:
{
"diff-match-patch"
:
"^1.0.4"
}
...
...
package.json
View file @
3872023c
...
...
@@ -37,6 +37,6 @@
"
gulp-terser
"
:
"
^1.2.0
"
},
"dependencies"
:
{
"
vditor
"
:
"
^2.0.
6
"
"
vditor
"
:
"
^2.0.
7
"
}
}
src/main/resources/admin/admin-index.ftl
View file @
3872023c
...
...
@@ -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@2.0.
6
/dist/index.min.js"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/vditor@2.0.
7
/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/resources/js/common.js
View file @
3872023c
...
...
@@ -168,7 +168,7 @@ var Util = {
if
(
typeof
Vditor
===
'
undefined
'
)
{
Util
.
addScript
(
'
https://cdn.jsdelivr.net/npm/vditor@2.0.
6
/dist/method.min.js
'
,
'
https://cdn.jsdelivr.net/npm/vditor@2.0.
7
/dist/method.min.js
'
,
'
vditorPreviewScript
'
)
}
...
...
src/main/resources/js/common.min.js
View file @
3872023c
var
Util
=
{
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
(),
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
o
=
document
.
createElement
(
"
script
"
);
o
.
id
=
t
,
o
.
type
=
"
text/javascript
"
,
o
.
text
=
i
.
responseText
,
document
.
getElementsByTagName
(
"
head
"
)[
0
].
appendChild
(
o
)}},
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.6/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
(){
if
(
""
===
Cookie
.
readCookie
(
"
showKill
"
))
try
{
var
e
=
"
<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
(
e
)}
catch
(
t
){
e
=
"
<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:
"
+
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
}}())},
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
\
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
:
"
/
"
})},
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
(),
o
=
parseInt
(
$
(
"
#
"
+
e
+
"
b
"
).
last
().
text
()),
n
=
Math
.
ceil
(
o
/
t
.
length
),
r
=
0
;
r
<
i
.
length
;
r
++
)
for
(
var
a
=
parseInt
(
i
[
r
].
innerHTML
),
l
=
0
;
l
<
t
.
length
;
l
++
)
if
(
a
>
l
*
n
&&
a
<=
(
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
(),
o
=
$
(
t
).
find
(
"
span
"
).
text
().
toLowerCase
();
return
i
.
localeCompare
(
o
)})))},
toDate
:
function
(
e
,
t
){
var
i
=
new
Date
(
e
),
o
=
{
"
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
n
in
/
(
y+
)
/
.
test
(
t
)
&&
(
t
=
t
.
replace
(
RegExp
.
$1
,(
i
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
))),
o
)
new
RegExp
(
"
(
"
+
n
+
"
)
"
).
test
(
t
)
&&
(
t
=
t
.
replace
(
RegExp
.
$1
,
1
==
RegExp
.
$1
.
length
?
o
[
n
]:(
"
00
"
+
o
[
n
]).
substr
((
""
+
o
[
n
]).
length
)));
return
t
}};
if
(
!
Cookie
)
var
Cookie
=
{
readCookie
:
function
(
e
){
for
(
var
t
=
e
+
"
=
"
,
i
=
document
.
cookie
.
split
(
"
;
"
),
o
=
0
;
o
<
i
.
length
;
o
++
){
for
(
var
n
=
i
[
o
];
"
"
==
n
.
charAt
(
0
);)
n
=
n
.
substring
(
1
,
n
.
length
);
if
(
0
==
n
.
indexOf
(
t
))
return
decodeURIComponent
(
n
.
substring
(
t
.
length
,
n
.
length
))}
return
""
},
eraseCookie
:
function
(
e
){
this
.
createCookie
(
e
,
""
,
-
1
)},
createCookie
:
function
(
e
,
t
,
i
){
var
o
=
""
;
if
(
i
){
var
n
=
new
Date
;
n
.
setTime
(
n
.
getTime
()
+
24
*
i
*
60
*
60
*
1
e3
),
o
=
"
; expires=
"
+
n
.
toGMTString
()}
document
.
cookie
=
e
+
"
=
"
+
encodeURIComponent
(
t
)
+
o
+
"
; path=/
"
}};
\ No newline at end of file
var
Util
=
{
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
(),
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
o
=
document
.
createElement
(
"
script
"
);
o
.
id
=
t
,
o
.
type
=
"
text/javascript
"
,
o
.
text
=
i
.
responseText
,
document
.
getElementsByTagName
(
"
head
"
)[
0
].
appendChild
(
o
)}},
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.7/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
(){
if
(
""
===
Cookie
.
readCookie
(
"
showKill
"
))
try
{
var
e
=
"
<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
(
e
)}
catch
(
t
){
e
=
"
<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:
"
+
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
}}())},
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
\
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
:
"
/
"
})},
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
(),
o
=
parseInt
(
$
(
"
#
"
+
e
+
"
b
"
).
last
().
text
()),
n
=
Math
.
ceil
(
o
/
t
.
length
),
r
=
0
;
r
<
i
.
length
;
r
++
)
for
(
var
a
=
parseInt
(
i
[
r
].
innerHTML
),
l
=
0
;
l
<
t
.
length
;
l
++
)
if
(
a
>
l
*
n
&&
a
<=
(
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
(),
o
=
$
(
t
).
find
(
"
span
"
).
text
().
toLowerCase
();
return
i
.
localeCompare
(
o
)})))},
toDate
:
function
(
e
,
t
){
var
i
=
new
Date
(
e
),
o
=
{
"
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
n
in
/
(
y+
)
/
.
test
(
t
)
&&
(
t
=
t
.
replace
(
RegExp
.
$1
,(
i
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
))),
o
)
new
RegExp
(
"
(
"
+
n
+
"
)
"
).
test
(
t
)
&&
(
t
=
t
.
replace
(
RegExp
.
$1
,
1
==
RegExp
.
$1
.
length
?
o
[
n
]:(
"
00
"
+
o
[
n
]).
substr
((
""
+
o
[
n
]).
length
)));
return
t
}};
if
(
!
Cookie
)
var
Cookie
=
{
readCookie
:
function
(
e
){
for
(
var
t
=
e
+
"
=
"
,
i
=
document
.
cookie
.
split
(
"
;
"
),
o
=
0
;
o
<
i
.
length
;
o
++
){
for
(
var
n
=
i
[
o
];
"
"
==
n
.
charAt
(
0
);)
n
=
n
.
substring
(
1
,
n
.
length
);
if
(
0
==
n
.
indexOf
(
t
))
return
decodeURIComponent
(
n
.
substring
(
t
.
length
,
n
.
length
))}
return
""
},
eraseCookie
:
function
(
e
){
this
.
createCookie
(
e
,
""
,
-
1
)},
createCookie
:
function
(
e
,
t
,
i
){
var
o
=
""
;
if
(
i
){
var
n
=
new
Date
;
n
.
setTime
(
n
.
getTime
()
+
24
*
i
*
60
*
60
*
1
e3
),
o
=
"
; expires=
"
+
n
.
toGMTString
()}
document
.
cookie
=
e
+
"
=
"
+
encodeURIComponent
(
t
)
+
o
+
"
; path=/
"
}};
\ No newline at end of file
src/main/resources/js/page.js
View file @
3872023c
...
...
@@ -103,7 +103,7 @@ $.extend(Page.prototype, {
if
(
!
$
(
'
#soloEditorComment
'
).
hasClass
(
'
vditor
'
))
{
var
that
=
this
Util
.
addScript
(
'
https://cdn.jsdelivr.net/npm/vditor@2.0.
6
/dist/index.min.js
'
,
'
https://cdn.jsdelivr.net/npm/vditor@2.0.
7
/dist/index.min.js
'
,
'
vditorScript
'
)
var
toolbar
=
[
'
emoji
'
,
...
...
src/main/resources/js/page.min.js
View file @
3872023c
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
"
),
r
=
encodeURIComponent
(
t
.
data
(
"
title
"
)
+
"
-
"
+
t
.
data
(
"
blogtitle
"
)),
l
=
encodeURIComponent
(
o
),
n
=
{};
n
.
tencent
=
"
http://share.v.t.qq.com/index.php?c=share&a=index&title=
"
+
r
+
"
&url=
"
+
l
+
"
&pic=
"
+
i
,
n
.
weibo
=
"
http://v.t.sina.com.cn/share/share.php?title=
"
+
r
+
"
&url=
"
+
l
+
"
&pic=
"
+
i
,
n
.
qqz
=
"
https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=
"
+
l
+
"
&sharesource=qzone&title=
"
+
r
+
"
&pics=
"
+
i
,
n
.
twitter
=
"
https://twitter.com/intent/tweet?status=
"
+
r
+
"
"
+
l
,
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
(
n
[
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@2.0.6/dist/index.min.js
"
,
"
vditorScript
"
);
var
i
=
[
"
emoji
"
,
"
headings
"
,
"
bold
"
,
"
italic
"
,
"
strike
"
,
"
link
"
,
"
|
"
,
"
list
"
,
"
ordered-list
"
,
"
check
"
,
"
|
"
,
"
quote
"
,
"
line
"
,
"
code
"
,
"
inline-code
"
,
"
table
"
,
"
|
"
,
"
undo
"
,
"
redo
"
,
"
|
"
,
"
wysiwyg
"
,
"
both
"
,
"
preview
"
,
"
format
"
,
"
|
"
,
"
fullscreen
"
,
"
devtools
"
,
"
info
"
,
"
help
"
],
r
=!
0
;
$
(
window
).
width
()
<
768
&&
(
i
=
[
"
emoji
"
,
"
bold
"
,
"
italic
"
,
"
link
"
,
"
list
"
,
"
check
"
,
"
wysiwyg
"
,
"
preview
"
,
"
fullscreen
"
,
"
help
"
],
r
=!
1
),
window
.
vditor
=
new
Vditor
(
"
soloEditorComment
"
,{
placeholder
:
this
.
tips
.
commentContentCannotEmptyLabel
,
height
:
180
,
tab
:
"
\t
"
,
esc
:
function
(){
$
(
"
#soloEditorCancel
"
).
click
()},
ctrlEnter
:
function
(){
$
(
"
#soloEditorAdd
"
).
click
()},
preview
:{
delay
:
500
,
mode
:
"
editor
"
,
url
:
Label
.
servePath
+
"
/console/markdown/2html
"
,
hljs
:{
enable
:
!
Label
.
luteAvailable
,
style
:
Label
.
hljsStyle
},
parse
:
function
(
t
){
"
none
"
!==
t
.
style
.
display
&&
Util
.
parseLanguage
()}},
counter
:
500
,
resize
:{
enable
:
r
,
position
:
"
top
"
},
lang
:
Label
.
langLabel
,
toolbar
:
i
,
after
:()
=>
{
vditor
.
focus
()}})}
"
-300px
"
===
o
.
css
(
"
bottom
"
)
||
t
?(
$
(
"
#soloEditorError
"
).
text
(
""
),
$
(
window
).
width
()
<
768
?
o
.
css
({
top
:
"
0
"
,
bottom
:
"
auto
"
,
opacity
:
1
}):
o
.
css
({
bottom
:
"
0
"
,
top
:
"
auto
"
,
opacity
:
1
}),
this
.
currentCommentId
=
t
,
$
(
"
#soloEditorReplyTarget
"
).
text
(
e
?
"
@
"
+
e
:
""
),
"
undefined
"
!=
typeof
vditor
&&
vditor
.
vditor
.
wysiwyg
&&
vditor
.
focus
()):
o
.
css
({
bottom
:
"
-300px
"
,
top
:
"
auto
"
,
opacity
:
0
})}
else
location
.
href
=
Label
.
servePath
+
"
/start
"
},
loadRandomArticles
:
function
(
t
){
var
e
=
this
.
tips
.
randomArticles1Label
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/articles/random
"
,
type
:
"
POST
"
,
success
:
function
(
o
,
i
){
var
r
=
o
.
randomArticles
;
if
(
r
&&
0
!==
r
.
length
){
for
(
var
l
=
""
,
n
=
0
;
n
<
r
.
length
;
n
++
){
var
a
=
r
[
n
],
s
=
a
.
articleTitle
;
l
+=
"
<li><a rel='nofollow' title='
"
+
s
+
"
' href='
"
+
Label
.
servePath
+
a
.
articlePermalink
+
"
'>
"
+
s
+
"
</a></li>
"
}
var
c
=
(
t
||
"
<h4>
"
+
e
+
"
</h4>
"
)
+
"
<ul>
"
+
l
+
"
</ul>
"
;
$
(
"
#randomArticles
"
).
append
(
c
)}
else
$
(
"
#randomArticles
"
).
remove
()}})},
loadRelevantArticles
:
function
(
t
,
e
){
$
.
ajax
({
url
:
Label
.
servePath
+
"
/article/id/
"
+
t
+
"
/relevant/articles
"
,
type
:
"
GET
"
,
success
:
function
(
t
,
o
){
var
i
=
t
.
relevantArticles
;
if
(
i
&&
0
!==
i
.
length
){
for
(
var
r
=
""
,
l
=
0
;
l
<
i
.
length
;
l
++
){
var
n
=
i
[
l
],
a
=
n
.
articleTitle
;
r
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
Label
.
servePath
+
n
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
s
=
e
+
"
<ul>
"
+
r
+
"
</ul>
"
;
$
(
"
#relevantArticles
"
).
append
(
s
)}
else
$
(
"
#relevantArticles
"
).
remove
()},
error
:
function
(){
$
(
"
#relevantArticles
"
).
remove
()}})},
loadExternalRelevantArticles
:
function
(
t
,
e
){
var
o
=
this
.
tips
;
try
{
$
.
ajax
({
url
:
"
https://rhythm.b3log.org/get-articles-by-tags.do?tags=
"
+
t
+
"
&blogHost=
"
+
o
.
blogHost
+
"
&paginationPageSize=
"
+
o
.
externalRelevantArticlesDisplayCount
,
type
:
"
GET
"
,
cache
:
!
0
,
dataType
:
"
jsonp
"
,
error
:
function
(){
$
(
"
#externalRelevantArticles
"
).
remove
()},
success
:
function
(
t
,
i
){
var
r
=
t
.
articles
;
if
(
r
&&
0
!==
r
.
length
){
for
(
var
l
=
""
,
n
=
0
;
n
<
r
.
length
;
n
++
){
var
a
=
r
[
n
],
s
=
a
.
articleTitle
;
l
+=
"
<li><a rel='nofollow' title='
"
+
s
+
"
' target='_blank' href='
"
+
a
.
articlePermalink
+
"
'>
"
+
s
+
"
</a></li>
"
}
var
c
=
(
e
||
"
<h4>
"
+
o
.
externalRelevantArticles1Label
+
"
</h4>
"
)
+
"
<ul>
"
+
l
+
"
</ul>
"
;
$
(
"
#externalRelevantArticles
"
).
append
(
c
)}
else
$
(
"
#externalRelevantArticles
"
).
remove
()}})}
catch
(
t
){}},
submitComment
:
function
(){
var
t
=
this
,
e
=
this
.
tips
;
if
(
vditor
.
getValue
().
length
>
1
&&
vditor
.
getValue
().
length
<
500
){
$
(
"
#soloEditorAdd
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
var
o
=
{
oId
:
e
.
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
(
e
){
$
(
"
#soloEditorAdd
"
).
removeAttr
(
"
disabled
"
),
e
.
sc
?(
t
.
toggleEditor
(),
vditor
.
setValue
(
""
),
t
.
addCommentAjax
(
e
.
cmtTpl
)):
$
(
"
#soloEditorError
"
).
html
(
e
.
msg
)}})}
else
$
(
"
#soloEditorError
"
).
text
(
t
.
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
r
=
parseInt
(
$
(
t
).
position
().
top
);
if
(
i
&&
(
r
=
parseInt
(
$
(
t
).
parents
(
i
).
position
().
top
)),
$
(
"
#commentRef
"
+
e
).
length
>
0
)
$
(
"
#commentRef
"
+
e
).
show
().
css
(
"
top
"
,
r
+
o
+
"
px
"
);
else
{
var
l
=
$
(
"
#
"
+
e
).
clone
();
l
.
addClass
(
"
comment-body-ref
"
).
attr
(
"
id
"
,
"
commentRef
"
+
e
),
l
.
find
(
"
#replyForm
"
).
remove
(),
$
(
"
#comments
"
).
append
(
l
),
$
(
"
#commentRef
"
+
e
).
css
(
"
top
"
,
r
+
o
+
"
px
"
)}},
addCommentAjax
:
function
(
t
){
$
(
"
#comments
"
).
children
().
length
>
0
?
$
(
$
(
"
#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
"
),
r
=
encodeURIComponent
(
t
.
data
(
"
title
"
)
+
"
-
"
+
t
.
data
(
"
blogtitle
"
)),
l
=
encodeURIComponent
(
o
),
n
=
{};
n
.
tencent
=
"
http://share.v.t.qq.com/index.php?c=share&a=index&title=
"
+
r
+
"
&url=
"
+
l
+
"
&pic=
"
+
i
,
n
.
weibo
=
"
http://v.t.sina.com.cn/share/share.php?title=
"
+
r
+
"
&url=
"
+
l
+
"
&pic=
"
+
i
,
n
.
qqz
=
"
https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=
"
+
l
+
"
&sharesource=qzone&title=
"
+
r
+
"
&pics=
"
+
i
,
n
.
twitter
=
"
https://twitter.com/intent/tweet?status=
"
+
r
+
"
"
+
l
,
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
(
n
[
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@2.0.7/dist/index.min.js
"
,
"
vditorScript
"
);
var
i
=
[
"
emoji
"
,
"
headings
"
,
"
bold
"
,
"
italic
"
,
"
strike
"
,
"
link
"
,
"
|
"
,
"
list
"
,
"
ordered-list
"
,
"
check
"
,
"
|
"
,
"
quote
"
,
"
line
"
,
"
code
"
,
"
inline-code
"
,
"
table
"
,
"
|
"
,
"
undo
"
,
"
redo
"
,
"
|
"
,
"
wysiwyg
"
,
"
both
"
,
"
preview
"
,
"
format
"
,
"
|
"
,
"
fullscreen
"
,
"
devtools
"
,
"
info
"
,
"
help
"
],
r
=!
0
;
$
(
window
).
width
()
<
768
&&
(
i
=
[
"
emoji
"
,
"
bold
"
,
"
italic
"
,
"
link
"
,
"
list
"
,
"
check
"
,
"
wysiwyg
"
,
"
preview
"
,
"
fullscreen
"
,
"
help
"
],
r
=!
1
),
window
.
vditor
=
new
Vditor
(
"
soloEditorComment
"
,{
placeholder
:
this
.
tips
.
commentContentCannotEmptyLabel
,
height
:
180
,
tab
:
"
\t
"
,
esc
:
function
(){
$
(
"
#soloEditorCancel
"
).
click
()},
ctrlEnter
:
function
(){
$
(
"
#soloEditorAdd
"
).
click
()},
preview
:{
delay
:
500
,
mode
:
"
editor
"
,
url
:
Label
.
servePath
+
"
/console/markdown/2html
"
,
hljs
:{
enable
:
!
Label
.
luteAvailable
,
style
:
Label
.
hljsStyle
},
parse
:
function
(
t
){
"
none
"
!==
t
.
style
.
display
&&
Util
.
parseLanguage
()}},
counter
:
500
,
resize
:{
enable
:
r
,
position
:
"
top
"
},
lang
:
Label
.
langLabel
,
toolbar
:
i
,
after
:()
=>
{
vditor
.
focus
()}})}
"
-300px
"
===
o
.
css
(
"
bottom
"
)
||
t
?(
$
(
"
#soloEditorError
"
).
text
(
""
),
$
(
window
).
width
()
<
768
?
o
.
css
({
top
:
"
0
"
,
bottom
:
"
auto
"
,
opacity
:
1
}):
o
.
css
({
bottom
:
"
0
"
,
top
:
"
auto
"
,
opacity
:
1
}),
this
.
currentCommentId
=
t
,
$
(
"
#soloEditorReplyTarget
"
).
text
(
e
?
"
@
"
+
e
:
""
),
"
undefined
"
!=
typeof
vditor
&&
vditor
.
vditor
.
wysiwyg
&&
vditor
.
focus
()):
o
.
css
({
bottom
:
"
-300px
"
,
top
:
"
auto
"
,
opacity
:
0
})}
else
location
.
href
=
Label
.
servePath
+
"
/start
"
},
loadRandomArticles
:
function
(
t
){
var
e
=
this
.
tips
.
randomArticles1Label
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/articles/random
"
,
type
:
"
POST
"
,
success
:
function
(
o
,
i
){
var
r
=
o
.
randomArticles
;
if
(
r
&&
0
!==
r
.
length
){
for
(
var
l
=
""
,
n
=
0
;
n
<
r
.
length
;
n
++
){
var
a
=
r
[
n
],
s
=
a
.
articleTitle
;
l
+=
"
<li><a rel='nofollow' title='
"
+
s
+
"
' href='
"
+
Label
.
servePath
+
a
.
articlePermalink
+
"
'>
"
+
s
+
"
</a></li>
"
}
var
c
=
(
t
||
"
<h4>
"
+
e
+
"
</h4>
"
)
+
"
<ul>
"
+
l
+
"
</ul>
"
;
$
(
"
#randomArticles
"
).
append
(
c
)}
else
$
(
"
#randomArticles
"
).
remove
()}})},
loadRelevantArticles
:
function
(
t
,
e
){
$
.
ajax
({
url
:
Label
.
servePath
+
"
/article/id/
"
+
t
+
"
/relevant/articles
"
,
type
:
"
GET
"
,
success
:
function
(
t
,
o
){
var
i
=
t
.
relevantArticles
;
if
(
i
&&
0
!==
i
.
length
){
for
(
var
r
=
""
,
l
=
0
;
l
<
i
.
length
;
l
++
){
var
n
=
i
[
l
],
a
=
n
.
articleTitle
;
r
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
Label
.
servePath
+
n
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
s
=
e
+
"
<ul>
"
+
r
+
"
</ul>
"
;
$
(
"
#relevantArticles
"
).
append
(
s
)}
else
$
(
"
#relevantArticles
"
).
remove
()},
error
:
function
(){
$
(
"
#relevantArticles
"
).
remove
()}})},
loadExternalRelevantArticles
:
function
(
t
,
e
){
var
o
=
this
.
tips
;
try
{
$
.
ajax
({
url
:
"
https://rhythm.b3log.org/get-articles-by-tags.do?tags=
"
+
t
+
"
&blogHost=
"
+
o
.
blogHost
+
"
&paginationPageSize=
"
+
o
.
externalRelevantArticlesDisplayCount
,
type
:
"
GET
"
,
cache
:
!
0
,
dataType
:
"
jsonp
"
,
error
:
function
(){
$
(
"
#externalRelevantArticles
"
).
remove
()},
success
:
function
(
t
,
i
){
var
r
=
t
.
articles
;
if
(
r
&&
0
!==
r
.
length
){
for
(
var
l
=
""
,
n
=
0
;
n
<
r
.
length
;
n
++
){
var
a
=
r
[
n
],
s
=
a
.
articleTitle
;
l
+=
"
<li><a rel='nofollow' title='
"
+
s
+
"
' target='_blank' href='
"
+
a
.
articlePermalink
+
"
'>
"
+
s
+
"
</a></li>
"
}
var
c
=
(
e
||
"
<h4>
"
+
o
.
externalRelevantArticles1Label
+
"
</h4>
"
)
+
"
<ul>
"
+
l
+
"
</ul>
"
;
$
(
"
#externalRelevantArticles
"
).
append
(
c
)}
else
$
(
"
#externalRelevantArticles
"
).
remove
()}})}
catch
(
t
){}},
submitComment
:
function
(){
var
t
=
this
,
e
=
this
.
tips
;
if
(
vditor
.
getValue
().
length
>
1
&&
vditor
.
getValue
().
length
<
500
){
$
(
"
#soloEditorAdd
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
var
o
=
{
oId
:
e
.
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
(
e
){
$
(
"
#soloEditorAdd
"
).
removeAttr
(
"
disabled
"
),
e
.
sc
?(
t
.
toggleEditor
(),
vditor
.
setValue
(
""
),
t
.
addCommentAjax
(
e
.
cmtTpl
)):
$
(
"
#soloEditorError
"
).
html
(
e
.
msg
)}})}
else
$
(
"
#soloEditorError
"
).
text
(
t
.
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
r
=
parseInt
(
$
(
t
).
position
().
top
);
if
(
i
&&
(
r
=
parseInt
(
$
(
t
).
parents
(
i
).
position
().
top
)),
$
(
"
#commentRef
"
+
e
).
length
>
0
)
$
(
"
#commentRef
"
+
e
).
show
().
css
(
"
top
"
,
r
+
o
+
"
px
"
);
else
{
var
l
=
$
(
"
#
"
+
e
).
clone
();
l
.
addClass
(
"
comment-body-ref
"
).
attr
(
"
id
"
,
"
commentRef
"
+
e
),
l
.
find
(
"
#replyForm
"
).
remove
(),
$
(
"
#comments
"
).
append
(
l
),
$
(
"
#commentRef
"
+
e
).
css
(
"
top
"
,
r
+
o
+
"
px
"
)}},
addCommentAjax
:
function
(
t
){
$
(
"
#comments
"
).
children
().
length
>
0
?
$
(
$
(
"
#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