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
2cc48d2b
Unverified
Commit
2cc48d2b
authored
Mar 06, 2019
by
Van
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
⬆
vditor -> 0.4.0
parent
1f2844c0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
4 deletions
+6
-4
src/main/webapp/js/admin/admin.min.js
src/main/webapp/js/admin/admin.min.js
+1
-1
src/main/webapp/js/admin/editor.js
src/main/webapp/js/admin/editor.js
+2
-1
src/main/webapp/js/page.js
src/main/webapp/js/page.js
+2
-1
src/main/webapp/js/page.min.js
src/main/webapp/js/page.min.js
+1
-1
No files found.
src/main/webapp/js/admin/admin.min.js
View file @
2cc48d2b
Util
.
htmlDecode
=
function
(
t
){
var
e
=
document
.
createElement
(
"
div
"
);
return
e
.
innerHTML
=
decodeURIComponent
(
t
),
e
.
innerText
},
Util
.
proessURL
=
function
(
t
){
return
/^
\w
+:
\/\/
/
.
test
(
t
)
||
(
t
=
"
http://
"
+
t
),
t
};
var
Admin
=
function
(){
this
.
register
=
{},
this
.
tools
=
[
"
#page-list
"
,
"
#file-list
"
,
"
#link-list
"
,
"
#preference
"
,
"
#user-list
"
,
"
#plugin-list
"
,
"
#others
"
,
"
#category-list
"
],
this
.
adTools
=
[
"
link-list
"
,
"
preference
"
,
"
file-list
"
,
"
page-list
"
,
"
user-list
"
,
"
plugin-list
"
,
"
others
"
,
"
category-list
"
]};
$
.
extend
(
Admin
.
prototype
,{
logout
:
function
(){
window
.
location
.
href
=
latkeConfig
.
servePath
+
"
/logout
"
},
toggleMenu
:
function
(){
"
-240px
"
===
$
(
"
#tabs
"
).
css
(
"
left
"
)?(
$
(
"
#tabs
"
).
css
(
"
left
"
,
0
),
$
(
"
.tabs__bg
"
).
show
()):(
$
(
"
#tabs
"
).
css
(
"
left
"
,
"
-240px
"
),
$
(
"
.tabs__bg
"
).
hide
())},
clearTip
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#loadMsg
"
).
text
(
""
)},
setHashByPage
:
function
(
t
){
var
e
=
window
.
location
.
hash
.
split
(
"
/
"
);
/^
\d
*$/
.
test
(
e
[
e
.
length
-
1
])?
e
[
e
.
length
-
1
]
=
t
:
e
.
push
(
t
),
window
.
location
.
hash
=
e
.
join
(
"
/
"
)},
selectTab
:
function
(
t
){
window
.
location
.
hash
=
"
#
"
+
t
},
analyseHash
:
function
(){
for
(
var
t
=
window
.
location
.
hash
,
e
=
t
.
substr
(
1
,
t
.
length
-
1
).
split
(
"
/
"
),
i
=
{
page
:
1
,
hashList
:[]},
a
=
0
;
a
<
e
.
length
;
a
++
)
a
===
e
.
length
-
1
&&
/^
\d
+$/
.
test
(
e
[
a
])?
i
.
page
=
e
[
a
]:
i
.
hashList
.
push
(
e
[
a
]);
return
i
},
setCurByHash
:
function
(){
$
(
window
).
scrollTop
(
0
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
admin
.
analyseHash
(),
e
=
t
.
hashList
[
1
],
i
=
t
.
hashList
[
2
];
if
(
1
===
t
.
hashList
.
length
&&
(
e
=
t
.
hashList
[
0
]),
""
!==
e
){
"
article
"
!==
e
?
admin
.
article
.
clearDraftTimer
():
"
article
"
===
e
&&
(
admin
.
article
.
autoSaveDraftTimer
=
setInterval
(
function
(){
admin
.
article
.
_autoSaveToDraft
()},
admin
.
article
.
AUTOSAVETIME
));
try
{
if
(
"
article
"
!==
e
&&
admin
.
article
.
isConfirm
&&
""
!==
admin
.
editors
.
articleEditor
.
getContent
().
replace
(
/
\s
/g
,
""
)
&&
admin
.
article
.
content
!==
admin
.
editors
.
articleEditor
.
getContent
()
&&!
confirm
(
Label
.
editorLeaveLabel
))
return
void
(
window
.
location
.
hash
=
"
#article/article
"
);
if
(
"
article
"
===
e
&&
admin
.
article
.
isConfirm
&&
""
!==
admin
.
editors
.
articleEditor
.
getContent
().
replace
(
/
\s
/g
,
""
)
&&
admin
.
article
.
content
!==
admin
.
editors
.
articleEditor
.
getContent
())
return
}
catch
(
t
){
var
a
=
$
(
"
#articleContent
"
);
if
(
0
<
a
.
length
){
if
(
"
article
"
!==
e
&&
admin
.
article
.
isConfirm
&&
""
!==
a
.
val
().
replace
(
/
\s
/g
,
""
)
&&
admin
.
article
.
content
!==
a
.
val
()
&&!
confirm
(
Label
.
editorLeaveLabel
))
return
void
(
window
.
location
.
hash
=
"
#article/article
"
);
if
(
"
article
"
===
e
&&
admin
.
article
.
isConfirm
&&
""
!==
a
.
val
().
replace
(
/
\s
/g
,
""
)
&&
admin
.
article
.
content
!==
a
.
val
())
return
}}
"
article
"
!==
e
&&
admin
.
editors
.
articleEditor
.
setContent
&&
admin
.
article
.
clear
(),
admin
.
article
.
isConfirm
=!
0
,
$
(
"
#tabs
"
).
tabs
(
"
setCurrent
"
,
e
),
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
1
===
$
(
"
#tabsPanel_
"
+
e
).
length
?
""
===
$
(
"
#tabsPanel_
"
+
e
).
html
().
replace
(
/
\s
/g
,
""
)?
$
(
"
#tabsPanel_
"
+
e
).
load
(
"
admin-
"
+
e
+
"
.do
"
,
function
(){
"
article
"
===
e
&&
admin
.
article
.
status
.
id
?
admin
.
register
[
e
].
init
.
call
(
admin
.
register
[
e
].
obj
,
admin
.
article
.
getAndSet
):
admin
.
register
[
e
].
init
.
call
(
admin
.
register
[
e
].
obj
,
t
.
page
),
i
&&
$
(
"
#tab
"
+
e
.
substring
(
0
,
1
).
toUpperCase
()
+
e
.
substring
(
1
)).
tabs
(
"
setCurrent
"
,
i
),
admin
.
plugin
.
setCurByHash
(
t
)}):(
"
article
"
===
e
&&
admin
.
article
.
status
.
id
&&
admin
.
article
.
getAndSet
(),
admin
.
register
[
e
]
&&
admin
.
register
[
e
].
refresh
&&
admin
.
register
[
e
].
refresh
.
call
(
admin
.
register
[
e
].
obj
,
t
.
page
),
i
&&
$
(
"
#tab
"
+
e
.
substring
(
0
,
1
).
toUpperCase
()
+
e
.
substring
(
1
)).
tabs
(
"
setCurrent
"
,
i
),
admin
.
plugin
.
setCurByHash
(
t
)):(
$
(
"
#tipMsg
"
).
text
(
"
Error: No tab!
"
+
Label
.
reportIssueLabel
),
$
(
"
#loadMsg
"
).
text
(
""
))}},
init
:
function
(){
Util
.
killIE
(),
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tabs
"
).
tabs
(),
setInterval
(
function
(){
""
!==
$
(
"
#tipMsg
"
).
text
()
&&
setTimeout
(
function
(){
$
(
"
#tipMsg
"
).
text
(
""
)},
7
e3
)},
6
e3
),
$
(
"
#loadMsg
"
).
text
(
""
)},
collapseNav
:
function
(
t
){
$
(
t
).
next
().
slideToggle
(
"
normal
"
,
function
(){
"
none
"
!==
this
.
style
.
display
?(
$
(
t
).
find
(
"
.icon-chevron-down
"
)[
0
].
className
=
"
icon-chevron-up fn__right
"
,
$
(
t
).
addClass
(
"
tab-current
"
)):(
$
(
t
).
find
(
"
.icon-chevron-up
"
)[
0
].
className
=
"
icon-chevron-down fn__right
"
,
$
(
t
).
removeClass
(
"
tab-current
"
)),
$
(
"
#tabs > ul
"
).
height
(
"
auto
"
),
$
(
"
#tabs > ul
"
).
height
(
$
(
"
#tabs > ul
"
).
height
()
+
80
)})},
inited
:
function
(){
if
(
"
adminRole
"
!==
Label
.
userRole
)
for
(
var
t
=
0
;
t
<
this
.
adTools
.
length
;
t
++
)
$
(
"
#tabs
"
).
tabs
(
"
remove
"
,
this
.
adTools
[
t
]);
else
for
(
var
e
=
0
;
e
<
this
.
tools
.
length
;
e
++
)
if
(
"
#
"
+
window
.
location
.
hash
.
split
(
"
/
"
)[
1
]
===
this
.
tools
[
e
]){
$
(
"
#tabToolsTitle
"
).
click
();
break
}
this
.
setCurByHash
()}});
var
admin
=
new
Admin
;
admin
.
editors
=
{};
var
SoloEditor
=
function
(
e
){
this
.
conf
=
e
,
this
.
init
()};
$
.
extend
(
SoloEditor
.
prototype
,{
init
:
function
(){
this
.
editor
=
new
Vditor
(
this
.
conf
.
id
,{
cache
:
!
0
,
hint
:{
emojiPath
:
latkeConfig
.
staticServePath
+
"
/js/lib/emojify.js-1.1.0/images/basic
"
},
preview
:{
delay
:
500
,
show
:
this
.
conf
.
previewShow
,
url
:
latkeConfig
.
servePath
+
"
/console/markdown/2html
"
,
parse
:
function
(
e
){
"
none
"
!==
e
.
style
.
display
&&
(
Util
.
parseMarkdown
(
"
content-reset
"
),
Label
.
markedAvailable
||
(
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
()))}},
upload
:{
max
:
10485760
,
url
:
Label
.
uploadURL
,
token
:
Label
.
uploadToken
,
filename
:
function
(
e
){
return
e
.
replace
(
/
\?
|
\\
|
\/
|:|
\|
|<|>|
\*
|
\[
|
\]
|
\s
+/g
,
"
-
"
)}},
height
:
this
.
conf
.
height
,
counter
:
102400
,
resize
:{
enable
:
this
.
conf
.
resize
},
lang
:
Label
.
localeString
,
classes
:{
preview
:
"
content-reset
"
}}),
"
function
"
==
typeof
this
.
conf
.
fun
&&
this
.
conf
.
fun
()},
getContent
:
function
(){
return
this
.
editor
.
getValue
()},
setContent
:
function
(
e
){
this
.
editor
.
setValue
(
e
)},
remove
:
function
(){
document
.
getElementById
(
this
.
editor
.
vditor
.
id
).
outerHTML
=
""
}}),
admin
.
editors
.
articleEditor
=
{},
admin
.
editors
.
abstractEditor
=
{},
admin
.
editors
.
pageEditor
=
{};
admin
.
editors
=
{};
var
SoloEditor
=
function
(
t
){
this
.
conf
=
t
,
this
.
init
()};
$
.
extend
(
SoloEditor
.
prototype
,{
init
:
function
(){
this
.
editor
=
new
Vditor
(
this
.
conf
.
id
,{
cache
:
!
0
,
tab
:
"
\t
"
,
hint
:{
emojiPath
:
latkeConfig
.
staticServePath
+
"
/js/lib/emojify.js-1.1.0/images/basic
"
},
preview
:{
delay
:
500
,
show
:
this
.
conf
.
previewShow
,
url
:
latkeConfig
.
servePath
+
"
/console/markdown/2html
"
,
parse
:
function
(
t
){
"
none
"
!==
t
.
style
.
display
&&
(
Util
.
parseMarkdown
(
"
content-reset
"
),
Label
.
markedAvailable
||
(
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
()))}},
upload
:{
max
:
10485760
,
url
:
Label
.
uploadURL
,
token
:
Label
.
uploadToken
,
filename
:
function
(
t
){
return
t
.
replace
(
/
\?
|
\\
|
\/
|:|
\|
|<|>|
\*
|
\[
|
\]
|
\s
+/g
,
"
-
"
)}},
height
:
this
.
conf
.
height
,
counter
:
102400
,
resize
:{
enable
:
this
.
conf
.
resize
},
lang
:
Label
.
localeString
,
classes
:{
preview
:
"
content-reset
"
}}),
"
function
"
==
typeof
this
.
conf
.
fun
&&
this
.
conf
.
fun
()},
getContent
:
function
(){
return
this
.
editor
.
getValue
()},
setContent
:
function
(
t
){
this
.
editor
.
setValue
(
t
)},
remove
:
function
(){
document
.
getElementById
(
this
.
editor
.
vditor
.
id
).
outerHTML
=
""
}}),
admin
.
editors
.
articleEditor
=
{},
admin
.
editors
.
abstractEditor
=
{},
admin
.
editors
.
pageEditor
=
{};
var
TablePaginate
=
function
(
a
){
this
.
id
=
a
,
this
.
currentPage
=
1
};
$
.
extend
(
TablePaginate
.
prototype
,{
buildTable
:
function
(
a
,
t
){
var
e
=
{
colModel
:
a
,
noDataTip
:
Label
.
noDataLabel
};
t
||
(
e
.
expendRow
=
{
index
:
"
expendRow
"
}),
$
(
"
#
"
+
this
.
id
+
"
Table
"
).
table
(
e
)},
initPagination
:
function
(){
var
a
=
this
.
id
;
$
(
"
#
"
+
a
+
"
Pagination
"
).
paginate
({
bind
:
function
(
a
,
t
){
t
?
$
(
"
#tipMsg
"
).
text
(
t
):
admin
.
setHashByPage
(
a
)},
currentPage
:
1
,
errorMessage
:
Label
.
inputErrorLabel
,
nextPageText
:
"
>
"
,
previousPageText
:
"
<
"
,
goText
:
Label
.
gotoLabel
,
type
:
"
custom
"
,
custom
:[
1
],
pageCount
:
1
})},
initCommentsDialog
:
function
(){
var
a
=
this
;
$
(
"
#
"
+
this
.
id
+
"
Comments
"
).
dialog
({
modal
:
!
0
,
hideFooter
:
!
0
,
close
:
function
(){
return
admin
[
a
.
id
+
"
List
"
].
getList
(
a
.
currentPage
),
!
0
}})},
updateTablePagination
:
function
(
a
,
t
,
e
){
if
((
t
=
parseInt
(
t
))
>
e
.
paginationPageCount
&&
1
<
t
)
return
$
(
"
#tipMsg
"
).
text
(
Label
.
pageLabel
+
t
+
Label
.
notFoundLabel
),
void
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#
"
+
this
.
id
+
"
Table
"
).
table
(
"
update
"
,{
data
:[{
groupName
:
"
all
"
,
groupData
:
a
}]}),
0
===
e
.
paginationPageCount
&&
(
e
.
paginationPageCount
=
1
),
$
(
"
#
"
+
this
.
id
+
"
Pagination
"
).
paginate
(
"
update
"
,{
pageCount
:
e
.
paginationPageCount
,
currentPage
:
t
,
custom
:
e
.
paginationPageNums
}),
this
.
currentPage
=
t
}});
function
getUUID
(){
var
a
=
(
new
Date
).
getTime
(),
t
=
"
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
"
.
replace
(
/
[
xy
]
/g
,
function
(
t
){
var
e
=
(
a
+
16
*
Math
.
random
())
%
16
|
0
;
return
a
=
Math
.
floor
(
a
/
16
),(
"
x
"
==
t
?
e
:
3
&
e
|
8
).
toString
(
16
)});
return
t
=
t
.
replace
(
new
RegExp
(
"
-
"
,
"
g
"
),
""
)}
admin
.
article
=
{
isConfirm
:
!
0
,
status
:{
id
:
void
0
,
isArticle
:
void
0
},
content
:
""
,
autoSaveDraftTimer
:
""
,
AUTOSAVETIME
:
6
e4
,
get
:
function
(
t
,
e
){
this
.
status
.
id
=
t
,
this
.
status
.
isArticle
=
e
,
admin
.
selectTab
(
"
article/article
"
)},
getAndSet
:
function
(){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/article/
"
+
admin
.
article
.
status
.
id
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
$
(
"
#title
"
).
val
(
e
.
article
.
articleTitle
),
admin
.
editors
.
articleEditor
.
setContent
(
e
.
article
.
articleContent
),
admin
.
editors
.
abstractEditor
.
setContent
(
e
.
article
.
articleAbstract
),
admin
.
article
.
content
=
admin
.
editors
.
articleEditor
.
getContent
();
for
(
var
a
=
e
.
article
.
articleTags
,
i
=
""
,
l
=
0
;
l
<
a
.
length
;
l
++
)
0
===
l
?
i
=
a
[
l
].
tagTitle
:
i
+=
"
,
"
+
a
[
l
].
tagTitle
;
$
(
"
#tag
"
).
val
(
i
),
$
(
"
#permalink
"
).
val
(
e
.
article
.
articlePermalink
),
$
(
"
#viewPwd
"
).
val
(
e
.
article
.
articleViewPwd
),
$
(
"
#articleCommentable
"
).
prop
(
"
checked
"
,
e
.
article
.
articleCommentable
);
var
s
=
e
.
article
.
signs
;
$
(
"
.signs button
"
).
each
(
function
(
t
){
parseInt
(
e
.
article
.
articleSignId
)
===
parseInt
(
s
[
t
].
oId
)?
$
(
"
#articleSign
"
+
s
[
t
].
oId
).
addClass
(
"
selected
"
):
$
(
"
#articleSign
"
+
s
[
t
].
oId
).
removeClass
(
"
selected
"
)}),
admin
.
article
.
setStatus
(),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
del
:
function
(
t
,
a
,
e
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
articleLabel
+
'
"
'
+
Util
.
htmlDecode
(
e
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/article/
"
+
t
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
?
admin
[
a
+
"
List
"
].
getList
(
1
):
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
add
:
function
(
a
,
i
){
if
(
admin
.
article
.
validate
()){
var
t
=
this
;
t
.
_addDisabled
(),
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
""
;
$
(
"
.signs button
"
).
each
(
function
(){
"
selected
"
===
this
.
className
&&
(
e
=
this
.
id
.
substr
(
this
.
id
.
length
-
1
,
1
))});
var
l
=
admin
.
editors
.
articleEditor
.
getContent
(),
s
=
admin
.
editors
.
abstractEditor
.
getContent
();
if
(
$
(
"
#articleThumbnail
"
).
prop
(
"
checked
"
)){
var
r
=
$
(
"
.thumbnail__img
"
).
css
(
"
background-image
"
);
l
=
"
.
replace
(
"
w/768
"
,
"
w/960
"
).
replace
(
"
h/432
"
,
"
h/540
"
)
+
"
)
\n\n
"
+
l
}
var
c
=
{
article
:{
articleTitle
:
$
(
"
#title
"
).
val
(),
articleContent
:
l
,
articleAbstract
:
s
,
articleTags
:
this
.
trimUniqueArray
(
$
(
"
#tag
"
).
val
()).
toString
(),
articlePermalink
:
$
(
"
#permalink
"
).
val
(),
articleStatus
:
a
,
articleSignId
:
e
,
postToCommunity
:
$
(
"
#postToCommunity
"
).
prop
(
"
checked
"
),
articleCommentable
:
$
(
"
#articleCommentable
"
).
prop
(
"
checked
"
),
articleViewPwd
:
$
(
"
#viewPwd
"
).
val
()}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/article/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
c
),
success
:
function
(
t
,
e
){
if
(
i
)
return
$
(
"
#tipMsg
"
).
text
(
Label
.
autoSaveLabel
),
void
(
admin
.
article
.
status
.
id
=
t
.
oId
);
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
(
0
===
a
?(
admin
.
article
.
status
.
id
=
void
0
,
admin
.
selectTab
(
"
article/article-list
"
)):
admin
.
selectTab
(
"
article/draft-list
"
),
admin
.
article
.
isConfirm
=!
1
)},
complete
:
function
(){
t
.
_removeDisabled
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
update
:
function
(
a
,
i
){
if
(
admin
.
article
.
validate
()){
var
l
=
this
;
l
.
_addDisabled
(),
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
""
;
$
(
"
.signs button
"
).
each
(
function
(){
"
selected
"
===
this
.
className
&&
(
t
=
this
.
id
.
substr
(
this
.
id
.
length
-
1
,
1
))});
var
e
=
admin
.
editors
.
articleEditor
.
getContent
(),
s
=
admin
.
editors
.
abstractEditor
.
getContent
();
if
(
$
(
"
#articleThumbnail
"
).
prop
(
"
checked
"
)){
var
r
=
$
(
"
.thumbnail__img
"
).
css
(
"
background-image
"
);
e
=
"
.
replace
(
"
w/768
"
,
"
w/960
"
).
replace
(
"
h/432
"
,
"
h/540
"
)
+
"
)
\n\n
"
+
e
}
var
c
=
{
article
:{
oId
:
this
.
status
.
id
,
articleTitle
:
$
(
"
#title
"
).
val
(),
articleContent
:
e
,
articleAbstract
:
s
,
articleTags
:
this
.
trimUniqueArray
(
$
(
"
#tag
"
).
val
()).
toString
(),
articlePermalink
:
$
(
"
#permalink
"
).
val
(),
articleStatus
:
a
,
articleSignId
:
t
,
articleCommentable
:
$
(
"
#articleCommentable
"
).
prop
(
"
checked
"
),
articleViewPwd
:
$
(
"
#viewPwd
"
).
val
(),
postToCommunity
:
$
(
"
#postToCommunity
"
).
prop
(
"
checked
"
)}};
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/article/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
c
),
success
:
function
(
t
,
e
){
i
?
$
(
"
#tipMsg
"
).
text
(
Label
.
autoSaveLabel
):(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
(
0
===
a
?
admin
.
selectTab
(
"
article/article-list
"
):
admin
.
selectTab
(
"
article/draft-list
"
),
$
(
"
#tipMsg
"
).
text
(
Label
.
updateSuccLabel
),
admin
.
article
.
status
.
id
=
void
0
,
admin
.
article
.
isConfirm
=!
1
))},
complete
:
function
(
t
,
e
){
l
.
_removeDisabled
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
setStatus
:
function
(){
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/tags
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
if
(
!
(
t
.
tags
.
length
<=
0
)){
$
(
"
#tagCheckboxPanel>span
"
).
remove
(
""
);
for
(
var
a
=
""
,
i
=
0
;
i
<
t
.
tags
.
length
;
i
++
)
a
+=
"
<span>
"
+
t
.
tags
[
i
].
tagTitle
+
"
</span>
"
;
$
(
"
#tagCheckboxPanel
"
).
html
(
a
+
'
<div class="fn__clear"></div>
'
),
$
(
"
#loadMsg
"
).
text
(
""
)}}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}),
this
.
status
?
this
.
status
.
isArticle
?(
$
(
"
#unSubmitArticle
"
).
show
(),
$
(
"
#saveArticle
"
).
hide
(),
$
(
"
#submitArticle
"
).
show
()):(
$
(
"
#submitArticle
"
).
show
(),
$
(
"
#unSubmitArticle
"
).
hide
(),
$
(
"
#saveArticle
"
).
show
()):(
$
(
"
#submitArticle
"
).
show
(),
$
(
"
#unSubmitArticle
"
).
hide
(),
$
(
"
#saveArticle
"
).
show
(),
$
(
"
#postToCommunityPanel
"
).
show
())},
clear
:
function
(){
this
.
status
=
{
id
:
void
0
,
isArticle
:
void
0
},
this
.
setStatus
(),
$
(
"
#title
"
).
val
(
""
),
admin
.
editors
.
articleEditor
.
setContent
(
""
),
admin
.
editors
.
abstractEditor
.
setContent
(
""
),
$
(
"
#tag
"
).
val
(
""
),
$
(
"
#tagCheckboxPanel
"
).
hide
().
find
(
"
span
"
).
removeClass
(
"
selected
"
),
$
(
"
#permalink
"
).
val
(
""
),
$
(
"
#articleCammentable
"
).
prop
(
"
checked
"
,
!
0
),
$
(
"
#postToCommunity
"
).
prop
(
"
checked
"
,
!
0
),
$
(
"
.signs button
"
).
each
(
function
(
t
){
this
.
className
=
0
===
t
?
"
selected
"
:
""
}),
$
(
"
#articleThumbnail
"
).
prop
(
"
checked
"
)
&&
$
(
"
#articleThumbnail
"
).
click
()},
init
:
function
(
t
){
$
(
"
.signs button
"
).
click
(
function
(
t
){
$
(
"
.signs button
"
).
removeClass
(
"
selected
"
),
$
(
this
).
addClass
(
"
selected
"
)}),
$
(
"
#tipMsg
"
).
text
(
Label
.
uploadMsg
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/tags
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
if
(
!
(
t
.
tags
.
length
<=
0
)){
for
(
var
a
=
[],
i
=
0
;
i
<
t
.
tags
.
length
;
i
++
)
a
.
push
(
t
.
tags
[
i
].
tagTitle
);
$
(
"
#tag
"
).
completed
({
height
:
160
,
buttonText
:
Label
.
selectLabel
,
data
:
a
}),
$
(
"
#loadMsg
"
).
text
(
""
)}}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}),
$
(
"
#submitArticle
"
).
click
(
function
(){
admin
.
article
.
status
.
id
?
admin
.
article
.
update
(
0
):
admin
.
article
.
add
(
0
)}),
$
(
"
#saveArticle
"
).
click
(
function
(){
admin
.
article
.
status
.
id
?
admin
.
article
.
update
(
admin
.
article
.
status
.
isArticle
?
0
:
1
):
admin
.
article
.
add
(
1
)}),
admin
.
editors
.
articleEditor
=
new
SoloEditor
({
id
:
"
articleContent
"
,
height
:
500
,
fun
:
t
,
previewShow
:
!
0
,
resize
:
!
1
}),
admin
.
editors
.
abstractEditor
=
new
SoloEditor
({
id
:
"
abstract
"
,
height
:
200
,
previewShow
:
!
1
,
resize
:
!
0
}),
admin
.
article
.
clearDraftTimer
(),
admin
.
article
.
autoSaveDraftTimer
=
setInterval
(
function
(){
admin
.
article
.
_autoSaveToDraft
()},
admin
.
article
.
AUTOSAVETIME
),
$
(
"
#articleThumbnailBtn
"
).
click
(
function
(){
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/thumbs?n=1&w=768&h=432
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
t
.
sc
?
$
(
"
#articleThumbnailBtn
"
).
prev
().
css
(
"
background-image
"
,
"
url(
"
+
t
.
data
[
0
]
+
"
)
"
):
$
(
"
#loadMsg
"
).
text
(
t
.
msg
)}})}).
click
()},
_autoSaveToDraft
:
function
(){
""
!==
$
(
"
#title
"
).
val
().
replace
(
/
\s
/g
,
""
)
&&
""
!==
admin
.
editors
.
articleEditor
.
getContent
().
replace
(
/
\s
/g
,
""
)
&&
(
admin
.
article
.
status
.
id
?
admin
.
article
.
status
.
isArticle
||
admin
.
article
.
update
(
1
,
!
0
):(
admin
.
article
.
add
(
1
,
!
0
),
admin
.
article
.
status
.
isArticle
=!
1
))},
clearDraftTimer
:
function
(){
""
!==
admin
.
article
.
autoSaveDraftTimer
&&
(
window
.
clearInterval
(
admin
.
article
.
autoSaveDraftTimer
),
admin
.
article
.
autoSaveDraftTimer
=
""
)},
validate
:
function
(){
var
t
=
admin
.
editors
.
articleEditor
.
getContent
();
if
(
""
===
$
(
"
#title
"
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
titleEmptyLabel
),
$
(
"
#title
"
).
focus
().
val
(
""
);
else
{
if
(
""
!==
t
.
replace
(
/
\s
/g
,
""
))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
contentEmptyLabel
)}
return
!
1
},
unPublish
:
function
(
a
){
var
i
=
this
;
i
.
_addDisabled
(),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/article/unpublish/
"
+
admin
.
article
.
status
.
id
,
type
:
"
PUT
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
a
?
$
(
"
#tipMsg
"
).
text
(
Label
.
autoSaveLabel
):(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
(
admin
.
selectTab
(
"
article/draft-list
"
),
admin
.
article
.
status
.
id
=
void
0
,
admin
.
article
.
isConfirm
=!
1
))},
complete
:
function
(
t
,
e
){
i
.
_removeDisabled
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
trimUniqueArray
:
function
(
t
){
for
(
var
e
=
(
t
=
t
.
toString
()).
split
(
"
,
"
),
a
=
0
;
a
<
e
.
length
;
a
++
)
e
[
a
]
=
e
[
a
].
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
""
===
e
[
a
]
&&
(
e
.
splice
(
a
,
1
),
a
--
);
return
$
.
unique
(
e
).
toString
()},
prePost
:
function
(){
if
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
admin
.
article
.
content
=
""
,
admin
.
editors
.
articleEditor
.
getContent
){
var
t
=
admin
.
editors
.
articleEditor
.
getContent
();
"
#article/article
"
===
window
.
location
.
hash
&&
""
!==
t
.
replace
(
/
\s
/g
,
""
)
&&
confirm
(
Label
.
editorPostLabel
)
&&
admin
.
article
.
clear
(),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#loadMsg
"
).
text
(
""
)}},
_addDisabled
:
function
(){
$
(
"
#unSubmitArticle
"
).
attr
(
"
disabled
"
,
"
disabled
"
),
$
(
"
#saveArticle
"
).
attr
(
"
disabled
"
,
"
disabled
"
),
$
(
"
#submitArticle
"
).
attr
(
"
disabled
"
,
"
disabled
"
)},
_removeDisabled
:
function
(){
$
(
"
#unSubmitArticle
"
).
removeAttr
(
"
disabled
"
),
$
(
"
#saveArticle
"
).
removeAttr
(
"
disabled
"
),
$
(
"
#submitArticle
"
).
removeAttr
(
"
disabled
"
)}},
admin
.
register
.
article
=
{
obj
:
admin
.
article
,
init
:
admin
.
article
.
init
,
refresh
:
function
(){
admin
.
editors
.
abstractEditor
.
setContent
(
""
),
admin
.
editors
.
articleEditor
.
setContent
(
""
),
$
(
"
#loadMsg
"
).
text
(
""
),
$
(
"
#tipMsg
"
).
text
(
Label
.
uploadMsg
)}};
admin
.
comment
=
{
open
:
function
(
e
,
t
){
this
.
getList
(
e
,
t
),
$
(
"
#
"
+
t
+
"
Comments
"
).
dialog
(
"
open
"
)},
getList
:
function
(
c
,
i
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#
"
+
i
+
"
Comments
"
).
html
(
""
);
var
e
=
"
article
"
;
"
page
"
===
i
&&
(
e
=
"
page
"
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/comments/
"
+
e
+
"
/
"
+
c
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
for
(
var
a
=
e
.
comments
,
n
=
""
,
m
=
0
;
m
<
a
.
length
;
m
++
){
var
o
=
"
<a target='_blank' href='
"
+
a
[
m
].
commentURL
+
"
'>
"
,
s
=
a
[
m
].
commentContent
,
l
=
Util
.
replaceEmString
(
s
);
"
http://
"
===
a
[
m
].
commentURL
&&
(
o
=
"
<a target='_blank'>
"
),
n
+=
"
<div class='comment-title'><span class='fn__left'>
"
+
o
+
a
[
m
].
commentName
+
"
</a>
"
,
a
[
m
].
commentOriginalCommentName
&&
(
n
+=
"
@
"
+
a
[
m
].
commentOriginalCommentName
),
n
+=
"
</span><span title='
"
+
Label
.
removeLabel
+
"
' class='fn__right deleteIcon' onclick=
\"
admin.comment.del('
"
+
a
[
m
].
oId
+
"
', '
"
+
i
+
"
', '
"
+
c
+
"
')
\"
></span><span class='fn__right'>
"
+
$
.
bowknot
.
getDate
(
a
[
m
].
commentTime
)
+
"
</span><div class='fn__clear'></div></div><div class='fn__margin12'>
"
+
l
+
"
</div>
"
}
""
===
n
&&
(
n
=
Label
.
noCommentLabel
),
$
(
"
#
"
+
i
+
"
Comments
"
).
html
(
n
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
del
:
function
(
e
,
a
,
n
){
if
(
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
commentLabel
+
"
?
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
t
=
"
article
"
;
"
page
"
===
a
&&
(
t
=
"
page
"
),
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/console/
"
+
t
+
"
/comment/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
admin
.
comment
.
getList
(
n
,
a
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}}};
...
...
src/main/webapp/js/admin/editor.js
View file @
2cc48d2b
...
...
@@ -19,7 +19,7 @@
* @fileoverview editor
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.2.0.
3, Feb 18
, 2019
* @version 1.2.0.
4, Mar 6
, 2019
*/
admin
.
editors
=
{}
...
...
@@ -43,6 +43,7 @@ $.extend(SoloEditor.prototype, {
init
:
function
()
{
this
.
editor
=
new
Vditor
(
this
.
conf
.
id
,
{
cache
:
true
,
tab
:
'
\t
'
,
hint
:
{
emojiPath
:
latkeConfig
.
staticServePath
+
'
/js/lib/emojify.js-1.1.0/images/basic
'
},
...
...
src/main/webapp/js/page.js
View file @
2cc48d2b
...
...
@@ -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.1.0.
0, Feb 21
, 2019
* @version 2.1.0.
1, Mar 6
, 2019
*/
var
Page
=
function
(
tips
)
{
this
.
currentCommentId
=
''
...
...
@@ -113,6 +113,7 @@ $.extend(Page.prototype, {
window
.
vditor
=
new
Vditor
(
'
soloEditorComment
'
,
{
placeholder
:
that
.
tips
.
commentContentCannotEmptyLabel
,
height
:
180
,
tab
:
'
\t
'
,
hint
:
{
emojiPath
:
latkeConfig
.
staticServePath
+
'
/js/lib/emojify.js-1.1.0/images/basic
'
},
...
...
src/main/webapp/js/page.min.js
View file @
2cc48d2b
var
Page
=
function
(
e
){
this
.
currentCommentId
=
""
,
this
.
tips
=
e
};
$
.
extend
(
Page
.
prototype
,{
replaceCommentsEm
:
function
(
e
){
for
(
var
t
=
$
(
e
),
o
=
0
;
o
<
t
.
length
;
o
++
){
var
i
=
t
[
o
].
innerHTML
;
t
[
o
].
innerHTML
=
Util
.
replaceEmString
(
i
)}},
parseLanguage
:
function
(
e
){
var
t
=!
1
;
$
(
"
.content-reset pre
"
).
each
(
function
(){
t
=!
0
}),
t
&&
(
document
.
createStyleSheet
?
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/highlight-9.13.1/styles/
"
+
(
e
&&
e
.
theme
||
"
github
"
)
+
"
.css
"
):
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/highlight-9.13.1/styles/
"
+
(
e
&&
e
.
theme
||
"
github
"
)
+
"
.css'>
"
)),
Label
.
markedAvailable
||
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/highlight-9.13.1/highlight.pack.js
"
,
dataType
:
"
script
"
,
cache
:
!
0
,
success
:
function
(){
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
()}}))},
load
:
function
(
e
){
var
t
=
this
;
t
.
parseLanguage
(
e
),
$
(
"
#comment
"
).
click
(
function
(){
t
.
toggleEditor
()}).
attr
(
"
readonly
"
,
"
readonly
"
),
$
(
"
#soloEditorCancel
"
).
click
(
function
(){
t
.
toggleEditor
()}),
$
(
"
#soloEditorAdd
"
).
click
(
function
(){
t
.
submitComment
()})},
toggleEditor
:
function
(
e
,
t
){
var
o
=
this
;
"
undefined
"
==
typeof
Vditor
&&
$
.
ajax
({
method
:
"
GET
"
,
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/vditor-0.4.0/index.min.js
"
,
dataType
:
"
script
"
,
cache
:
!
0
,
async
:
!
1
,
success
:
function
(){
window
.
vditor
=
new
Vditor
(
"
soloEditorComment
"
,{
placeholder
:
o
.
tips
.
commentContentCannotEmptyLabel
,
height
:
180
,
hint
:{
emojiPath
:
latkeConfig
.
staticServePath
+
"
/js/lib/emojify.js-1.1.0/images/basic
"
},
esc
:
function
(){
$
(
"
#soloEditorCancel
"
).
click
()},
ctrlEnter
:
function
(){
$
(
"
#soloEditorAdd
"
).
click
()},
preview
:{
delay
:
500
,
show
:
!
1
,
url
:
latkeConfig
.
servePath
+
"
/console/markdown/2html
"
,
parse
:
function
(
e
){
"
none
"
!==
e
.
style
.
display
&&
(
Util
.
parseMarkdown
(
"
content-reset
"
),
Label
.
markedAvailable
||
(
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
()))}},
counter
:
500
,
resize
:{
enable
:
!
0
,
position
:
"
top
"
,
after
:
function
(){
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
$
(
"
#soloEditor
"
).
outerHeight
())}},
lang
:
o
.
tips
.
langLabel
,
toolbar
:[
"
emoji
"
,
"
headings
"
,
"
bold
"
,
"
italic
"
,
"
strike
"
,
"
|
"
,
"
line
"
,
"
quote
"
,
"
|
"
,
"
list
"
,
"
ordered-list
"
,
"
check
"
,
"
|
"
,
"
code
"
,
"
inline-code
"
,
"
|
"
,
"
undo
"
,
"
redo
"
,
"
|
"
,
"
link
"
,
"
table
"
,
"
|
"
,
"
preview
"
,
"
fullscreen
"
,
"
info
"
,
"
help
"
],
classes
:{
preview
:
"
content__reset
"
}}),
vditor
.
focus
()}});
var
i
=
$
(
"
#soloEditor
"
);
0
!==
i
.
length
?
"
0px
"
===
$
(
"
body
"
).
css
(
"
padding-bottom
"
)
||
e
?(
$
(
"
#soloEditorError
"
).
text
(
""
),
i
.
css
({
bottom
:
"
0
"
,
opacity
:
1
}),
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
"
238px
"
),
this
.
currentCommentId
=
e
,
$
(
"
#soloEditorReplyTarget
"
).
text
(
t
?
"
@
"
+
t
:
""
),
"
undefined
"
!=
typeof
vditor
&&
vditor
.
focus
()):(
i
.
css
({
bottom
:
"
-300px
"
,
opacity
:
0
}),
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
0
)):
location
.
href
=
latkeConfig
.
servePath
+
"
/start
"
},
loadRandomArticles
:
function
(
s
){
var
c
=
this
.
tips
.
randomArticles1Label
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/articles/random
"
,
type
:
"
POST
"
,
success
:
function
(
e
,
t
){
var
o
=
e
.
randomArticles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
l
=
o
[
n
],
a
=
l
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
latkeConfig
.
servePath
+
l
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
r
=
(
s
||
"
<h4>
"
+
c
+
"
</h4>
"
)
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#randomArticles
"
).
append
(
r
)}
else
$
(
"
#randomArticles
"
).
remove
()}})},
loadRelevantArticles
:
function
(
e
,
s
){
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/article/id/
"
+
e
+
"
/relevant/articles
"
,
type
:
"
GET
"
,
success
:
function
(
e
,
t
){
var
o
=
e
.
relevantArticles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
l
=
o
[
n
],
a
=
l
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
latkeConfig
.
servePath
+
l
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
r
=
s
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#relevantArticles
"
).
append
(
r
)}
else
$
(
"
#relevantArticles
"
).
remove
()},
error
:
function
(){
$
(
"
#relevantArticles
"
).
remove
()}})},
loadExternalRelevantArticles
:
function
(
e
,
s
){
var
c
=
this
.
tips
;
try
{
$
.
ajax
({
url
:
"
https://rhythm.b3log.org/get-articles-by-tags.do?tags=
"
+
e
+
"
&blogHost=
"
+
c
.
blogHost
+
"
&paginationPageSize=
"
+
c
.
externalRelevantArticlesDisplayCount
,
type
:
"
GET
"
,
cache
:
!
0
,
dataType
:
"
jsonp
"
,
error
:
function
(){
$
(
"
#externalRelevantArticles
"
).
remove
()},
success
:
function
(
e
,
t
){
var
o
=
e
.
articles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
l
=
o
[
n
],
a
=
l
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' target='_blank' href='
"
+
l
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
r
=
(
s
||
"
<h4>
"
+
c
.
externalRelevantArticles1Label
+
"
</h4>
"
)
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#externalRelevantArticles
"
).
append
(
r
)}
else
$
(
"
#externalRelevantArticles
"
).
remove
()}})}
catch
(
e
){}},
submitComment
:
function
(){
var
t
=
this
,
e
=
this
.
tips
,
o
=
"
article
"
;
if
(
void
0
===
e
.
externalRelevantArticlesDisplayCount
&&
(
o
=
"
page
"
),
1
<
vditor
.
getValue
().
length
&&
vditor
.
getValue
().
length
<
500
){
$
(
"
#soloEditorAdd
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
var
i
=
{
oId
:
e
.
oId
,
commentContent
:
vditor
.
getValue
()};
this
.
currentCommentId
&&
(
i
.
commentOriginalCommentId
=
this
.
currentCommentId
),
$
.
ajax
({
type
:
"
POST
"
,
url
:
latkeConfig
.
servePath
+
"
/
"
+
o
+
"
/comments
"
,
cache
:
!
1
,
contentType
:
"
application/json
"
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
e
){
$
(
"
#soloEditorAdd
"
).
removeAttr
(
"
disabled
"
),
e
.
sc
?(
t
.
toggleEditor
(),
vditor
.
setValue
(
""
),
t
.
addCommentAjax
(
Util
.
replaceEmString
(
e
.
cmtTpl
))):
$
(
"
#soloEditorError
"
).
html
(
e
.
msg
)}})}
else
$
(
"
#soloEditorError
"
).
text
(
t
.
tips
.
commentContentCannotEmptyLabel
)},
addReplyForm
:
function
(
e
,
t
){
this
.
currentCommentId
=
e
,
this
.
toggleEditor
(
e
,
t
)},
hideComment
:
function
(
e
){
$
(
"
#commentRef
"
+
e
).
hide
()},
showComment
:
function
(
e
,
t
,
o
,
i
){
var
n
=
parseInt
(
$
(
e
).
position
().
top
);
if
(
i
&&
(
n
=
parseInt
(
$
(
e
).
parents
(
i
).
position
().
top
)),
0
<
$
(
"
#commentRef
"
+
t
).
length
)
$
(
"
#commentRef
"
+
t
).
show
().
css
(
"
top
"
,
n
+
o
+
"
px
"
);
else
{
var
l
=
$
(
"
#
"
+
t
).
clone
();
l
.
addClass
(
"
comment-body-ref
"
).
attr
(
"
id
"
,
"
commentRef
"
+
t
),
l
.
find
(
"
#replyForm
"
).
remove
(),
$
(
"
#comments
"
).
append
(
l
),
$
(
"
#commentRef
"
+
t
).
css
(
"
top
"
,
n
+
o
+
"
px
"
)}},
addCommentAjax
:
function
(
e
){
0
<
$
(
"
#comments
"
).
children
().
length
?
$
(
$
(
"
#comments
"
).
children
()[
0
]).
before
(
e
):
$
(
"
#comments
"
).
html
(
e
),
window
.
location
.
hash
=
"
#comments
"
}});
\ No newline at end of file
var
Page
=
function
(
e
){
this
.
currentCommentId
=
""
,
this
.
tips
=
e
};
$
.
extend
(
Page
.
prototype
,{
replaceCommentsEm
:
function
(
e
){
for
(
var
t
=
$
(
e
),
o
=
0
;
o
<
t
.
length
;
o
++
){
var
i
=
t
[
o
].
innerHTML
;
t
[
o
].
innerHTML
=
Util
.
replaceEmString
(
i
)}},
parseLanguage
:
function
(
e
){
var
t
=!
1
;
$
(
"
.content-reset pre
"
).
each
(
function
(){
t
=!
0
}),
t
&&
(
document
.
createStyleSheet
?
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/highlight-9.13.1/styles/
"
+
(
e
&&
e
.
theme
||
"
github
"
)
+
"
.css
"
):
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/highlight-9.13.1/styles/
"
+
(
e
&&
e
.
theme
||
"
github
"
)
+
"
.css'>
"
)),
Label
.
markedAvailable
||
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/highlight-9.13.1/highlight.pack.js
"
,
dataType
:
"
script
"
,
cache
:
!
0
,
success
:
function
(){
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
()}}))},
load
:
function
(
e
){
var
t
=
this
;
t
.
parseLanguage
(
e
),
$
(
"
#comment
"
).
click
(
function
(){
t
.
toggleEditor
()}).
attr
(
"
readonly
"
,
"
readonly
"
),
$
(
"
#soloEditorCancel
"
).
click
(
function
(){
t
.
toggleEditor
()}),
$
(
"
#soloEditorAdd
"
).
click
(
function
(){
t
.
submitComment
()})},
toggleEditor
:
function
(
e
,
t
){
var
o
=
this
;
"
undefined
"
==
typeof
Vditor
&&
$
.
ajax
({
method
:
"
GET
"
,
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/vditor-0.4.0/index.min.js
"
,
dataType
:
"
script
"
,
cache
:
!
0
,
async
:
!
1
,
success
:
function
(){
window
.
vditor
=
new
Vditor
(
"
soloEditorComment
"
,{
placeholder
:
o
.
tips
.
commentContentCannotEmptyLabel
,
height
:
180
,
tab
:
"
\t
"
,
hint
:{
emojiPath
:
latkeConfig
.
staticServePath
+
"
/js/lib/emojify.js-1.1.0/images/basic
"
},
esc
:
function
(){
$
(
"
#soloEditorCancel
"
).
click
()},
ctrlEnter
:
function
(){
$
(
"
#soloEditorAdd
"
).
click
()},
preview
:{
delay
:
500
,
show
:
!
1
,
url
:
latkeConfig
.
servePath
+
"
/console/markdown/2html
"
,
parse
:
function
(
e
){
"
none
"
!==
e
.
style
.
display
&&
(
Util
.
parseMarkdown
(
"
content-reset
"
),
Label
.
markedAvailable
||
(
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
()))}},
counter
:
500
,
resize
:{
enable
:
!
0
,
position
:
"
top
"
,
after
:
function
(){
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
$
(
"
#soloEditor
"
).
outerHeight
())}},
lang
:
o
.
tips
.
langLabel
,
toolbar
:[
"
emoji
"
,
"
headings
"
,
"
bold
"
,
"
italic
"
,
"
strike
"
,
"
|
"
,
"
line
"
,
"
quote
"
,
"
|
"
,
"
list
"
,
"
ordered-list
"
,
"
check
"
,
"
|
"
,
"
code
"
,
"
inline-code
"
,
"
|
"
,
"
undo
"
,
"
redo
"
,
"
|
"
,
"
link
"
,
"
table
"
,
"
|
"
,
"
preview
"
,
"
fullscreen
"
,
"
info
"
,
"
help
"
],
classes
:{
preview
:
"
content__reset
"
}}),
vditor
.
focus
()}});
var
i
=
$
(
"
#soloEditor
"
);
0
!==
i
.
length
?
"
0px
"
===
$
(
"
body
"
).
css
(
"
padding-bottom
"
)
||
e
?(
$
(
"
#soloEditorError
"
).
text
(
""
),
i
.
css
({
bottom
:
"
0
"
,
opacity
:
1
}),
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
"
238px
"
),
this
.
currentCommentId
=
e
,
$
(
"
#soloEditorReplyTarget
"
).
text
(
t
?
"
@
"
+
t
:
""
),
"
undefined
"
!=
typeof
vditor
&&
vditor
.
focus
()):(
i
.
css
({
bottom
:
"
-300px
"
,
opacity
:
0
}),
$
(
"
body
"
).
css
(
"
padding-bottom
"
,
0
)):
location
.
href
=
latkeConfig
.
servePath
+
"
/start
"
},
loadRandomArticles
:
function
(
s
){
var
c
=
this
.
tips
.
randomArticles1Label
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/articles/random
"
,
type
:
"
POST
"
,
success
:
function
(
e
,
t
){
var
o
=
e
.
randomArticles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
l
=
o
[
n
],
a
=
l
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
latkeConfig
.
servePath
+
l
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
r
=
(
s
||
"
<h4>
"
+
c
+
"
</h4>
"
)
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#randomArticles
"
).
append
(
r
)}
else
$
(
"
#randomArticles
"
).
remove
()}})},
loadRelevantArticles
:
function
(
e
,
s
){
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/article/id/
"
+
e
+
"
/relevant/articles
"
,
type
:
"
GET
"
,
success
:
function
(
e
,
t
){
var
o
=
e
.
relevantArticles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
l
=
o
[
n
],
a
=
l
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' href='
"
+
latkeConfig
.
servePath
+
l
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
r
=
s
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#relevantArticles
"
).
append
(
r
)}
else
$
(
"
#relevantArticles
"
).
remove
()},
error
:
function
(){
$
(
"
#relevantArticles
"
).
remove
()}})},
loadExternalRelevantArticles
:
function
(
e
,
s
){
var
c
=
this
.
tips
;
try
{
$
.
ajax
({
url
:
"
https://rhythm.b3log.org/get-articles-by-tags.do?tags=
"
+
e
+
"
&blogHost=
"
+
c
.
blogHost
+
"
&paginationPageSize=
"
+
c
.
externalRelevantArticlesDisplayCount
,
type
:
"
GET
"
,
cache
:
!
0
,
dataType
:
"
jsonp
"
,
error
:
function
(){
$
(
"
#externalRelevantArticles
"
).
remove
()},
success
:
function
(
e
,
t
){
var
o
=
e
.
articles
;
if
(
o
&&
0
!==
o
.
length
){
for
(
var
i
=
""
,
n
=
0
;
n
<
o
.
length
;
n
++
){
var
l
=
o
[
n
],
a
=
l
.
articleTitle
;
i
+=
"
<li><a rel='nofollow' title='
"
+
a
+
"
' target='_blank' href='
"
+
l
.
articlePermalink
+
"
'>
"
+
a
+
"
</a></li>
"
}
var
r
=
(
s
||
"
<h4>
"
+
c
.
externalRelevantArticles1Label
+
"
</h4>
"
)
+
"
<ul>
"
+
i
+
"
</ul>
"
;
$
(
"
#externalRelevantArticles
"
).
append
(
r
)}
else
$
(
"
#externalRelevantArticles
"
).
remove
()}})}
catch
(
e
){}},
submitComment
:
function
(){
var
t
=
this
,
e
=
this
.
tips
,
o
=
"
article
"
;
if
(
void
0
===
e
.
externalRelevantArticlesDisplayCount
&&
(
o
=
"
page
"
),
1
<
vditor
.
getValue
().
length
&&
vditor
.
getValue
().
length
<
500
){
$
(
"
#soloEditorAdd
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
var
i
=
{
oId
:
e
.
oId
,
commentContent
:
vditor
.
getValue
()};
this
.
currentCommentId
&&
(
i
.
commentOriginalCommentId
=
this
.
currentCommentId
),
$
.
ajax
({
type
:
"
POST
"
,
url
:
latkeConfig
.
servePath
+
"
/
"
+
o
+
"
/comments
"
,
cache
:
!
1
,
contentType
:
"
application/json
"
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
e
){
$
(
"
#soloEditorAdd
"
).
removeAttr
(
"
disabled
"
),
e
.
sc
?(
t
.
toggleEditor
(),
vditor
.
setValue
(
""
),
t
.
addCommentAjax
(
Util
.
replaceEmString
(
e
.
cmtTpl
))):
$
(
"
#soloEditorError
"
).
html
(
e
.
msg
)}})}
else
$
(
"
#soloEditorError
"
).
text
(
t
.
tips
.
commentContentCannotEmptyLabel
)},
addReplyForm
:
function
(
e
,
t
){
this
.
currentCommentId
=
e
,
this
.
toggleEditor
(
e
,
t
)},
hideComment
:
function
(
e
){
$
(
"
#commentRef
"
+
e
).
hide
()},
showComment
:
function
(
e
,
t
,
o
,
i
){
var
n
=
parseInt
(
$
(
e
).
position
().
top
);
if
(
i
&&
(
n
=
parseInt
(
$
(
e
).
parents
(
i
).
position
().
top
)),
0
<
$
(
"
#commentRef
"
+
t
).
length
)
$
(
"
#commentRef
"
+
t
).
show
().
css
(
"
top
"
,
n
+
o
+
"
px
"
);
else
{
var
l
=
$
(
"
#
"
+
t
).
clone
();
l
.
addClass
(
"
comment-body-ref
"
).
attr
(
"
id
"
,
"
commentRef
"
+
t
),
l
.
find
(
"
#replyForm
"
).
remove
(),
$
(
"
#comments
"
).
append
(
l
),
$
(
"
#commentRef
"
+
t
).
css
(
"
top
"
,
n
+
o
+
"
px
"
)}},
addCommentAjax
:
function
(
e
){
0
<
$
(
"
#comments
"
).
children
().
length
?
$
(
$
(
"
#comments
"
).
children
()[
0
]).
before
(
e
):
$
(
"
#comments
"
).
html
(
e
),
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