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
f8dcb628
Unverified
Commit
f8dcb628
authored
Mar 31, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '3.5.0-dev'
parents
0c7a1486
c2eb30aa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
8 deletions
+9
-8
gulpfile.js
gulpfile.js
+1
-1
src/main/webapp/js/admin/admin.js
src/main/webapp/js/admin/admin.js
+2
-2
src/main/webapp/js/admin/admin.min.js
src/main/webapp/js/admin/admin.min.js
+4
-3
src/main/webapp/js/common.min.js
src/main/webapp/js/common.min.js
+1
-1
src/main/webapp/skins
src/main/webapp/skins
+1
-1
No files found.
gulpfile.js
View file @
f8dcb628
...
@@ -79,7 +79,7 @@ function miniAdmin () {
...
@@ -79,7 +79,7 @@ function miniAdmin () {
'
./src/main/webapp/js/admin/others.js
'
,
'
./src/main/webapp/js/admin/others.js
'
,
'
./src/main/webapp/js/admin/linkList.js
'
,
'
./src/main/webapp/js/admin/linkList.js
'
,
'
./src/main/webapp/js/admin/preference.js
'
,
'
./src/main/webapp/js/admin/preference.js
'
,
'
./src/main/webapp/js/admin/theme
-l
ist.js
'
,
'
./src/main/webapp/js/admin/theme
L
ist.js
'
,
'
./src/main/webapp/js/admin/pluginList.js
'
,
'
./src/main/webapp/js/admin/pluginList.js
'
,
'
./src/main/webapp/js/admin/userList.js
'
,
'
./src/main/webapp/js/admin/userList.js
'
,
'
./src/main/webapp/js/admin/categoryList.js
'
,
'
./src/main/webapp/js/admin/categoryList.js
'
,
...
...
src/main/webapp/js/admin/admin.js
View file @
f8dcb628
...
@@ -233,7 +233,7 @@ $.extend(Admin.prototype, {
...
@@ -233,7 +233,7 @@ $.extend(Admin.prototype, {
},
6000
)
},
6000
)
$
(
'
#loadMsg
'
).
text
(
''
)
$
(
'
#loadMsg
'
).
text
(
''
)
window
.
onbeforeunload
=
(
event
)
=>
{
window
.
onbeforeunload
=
function
(
event
)
{
if
(
window
.
location
.
hash
===
'
#article/article
'
)
{
if
(
window
.
location
.
hash
===
'
#article/article
'
)
{
if
(
event
)
{
if
(
event
)
{
event
.
returnValue
=
Label
.
editorLeaveLabel
event
.
returnValue
=
Label
.
editorLeaveLabel
...
@@ -244,7 +244,7 @@ $.extend(Admin.prototype, {
...
@@ -244,7 +244,7 @@ $.extend(Admin.prototype, {
$
(
document
).
ajaxError
(
function
(
event
,
xhr
,
options
,
exc
)
{
$
(
document
).
ajaxError
(
function
(
event
,
xhr
,
options
,
exc
)
{
if
(
xhr
.
status
!==
200
)
{
if
(
xhr
.
status
!==
200
)
{
$
(
'
#tipMsg
'
).
text
(
xhr
.
status
+
'
:
'
+
exc
)
$
(
'
#tipMsg
'
).
text
(
xhr
.
status
+
'
:
'
+
exc
)
}
}
})
})
},
},
...
...
src/main/webapp/js/admin/admin.min.js
View file @
f8dcb628
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
=
Label
.
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
;
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
"
,
"
#
theme-list
"
,
"
#link-list
"
,
"
#preference
"
,
"
#user-list
"
,
"
#plugin-list
"
,
"
#others
"
,
"
#category-list
"
],
this
.
adTools
=
[
"
link-list
"
,
"
preference
"
,
"
theme-list
"
,
"
page-list
"
,
"
user-list
"
,
"
plugin-list
"
,
"
others
"
,
"
category-list
"
]};
$
.
extend
(
Admin
.
prototype
,{
logout
:
function
(){
window
.
location
.
href
=
Label
.
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
){
try
{
if
(
admin
.
editors
.
articleEditor
.
getContent
){
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
){
console
.
log
(
t
)}
"
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
(
""
),
window
.
onbeforeunload
=
function
(
t
){
if
(
"
#article/article
"
===
window
.
location
.
hash
)
return
t
&&
(
t
.
returnValue
=
Label
.
editorLeaveLabel
),
Label
.
editorLeaveLabel
},
$
(
document
).
ajaxError
(
function
(
t
,
e
,
i
,
a
){
200
!==
e
.
status
&&
$
(
"
#tipMsg
"
).
text
(
e
.
status
+
"
:
"
+
a
)}
)},
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
(
t
){
this
.
conf
=
t
,
this
.
init
()};
$
.
extend
(
SoloEditor
.
prototype
,{
init
:
function
(){
this
.
editor
=
new
Vditor
(
this
.
conf
.
id
,{
cache
:
!
0
,
tab
:
"
\t
"
,
hint
:{
emojiPath
:
Label
.
staticServePath
+
"
/js/lib/emojify.js-1.1.0/images/basic
"
},
preview
:{
delay
:
500
,
show
:
this
.
conf
.
previewShow
,
url
:
Label
.
servePath
+
"
/console/markdown/2html
"
,
parse
:
function
(
t
){
"
none
"
!==
t
.
style
.
display
&&
Util
.
parseLanguage
()}},
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
}),
"
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
=
{};
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
:
Label
.
staticServePath
+
"
/js/lib/emojify.js-1.1.0/images/basic
"
},
preview
:{
delay
:
500
,
show
:
this
.
conf
.
previewShow
,
url
:
Label
.
servePath
+
"
/console/markdown/2html
"
,
parse
:
function
(
t
){
"
none
"
!==
t
.
style
.
display
&&
Util
.
parseLanguage
()}},
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
}),
"
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
}});
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
:
Label
.
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
:
Label
.
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
:
Label
.
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
:
Label
.
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
:
Label
.
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
:
Label
.
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
:
Label
.
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
:
Label
.
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
.
article
=
{
isConfirm
:
!
0
,
status
:{
id
:
void
0
,
isArticle
:
void
0
},
content
:
""
,
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
:
Label
.
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
i
=
e
.
article
.
articleTags
,
a
=
""
,
l
=
0
;
l
<
i
.
length
;
l
++
)
0
===
l
?
a
=
i
[
l
].
tagTitle
:
a
+=
"
,
"
+
i
[
l
].
tagTitle
;
$
(
"
#tag
"
).
val
(
a
),
$
(
"
#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
,
i
,
e
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
articleLabel
+
'
"
'
+
Util
.
htmlDecode
(
e
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/article/
"
+
t
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
?
admin
[
i
+
"
List
"
].
getList
(
1
):
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
add
:
function
(
e
){
if
(
admin
.
article
.
validate
()){
var
i
=
this
;
i
.
_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
a
=
admin
.
editors
.
articleEditor
.
getContent
(),
l
=
admin
.
editors
.
abstractEditor
.
getContent
();
if
(
$
(
"
#articleThumbnail
"
).
prop
(
"
checked
"
)){
var
s
=
$
(
"
.thumbnail__img
"
).
css
(
"
background-image
"
);
a
=
"
.
replace
(
"
w/768
"
,
"
w/960
"
).
replace
(
"
h/432
"
,
"
h/540
"
)
+
"
)
\n\n
"
+
a
}
var
c
=
{
article
:{
articleTitle
:
$
(
"
#title
"
).
val
(),
articleContent
:
a
,
articleAbstract
:
l
,
articleTags
:
this
.
trimUniqueArray
(
$
(
"
#tag
"
).
val
()).
toString
(),
articlePermalink
:
$
(
"
#permalink
"
).
val
(),
articleStatus
:
e
,
articleSignId
:
t
,
postToCommunity
:
$
(
"
#postToCommunity
"
).
prop
(
"
checked
"
),
articleCommentable
:
$
(
"
#articleCommentable
"
).
prop
(
"
checked
"
),
articleViewPwd
:
$
(
"
#viewPwd
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/article/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
c
),
success
:
function
(
t
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
(
admin
.
article
.
status
.
id
=
void
0
,
0
===
e
?
admin
.
selectTab
(
"
article/article-list
"
):
admin
.
selectTab
(
"
article/draft-list
"
),
admin
.
article
.
isConfirm
=!
1
)},
complete
:
function
(
t
,
e
){
i
.
_removeDisabled
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
update
:
function
(
i
){
if
(
admin
.
article
.
validate
()){
var
a
=
this
;
a
.
_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
(),
l
=
admin
.
editors
.
abstractEditor
.
getContent
();
if
(
$
(
"
#articleThumbnail
"
).
prop
(
"
checked
"
)){
var
s
=
$
(
"
.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
:
l
,
articleTags
:
this
.
trimUniqueArray
(
$
(
"
#tag
"
).
val
()).
toString
(),
articlePermalink
:
$
(
"
#permalink
"
).
val
(),
articleStatus
:
i
,
articleSignId
:
t
,
articleCommentable
:
$
(
"
#articleCommentable
"
).
prop
(
"
checked
"
),
articleViewPwd
:
$
(
"
#viewPwd
"
).
val
(),
postToCommunity
:
$
(
"
#postToCommunity
"
).
prop
(
"
checked
"
)}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/article/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
c
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
(
0
===
i
?
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
){
a
.
_removeDisabled
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
setStatus
:
function
(){
$
.
ajax
({
url
:
Label
.
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
i
=
""
,
a
=
0
;
a
<
t
.
tags
.
length
;
a
++
)
i
+=
"
<span>
"
+
t
.
tags
[
a
].
tagTitle
+
"
</span>
"
;
$
(
"
#tagCheckboxPanel
"
).
html
(
i
+
'
<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
:
Label
.
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
i
=
[],
a
=
0
;
a
<
t
.
tags
.
length
;
a
++
)
i
.
push
(
t
.
tags
[
a
].
tagTitle
);
$
(
"
#tag
"
).
completed
({
height
:
160
,
buttonText
:
Label
.
selectLabel
,
data
:
i
}),
$
(
"
#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
}),
$
(
"
#articleThumbnailBtn
"
).
click
(
function
(){
$
.
ajax
({
url
:
Label
.
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
()},
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
(){
var
i
=
this
;
i
.
_addDisabled
(),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/article/unpublish/
"
+
admin
.
article
.
status
.
id
,
type
:
"
PUT
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#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
(
"
,
"
),
i
=
0
;
i
<
e
.
length
;
i
++
)
e
[
i
]
=
e
[
i
].
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
""
===
e
[
i
]
&&
(
e
.
splice
(
i
,
1
),
i
--
);
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
(
i
,
c
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#
"
+
c
+
"
Comments
"
).
html
(
""
);
var
e
=
"
article
"
;
"
page
"
===
c
&&
(
e
=
"
page
"
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/comments/
"
+
e
+
"
/
"
+
i
,
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
s
=
"
<a target='_blank' href='
"
+
a
[
m
].
commentURL
+
"
'>
"
,
l
=
a
[
m
].
commentContent
,
o
=
Util
.
replaceEmString
(
l
);
"
http://
"
===
a
[
m
].
commentURL
&&
(
s
=
"
<a target='_blank'>
"
),
n
+=
"
<div class='comment-title'><span class='fn__left'>
"
+
s
+
a
[
m
].
commentName
+
"
</a>
"
,
a
[
m
].
commentOriginalCommentName
&&
(
n
+=
"
@
"
+
a
[
m
].
commentOriginalCommentName
),
n
+=
"
</span><a title='
"
+
Label
.
removeLabel
+
"
' class='fn__right fn__pointer' href=
\"
javascript:admin.comment.del('
"
+
a
[
m
].
oId
+
"
', '
"
+
c
+
"
', '
"
+
i
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a><span class='fn__right'>
"
+
$
.
bowknot
.
getDate
(
a
[
m
].
commentTime
)
+
"
</span><div class='fn__clear'></div></div><div class='vditor-reset'>
"
+
o
+
"
</div>
"
}
""
===
n
&&
(
n
=
Label
.
noCommentLabel
),
$
(
"
#
"
+
c
+
"
Comments
"
).
html
(
n
),
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
$
(
"
#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
:
Label
.
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
(
""
)}})}}};
admin
.
comment
=
{
open
:
function
(
e
,
t
){
this
.
getList
(
e
,
t
),
$
(
"
#
"
+
t
+
"
Comments
"
).
dialog
(
"
open
"
)},
getList
:
function
(
i
,
c
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#
"
+
c
+
"
Comments
"
).
html
(
""
);
var
e
=
"
article
"
;
"
page
"
===
c
&&
(
e
=
"
page
"
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/comments/
"
+
e
+
"
/
"
+
i
,
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
s
=
"
<a target='_blank' href='
"
+
a
[
m
].
commentURL
+
"
'>
"
,
l
=
a
[
m
].
commentContent
,
o
=
Util
.
replaceEmString
(
l
);
"
http://
"
===
a
[
m
].
commentURL
&&
(
s
=
"
<a target='_blank'>
"
),
n
+=
"
<div class='comment-title'><span class='fn__left'>
"
+
s
+
a
[
m
].
commentName
+
"
</a>
"
,
a
[
m
].
commentOriginalCommentName
&&
(
n
+=
"
@
"
+
a
[
m
].
commentOriginalCommentName
),
n
+=
"
</span><a title='
"
+
Label
.
removeLabel
+
"
' class='fn__right fn__pointer' href=
\"
javascript:admin.comment.del('
"
+
a
[
m
].
oId
+
"
', '
"
+
c
+
"
', '
"
+
i
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a><span class='fn__right'>
"
+
$
.
bowknot
.
getDate
(
a
[
m
].
commentTime
)
+
"
</span><div class='fn__clear'></div></div><div class='vditor-reset'>
"
+
o
+
"
</div>
"
}
""
===
n
&&
(
n
=
Label
.
noCommentLabel
),
$
(
"
#
"
+
c
+
"
Comments
"
).
html
(
n
),
Util
.
parseMarkdown
(),
Util
.
parseLanguage
(),
$
(
"
#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
:
Label
.
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
(
""
)}})}}};
admin
.
articleList
=
{
tablePagination
:
new
TablePaginate
(
"
article
"
),
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
text
:
Label
.
titleLabel
,
index
:
"
title
"
,
minWidth
:
110
,
style
:
"
padding-left: 12px;font-size:14px;
"
},{
text
:
Label
.
authorLabel
,
index
:
"
author
"
,
width
:
150
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
commentLabel
,
index
:
"
comments
"
,
width
:
80
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
viewLabel
,
width
:
60
,
index
:
"
articleViewCount
"
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
dateLabel
,
index
:
"
date
"
,
width
:
90
,
style
:
"
padding-left: 12px;
"
}]),
this
.
tablePagination
.
initPagination
(),
this
.
tablePagination
.
initCommentsDialog
(),
this
.
getList
(
t
);
var
e
=
this
;
$
(
"
#articleListBtn
"
).
click
(
function
(){
e
.
getList
(
t
)})},
syncToHacpai
:
function
(
t
){
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/article/push2rhy?id=
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
Label
.
pushSuccLabel
)}})},
getList
:
function
(
c
){
var
o
=
this
;
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/articles/status/published/
"
+
c
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
+
"
?k=
"
+
$
(
"
#articleListInput
"
).
val
(),
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
for
(
var
a
=
t
.
articles
,
i
=
[],
l
=
0
;
l
<
a
.
length
;
l
++
){
i
[
l
]
=
{},
i
[
l
].
title
=
'
<a href="
'
+
Label
.
servePath
+
a
[
l
].
articlePermalink
+
"
\"
target='_blank' title='
"
+
a
[
l
].
articleTitle
+
"
' class='no-underline'>
"
+
a
[
l
].
articleTitle
+
"
</a><span class='table-tag'>
"
+
a
[
l
].
articleTags
+
"
</span>
"
,
i
[
l
].
date
=
$
.
bowknot
.
getDate
(
a
[
l
].
articleCreateTime
),
i
[
l
].
comments
=
a
[
l
].
articleCommentCount
,
i
[
l
].
articleViewCount
=
a
[
l
].
articleViewCount
,
i
[
l
].
author
=
a
[
l
].
authorName
;
var
n
=
a
[
l
].
articlePutTop
?
Label
.
cancelPutTopLabel
:
Label
.
putTopLabel
;
i
[
l
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.article.get('
"
+
a
[
l
].
oId
+
"
', true)
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.article.del('
"
+
a
[
l
].
oId
+
"
', 'article', '
"
+
encodeURIComponent
(
a
[
l
].
articleTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.articleList.syncToHacpai('
"
+
a
[
l
].
oId
+
"
')
\"
>
"
+
Label
.
pushToHacpaiLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.articleList.popTop(this, '
"
+
a
[
l
].
oId
+
"
')
\"
>
"
+
n
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.comment.open('
"
+
a
[
l
].
oId
+
"
', 'article')
\"
>
"
+
Label
.
commentLabel
+
"
</a>
"
}
o
.
tablePagination
.
updateTablePagination
(
i
,
c
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
popTop
:
function
(
t
,
e
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
a
=
$
(
t
),
i
=
"
canceltop
"
,
l
=
Label
.
putTopLabel
;
a
.
html
()
===
Label
.
putTopLabel
&&
(
i
=
"
puttop
"
,
l
=
Label
.
cancelPutTopLabel
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/article/
"
+
i
+
"
/
"
+
e
,
type
:
"
PUT
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
a
.
html
(
l
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
article-list
"
]
=
{
obj
:
admin
.
articleList
,
init
:
admin
.
articleList
.
init
,
refresh
:
admin
.
articleList
.
getList
};
admin
.
articleList
=
{
tablePagination
:
new
TablePaginate
(
"
article
"
),
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
text
:
Label
.
titleLabel
,
index
:
"
title
"
,
minWidth
:
110
,
style
:
"
padding-left: 12px;font-size:14px;
"
},{
text
:
Label
.
authorLabel
,
index
:
"
author
"
,
width
:
150
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
commentLabel
,
index
:
"
comments
"
,
width
:
80
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
viewLabel
,
width
:
60
,
index
:
"
articleViewCount
"
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
dateLabel
,
index
:
"
date
"
,
width
:
90
,
style
:
"
padding-left: 12px;
"
}]),
this
.
tablePagination
.
initPagination
(),
this
.
tablePagination
.
initCommentsDialog
(),
this
.
getList
(
t
);
var
e
=
this
;
$
(
"
#articleListBtn
"
).
click
(
function
(){
e
.
getList
(
t
)})},
syncToHacpai
:
function
(
t
){
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/article/push2rhy?id=
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
Label
.
pushSuccLabel
)}})},
getList
:
function
(
c
){
var
o
=
this
;
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/articles/status/published/
"
+
c
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
+
"
?k=
"
+
$
(
"
#articleListInput
"
).
val
(),
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
for
(
var
a
=
t
.
articles
,
i
=
[],
l
=
0
;
l
<
a
.
length
;
l
++
){
i
[
l
]
=
{},
i
[
l
].
title
=
'
<a href="
'
+
Label
.
servePath
+
a
[
l
].
articlePermalink
+
"
\"
target='_blank' title='
"
+
a
[
l
].
articleTitle
+
"
' class='no-underline'>
"
+
a
[
l
].
articleTitle
+
"
</a><span class='table-tag'>
"
+
a
[
l
].
articleTags
+
"
</span>
"
,
i
[
l
].
date
=
$
.
bowknot
.
getDate
(
a
[
l
].
articleCreateTime
),
i
[
l
].
comments
=
a
[
l
].
articleCommentCount
,
i
[
l
].
articleViewCount
=
a
[
l
].
articleViewCount
,
i
[
l
].
author
=
a
[
l
].
authorName
;
var
n
=
a
[
l
].
articlePutTop
?
Label
.
cancelPutTopLabel
:
Label
.
putTopLabel
;
i
[
l
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.article.get('
"
+
a
[
l
].
oId
+
"
', true)
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.article.del('
"
+
a
[
l
].
oId
+
"
', 'article', '
"
+
encodeURIComponent
(
a
[
l
].
articleTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.articleList.syncToHacpai('
"
+
a
[
l
].
oId
+
"
')
\"
>
"
+
Label
.
pushToHacpaiLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.articleList.popTop(this, '
"
+
a
[
l
].
oId
+
"
')
\"
>
"
+
n
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.comment.open('
"
+
a
[
l
].
oId
+
"
', 'article')
\"
>
"
+
Label
.
commentLabel
+
"
</a>
"
}
o
.
tablePagination
.
updateTablePagination
(
i
,
c
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
popTop
:
function
(
t
,
e
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
a
=
$
(
t
),
i
=
"
canceltop
"
,
l
=
Label
.
putTopLabel
;
a
.
html
()
===
Label
.
putTopLabel
&&
(
i
=
"
puttop
"
,
l
=
Label
.
cancelPutTopLabel
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/article/
"
+
i
+
"
/
"
+
e
,
type
:
"
PUT
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
&&
a
.
html
(
l
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
article-list
"
]
=
{
obj
:
admin
.
articleList
,
init
:
admin
.
articleList
.
init
,
refresh
:
admin
.
articleList
.
getList
};
admin
.
draftList
=
{
tablePagination
:
new
TablePaginate
(
"
draft
"
),
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
text
:
Label
.
titleLabel
,
index
:
"
title
"
,
minWidth
:
110
,
style
:
"
padding-left: 12px;font-size:14px;
"
},{
text
:
Label
.
authorLabel
,
index
:
"
author
"
,
width
:
150
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
commentLabel
,
index
:
"
comments
"
,
width
:
80
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
viewLabel
,
width
:
60
,
index
:
"
articleViewCount
"
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
dateLabel
,
index
:
"
date
"
,
width
:
90
,
style
:
"
padding-left: 12px;
"
}]),
this
.
tablePagination
.
initPagination
(),
this
.
tablePagination
.
initCommentsDialog
(),
this
.
getList
(
t
)},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
d
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/articles/status/unpublished/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
for
(
var
a
=
t
.
articles
,
i
=
[],
l
=
0
;
l
<
a
.
length
;
l
++
)
i
[
l
]
=
{},
i
[
l
].
tags
=
a
[
l
].
articleTags
,
i
[
l
].
date
=
$
.
bowknot
.
getDate
(
a
[
l
].
articleCreateTime
),
i
[
l
].
comments
=
a
[
l
].
articleCommentCount
,
i
[
l
].
articleViewCount
=
a
[
l
].
articleViewCount
,
i
[
l
].
author
=
a
[
l
].
authorName
,
i
[
l
].
title
=
"
<a class='no-underline' href='
"
+
Label
.
servePath
+
a
[
l
].
articlePermalink
+
"
' target='_blank'>
"
+
a
[
l
].
articleTitle
+
"
</a><span class='table-tag'>
"
+
a
[
l
].
articleTags
+
"
</span>
"
,
i
[
l
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.article.get('
"
+
a
[
l
].
oId
+
"
', false);
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.article.del('
"
+
a
[
l
].
oId
+
"
', 'draft', '
"
+
encodeURIComponent
(
a
[
l
].
articleTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.comment.open('
"
+
a
[
l
].
oId
+
"
', 'draft')
\"
>
"
+
Label
.
commentLabel
+
"
</a>
"
;
d
.
tablePagination
.
updateTablePagination
(
i
,
n
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
draft-list
"
]
=
{
obj
:
admin
.
draftList
,
init
:
admin
.
draftList
.
init
,
refresh
:
admin
.
draftList
.
getList
};
admin
.
draftList
=
{
tablePagination
:
new
TablePaginate
(
"
draft
"
),
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
text
:
Label
.
titleLabel
,
index
:
"
title
"
,
minWidth
:
110
,
style
:
"
padding-left: 12px;font-size:14px;
"
},{
text
:
Label
.
authorLabel
,
index
:
"
author
"
,
width
:
150
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
commentLabel
,
index
:
"
comments
"
,
width
:
80
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
viewLabel
,
width
:
60
,
index
:
"
articleViewCount
"
,
style
:
"
padding-left: 12px;
"
},{
text
:
Label
.
dateLabel
,
index
:
"
date
"
,
width
:
90
,
style
:
"
padding-left: 12px;
"
}]),
this
.
tablePagination
.
initPagination
(),
this
.
tablePagination
.
initCommentsDialog
(),
this
.
getList
(
t
)},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
d
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/articles/status/unpublished/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
for
(
var
a
=
t
.
articles
,
i
=
[],
l
=
0
;
l
<
a
.
length
;
l
++
)
i
[
l
]
=
{},
i
[
l
].
tags
=
a
[
l
].
articleTags
,
i
[
l
].
date
=
$
.
bowknot
.
getDate
(
a
[
l
].
articleCreateTime
),
i
[
l
].
comments
=
a
[
l
].
articleCommentCount
,
i
[
l
].
articleViewCount
=
a
[
l
].
articleViewCount
,
i
[
l
].
author
=
a
[
l
].
authorName
,
i
[
l
].
title
=
"
<a class='no-underline' href='
"
+
Label
.
servePath
+
a
[
l
].
articlePermalink
+
"
' target='_blank'>
"
+
a
[
l
].
articleTitle
+
"
</a><span class='table-tag'>
"
+
a
[
l
].
articleTags
+
"
</span>
"
,
i
[
l
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.article.get('
"
+
a
[
l
].
oId
+
"
', false);
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.article.del('
"
+
a
[
l
].
oId
+
"
', 'draft', '
"
+
encodeURIComponent
(
a
[
l
].
articleTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.comment.open('
"
+
a
[
l
].
oId
+
"
', 'draft')
\"
>
"
+
Label
.
commentLabel
+
"
</a>
"
;
d
.
tablePagination
.
updateTablePagination
(
i
,
n
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
draft-list
"
]
=
{
obj
:
admin
.
draftList
,
init
:
admin
.
draftList
.
init
,
refresh
:
admin
.
draftList
.
getList
};
admin
.
pageList
=
{
tablePagination
:
new
TablePaginate
(
"
page
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
id
:
""
,
type
:
"
link
"
,
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
pageOrder
"
,
width
:
60
,
style
:
"
padding-left: 12px;font-size:14px;
"
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
titleLabel
,
index
:
"
pageTitle
"
,
width
:
300
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
permalinkLabel
,
index
:
"
pagePermalink
"
,
minWidth
:
100
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
openMethodLabel
,
index
:
"
pageTarget
"
,
width
:
120
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
typeLabel
,
index
:
"
pageType
"
,
width
:
80
},{
text
:
Label
.
commentLabel
,
index
:
"
comments
"
,
width
:
80
,
style
:
"
padding-left: 12px;
"
}]),
this
.
tablePagination
.
initPagination
(),
this
.
tablePagination
.
initCommentsDialog
(),
this
.
getList
(
e
),
admin
.
editors
.
pageEditor
=
new
SoloEditor
({
id
:
"
pageContent
"
}),
$
(
"
.fn-type
"
).
click
(
function
(){
var
e
=
$
(
this
);
e
.
hasClass
(
"
selected
"
)
||
(
$
(
"
.fn-type
"
).
removeClass
(
"
selected
"
),
e
.
addClass
(
"
selected
"
),
admin
.
pageList
.
type
=
e
.
data
(
"
type
"
),
"
page
"
===
admin
.
pageList
.
type
?
$
(
"
#pagePagePanel
"
).
slideDown
():
$
(
"
#pagePagePanel
"
).
slideUp
())})},
getList
:
function
(
p
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
l
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/pages/
"
+
p
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
e
.
pages
,
n
=
[];
admin
.
pageList
.
pageInfo
.
currentCount
=
t
.
length
,
admin
.
pageList
.
pageInfo
.
pageCount
=
0
===
e
.
pagination
.
paginationPageCount
?
1
:
e
.
pagination
.
paginationPageCount
;
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
){
n
[
i
]
=
{},
0
===
i
?
1
===
t
.
length
?
n
[
i
].
pageOrder
=
""
:
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span></div>
'
:
i
===
t
.
length
-
1
?
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
;
var
g
=
""
;
""
!==
t
[
i
].
pageIcon
&&
(
g
=
"
<img class='navigation-icon' src='
"
+
t
[
i
].
pageIcon
+
"
'/>
"
),
n
[
i
].
pageTitle
=
g
+
"
<a class='no-underline' href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
t
[
i
].
pageTitle
+
"
</a>
"
,
n
[
i
].
pagePermalink
=
"
<a class='no-underline' href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
t
[
i
].
pagePermalink
+
"
</a>
"
,
n
[
i
].
pageTarget
=
t
[
i
].
pageOpenTarget
,
n
[
i
].
pageType
=
t
[
i
].
pageType
,
n
[
i
].
comments
=
t
[
i
].
pageCommentCount
,
n
[
i
].
expendRow
=
"
<span><a href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
Label
.
viewLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.pageList.get('
"
+
t
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.pageList.del('
"
+
t
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
t
[
i
].
pageTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.comment.open('
"
+
t
[
i
].
oId
+
"
', 'page')
\"
>
"
+
Label
.
commentLabel
+
"
</a></span>
"
}
l
.
tablePagination
.
updateTablePagination
(
n
,
p
,
e
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
get
:
function
(
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
admin
.
pageList
.
id
=
t
,
$
(
"
#pageTitle
"
).
val
(
e
.
page
.
pageTitle
),
$
(
"
#pagePermalink
"
).
val
(
e
.
page
.
pagePermalink
),
$
(
"
#pageTarget
"
).
val
(
e
.
page
.
pageOpenTarget
),
$
(
"
#pageIcon
"
).
val
(
e
.
page
.
pageIcon
),
"
page
"
===
e
.
page
.
pageType
?
$
(
$
(
"
.fn-type
"
).
get
(
1
)).
click
():
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
,
e
.
page
.
pageCommentable
),
admin
.
editors
.
pageEditor
.
setContent
(
e
.
page
.
pageContent
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
del
:
function
(
e
,
a
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
navLabel
+
'
"
'
+
Util
.
htmlDecode
(
a
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
pageList
.
pageInfo
.
currentPage
;
1
===
admin
.
pageList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
pageList
.
pageInfo
.
pageCount
&&
admin
.
pageList
.
pageInfo
.
currentPage
===
admin
.
pageList
.
pageInfo
.
pageCount
&&
(
admin
.
pageList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
pageList
.
pageInfo
.
pageCount
);
var
n
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
==
n
[
n
.
length
-
1
]?
admin
.
pageList
.
getList
(
t
):
admin
.
setHashByPage
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
admin
.
editors
.
pageEditor
.
getContent
(),
a
=
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
"
link
"
===
admin
.
pageList
.
type
&&
(
a
=
Util
.
proessURL
(
a
));
var
t
=
{
page
:{
pageTitle
:
$
(
"
#pageTitle
"
).
val
(),
pageContent
:
e
,
pagePermalink
:
a
,
pageCommentable
:
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
),
pageType
:
admin
.
pageList
.
type
,
pageOpenTarget
:
$
(
"
#pageTarget
"
).
val
(),
pageIcon
:
$
(
"
#pageIcon
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
admin
.
pageList
.
id
=
""
,
$
(
"
#pagePermalink
"
).
val
(
""
),
$
(
"
#pageTitle
"
).
val
(
""
),
$
(
"
#pageIcon
"
).
val
(
""
),
$
(
"
#pageCommentable
"
).
prop
(
"
cheked
"
,
!
1
),
$
(
"
#pageTarget
"
).
val
(
"
_self
"
),
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
admin
.
editors
.
pageEditor
.
setContent
(
""
),
admin
.
pageList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
pageList
.
pageInfo
.
currentPage
===
admin
.
pageList
.
pageInfo
.
pageCount
&&
admin
.
pageList
.
pageInfo
.
pageCount
++
;
var
t
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
pageList
.
pageInfo
.
pageCount
==
t
[
t
.
length
-
1
]?
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
pageCount
):
admin
.
setHashByPage
(
admin
.
pageList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
update
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
admin
.
editors
.
pageEditor
.
getContent
(),
a
=
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
"
link
"
===
admin
.
pageList
.
type
&&
(
a
=
Util
.
proessURL
(
a
));
var
t
=
{
page
:{
pageTitle
:
$
(
"
#pageTitle
"
).
val
(),
oId
:
this
.
id
,
pageContent
:
e
,
pagePermalink
:
a
,
pageCommentable
:
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
),
pageType
:
admin
.
pageList
.
type
,
pageOpenTarget
:
$
(
"
#pageTarget
"
).
val
(),
pageIcon
:
$
(
"
#pageIcon
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
admin
.
pageList
.
id
=
""
,
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
currentPage
),
$
(
"
#pageTitle
"
).
val
(
""
),
$
(
"
#pageIcon
"
).
val
(
""
),
$
(
"
#pagePermalink
"
).
val
(
""
),
$
(
"
#pageCommentable
"
).
prop
(
"
cheked
"
,
!
1
),
$
(
"
#pageTarget
"
).
val
(
"
_self
"
),
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
admin
.
editors
.
pageEditor
.
setContent
(
""
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
validate
:
function
(){
if
(
""
===
$
(
"
#pageTitle
"
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
titleEmptyLabel
),
$
(
"
#pageTitle
"
).
focus
();
else
{
if
(
"
link
"
!==
admin
.
pageList
.
type
||
""
!==
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
\s
/g
,
""
))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
linkEmptyLabel
)}
return
!
1
},
submit
:
function
(){
""
!==
this
.
id
?
this
.
update
():
this
.
add
()},
changeOrder
:
function
(
e
,
a
,
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
n
=
{
oId
:
e
.
toString
(),
direction
:
t
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
n
),
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
page-list
"
]
=
{
obj
:
admin
.
pageList
,
init
:
admin
.
pageList
.
init
,
refresh
:
admin
.
pageList
.
getList
};
admin
.
pageList
=
{
tablePagination
:
new
TablePaginate
(
"
page
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
id
:
""
,
type
:
"
link
"
,
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
pageOrder
"
,
width
:
60
,
style
:
"
padding-left: 12px;font-size:14px;
"
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
titleLabel
,
index
:
"
pageTitle
"
,
width
:
300
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
permalinkLabel
,
index
:
"
pagePermalink
"
,
minWidth
:
100
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
openMethodLabel
,
index
:
"
pageTarget
"
,
width
:
120
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
typeLabel
,
index
:
"
pageType
"
,
width
:
80
},{
text
:
Label
.
commentLabel
,
index
:
"
comments
"
,
width
:
80
,
style
:
"
padding-left: 12px;
"
}]),
this
.
tablePagination
.
initPagination
(),
this
.
tablePagination
.
initCommentsDialog
(),
this
.
getList
(
e
),
admin
.
editors
.
pageEditor
=
new
SoloEditor
({
id
:
"
pageContent
"
}),
$
(
"
.fn-type
"
).
click
(
function
(){
var
e
=
$
(
this
);
e
.
hasClass
(
"
selected
"
)
||
(
$
(
"
.fn-type
"
).
removeClass
(
"
selected
"
),
e
.
addClass
(
"
selected
"
),
admin
.
pageList
.
type
=
e
.
data
(
"
type
"
),
"
page
"
===
admin
.
pageList
.
type
?
$
(
"
#pagePagePanel
"
).
slideDown
():
$
(
"
#pagePagePanel
"
).
slideUp
())})},
getList
:
function
(
p
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
l
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/pages/
"
+
p
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
e
.
pages
,
n
=
[];
admin
.
pageList
.
pageInfo
.
currentCount
=
t
.
length
,
admin
.
pageList
.
pageInfo
.
pageCount
=
0
===
e
.
pagination
.
paginationPageCount
?
1
:
e
.
pagination
.
paginationPageCount
;
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
){
n
[
i
]
=
{},
0
===
i
?
1
===
t
.
length
?
n
[
i
].
pageOrder
=
""
:
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span></div>
'
:
i
===
t
.
length
-
1
?
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
n
[
i
].
pageOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.pageList.changeOrder(
'
+
t
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
;
var
g
=
""
;
""
!==
t
[
i
].
pageIcon
&&
(
g
=
"
<img class='navigation-icon' src='
"
+
t
[
i
].
pageIcon
+
"
'/>
"
),
n
[
i
].
pageTitle
=
g
+
"
<a class='no-underline' href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
t
[
i
].
pageTitle
+
"
</a>
"
,
n
[
i
].
pagePermalink
=
"
<a class='no-underline' href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
t
[
i
].
pagePermalink
+
"
</a>
"
,
n
[
i
].
pageTarget
=
t
[
i
].
pageOpenTarget
,
n
[
i
].
pageType
=
t
[
i
].
pageType
,
n
[
i
].
comments
=
t
[
i
].
pageCommentCount
,
n
[
i
].
expendRow
=
"
<span><a href='
"
+
t
[
i
].
pagePermalink
+
"
' target='_blank'>
"
+
Label
.
viewLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.pageList.get('
"
+
t
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.pageList.del('
"
+
t
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
t
[
i
].
pageTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.comment.open('
"
+
t
[
i
].
oId
+
"
', 'page')
\"
>
"
+
Label
.
commentLabel
+
"
</a></span>
"
}
l
.
tablePagination
.
updateTablePagination
(
n
,
p
,
e
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
get
:
function
(
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
admin
.
pageList
.
id
=
t
,
$
(
"
#pageTitle
"
).
val
(
e
.
page
.
pageTitle
),
$
(
"
#pagePermalink
"
).
val
(
e
.
page
.
pagePermalink
),
$
(
"
#pageTarget
"
).
val
(
e
.
page
.
pageOpenTarget
),
$
(
"
#pageIcon
"
).
val
(
e
.
page
.
pageIcon
),
"
page
"
===
e
.
page
.
pageType
?
$
(
$
(
"
.fn-type
"
).
get
(
1
)).
click
():
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
,
e
.
page
.
pageCommentable
),
admin
.
editors
.
pageEditor
.
setContent
(
e
.
page
.
pageContent
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
del
:
function
(
e
,
a
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
navLabel
+
'
"
'
+
Util
.
htmlDecode
(
a
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
pageList
.
pageInfo
.
currentPage
;
1
===
admin
.
pageList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
pageList
.
pageInfo
.
pageCount
&&
admin
.
pageList
.
pageInfo
.
currentPage
===
admin
.
pageList
.
pageInfo
.
pageCount
&&
(
admin
.
pageList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
pageList
.
pageInfo
.
pageCount
);
var
n
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
==
n
[
n
.
length
-
1
]?
admin
.
pageList
.
getList
(
t
):
admin
.
setHashByPage
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
admin
.
editors
.
pageEditor
.
getContent
(),
a
=
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
"
link
"
===
admin
.
pageList
.
type
&&
(
a
=
Util
.
proessURL
(
a
));
var
t
=
{
page
:{
pageTitle
:
$
(
"
#pageTitle
"
).
val
(),
pageContent
:
e
,
pagePermalink
:
a
,
pageCommentable
:
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
),
pageType
:
admin
.
pageList
.
type
,
pageOpenTarget
:
$
(
"
#pageTarget
"
).
val
(),
pageIcon
:
$
(
"
#pageIcon
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
admin
.
pageList
.
id
=
""
,
$
(
"
#pagePermalink
"
).
val
(
""
),
$
(
"
#pageTitle
"
).
val
(
""
),
$
(
"
#pageIcon
"
).
val
(
""
),
$
(
"
#pageCommentable
"
).
prop
(
"
cheked
"
,
!
1
),
$
(
"
#pageTarget
"
).
val
(
"
_self
"
),
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
admin
.
editors
.
pageEditor
.
setContent
(
""
),
admin
.
pageList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
pageList
.
pageInfo
.
currentPage
===
admin
.
pageList
.
pageInfo
.
pageCount
&&
admin
.
pageList
.
pageInfo
.
pageCount
++
;
var
t
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
pageList
.
pageInfo
.
pageCount
==
t
[
t
.
length
-
1
]?
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
pageCount
):
admin
.
setHashByPage
(
admin
.
pageList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
update
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
admin
.
editors
.
pageEditor
.
getContent
(),
a
=
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
"
link
"
===
admin
.
pageList
.
type
&&
(
a
=
Util
.
proessURL
(
a
));
var
t
=
{
page
:{
pageTitle
:
$
(
"
#pageTitle
"
).
val
(),
oId
:
this
.
id
,
pageContent
:
e
,
pagePermalink
:
a
,
pageCommentable
:
$
(
"
#pageCommentable
"
).
prop
(
"
checked
"
),
pageType
:
admin
.
pageList
.
type
,
pageOpenTarget
:
$
(
"
#pageTarget
"
).
val
(),
pageIcon
:
$
(
"
#pageIcon
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
admin
.
pageList
.
id
=
""
,
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
currentPage
),
$
(
"
#pageTitle
"
).
val
(
""
),
$
(
"
#pageIcon
"
).
val
(
""
),
$
(
"
#pagePermalink
"
).
val
(
""
),
$
(
"
#pageCommentable
"
).
prop
(
"
cheked
"
,
!
1
),
$
(
"
#pageTarget
"
).
val
(
"
_self
"
),
$
(
$
(
"
.fn-type
"
).
get
(
0
)).
click
(),
admin
.
editors
.
pageEditor
.
setContent
(
""
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
validate
:
function
(){
if
(
""
===
$
(
"
#pageTitle
"
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
titleEmptyLabel
),
$
(
"
#pageTitle
"
).
focus
();
else
{
if
(
"
link
"
!==
admin
.
pageList
.
type
||
""
!==
$
(
"
#pagePermalink
"
).
val
().
replace
(
/
\s
/g
,
""
))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
linkEmptyLabel
)}
return
!
1
},
submit
:
function
(){
""
!==
this
.
id
?
this
.
update
():
this
.
add
()},
changeOrder
:
function
(
e
,
a
,
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
n
=
{
oId
:
e
.
toString
(),
direction
:
t
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/page/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
n
),
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
admin
.
pageList
.
getList
(
admin
.
pageList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
page-list
"
]
=
{
obj
:
admin
.
pageList
,
init
:
admin
.
pageList
.
init
,
refresh
:
admin
.
pageList
.
getList
};
admin
.
others
=
{
init
:
function
(){
$
(
"
#tabOthers
"
).
tabs
(),
$
(
"
#loadMsg
"
).
text
(
""
)},
removeUnusedArchives
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/archive/unused
"
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
)}})},
removeUnusedTags
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/tag/unused
"
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
)}})},
exportSQL
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/export/sql
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
e
.
sc
?
$
(
"
#tipMsg
"
).
text
(
e
.
msg
):
window
.
location
=
Label
.
servePath
+
"
/console/export/sql
"
}})},
exportJSON
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/export/json
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
e
.
sc
?
$
(
"
#tipMsg
"
).
text
(
e
.
msg
):
window
.
location
=
Label
.
servePath
+
"
/console/export/json
"
}})},
exportHexo
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/export/hexo
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
e
.
sc
?
$
(
"
#tipMsg
"
).
text
(
e
.
msg
):
window
.
location
=
Label
.
servePath
+
"
/console/export/hexo
"
}})},
getUnusedTags
:
function
(){
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/tag/unused
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
)?
e
.
unusedTags
.
length
:
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
.
others
=
{
obj
:
admin
.
others
,
init
:
admin
.
others
.
init
,
refresh
:
function
(){
admin
.
clearTip
()}};
admin
.
others
=
{
init
:
function
(){
$
(
"
#tabOthers
"
).
tabs
(),
$
(
"
#loadMsg
"
).
text
(
""
)},
removeUnusedArchives
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/archive/unused
"
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
)}})},
removeUnusedTags
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/tag/unused
"
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
)}})},
exportSQL
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/export/sql
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
e
.
sc
?
$
(
"
#tipMsg
"
).
text
(
e
.
msg
):
window
.
location
=
Label
.
servePath
+
"
/console/export/sql
"
}})},
exportJSON
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/export/json
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
e
.
sc
?
$
(
"
#tipMsg
"
).
text
(
e
.
msg
):
window
.
location
=
Label
.
servePath
+
"
/console/export/json
"
}})},
exportHexo
:
function
(){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/export/hexo
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
e
.
sc
?
$
(
"
#tipMsg
"
).
text
(
e
.
msg
):
window
.
location
=
Label
.
servePath
+
"
/console/export/hexo
"
}})},
getUnusedTags
:
function
(){
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/tag/unused
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
)?
e
.
unusedTags
.
length
:
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
.
others
=
{
obj
:
admin
.
others
,
init
:
admin
.
others
.
init
,
refresh
:
function
(){
admin
.
clearTip
()}};
admin
.
linkList
=
{
tablePagination
:
new
TablePaginate
(
"
link
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
id
:
""
,
init
:
function
(
i
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
linkOrder
"
,
width
:
60
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
linkTitleLabel
,
index
:
"
linkTitle
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
urlLabel
,
index
:
"
linkAddress
"
,
minWidth
:
180
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
linkDescriptionLabel
,
index
:
"
linkDescription
"
,
width
:
360
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
i
),
$
(
"
#updateLink
"
).
dialog
({
title
:
$
(
"
#updateLink
"
).
data
(
"
title
"
),
width
:
700
,
height
:
290
,
modal
:
!
0
,
hideFooter
:
!
0
})},
getList
:
function
(
l
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
0
===
l
&&
(
l
=
1
),
this
.
pageInfo
.
currentPage
=
l
;
var
s
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/links/
"
+
l
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
var
n
=
i
.
links
,
t
=
[];
admin
.
linkList
.
pageInfo
.
currentCount
=
n
.
length
,
admin
.
linkList
.
pageInfo
.
pageCount
=
0
===
i
.
pagination
.
paginationPageCount
?
1
:
i
.
pagination
.
paginationPageCount
;
for
(
var
a
=
0
;
a
<
n
.
length
;
a
++
)
t
[
a
]
=
{},
0
===
a
?
1
===
n
.
length
?
t
[
a
].
linkOrder
=
""
:
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
:
a
===
n
.
length
-
1
?
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
,
t
[
a
].
linkTitle
=
n
[
a
].
linkTitle
,
t
[
a
].
linkAddress
=
"
<a target='_blank' class='no-underline' href='
"
+
n
[
a
].
linkAddress
+
"
'>
"
+
n
[
a
].
linkAddress
+
"
</a>
"
,
t
[
a
].
linkDescription
=
n
[
a
].
linkDescription
,
t
[
a
].
expendRow
=
"
<span><a href='
"
+
n
[
a
].
linkAddress
+
"
' target='_blank'>
"
+
Label
.
viewLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.linkList.get('
"
+
n
[
a
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.linkList.del('
"
+
n
[
a
].
oId
+
"
', '
"
+
encodeURIComponent
(
n
[
a
].
linkTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a></span>
"
;
s
.
tablePagination
.
updateTablePagination
(
t
,
l
,
i
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
i
=
{
link
:{
linkTitle
:
$
(
"
#linkTitle
"
).
val
(),
linkAddress
:
$
(
"
#linkAddress
"
).
val
(),
linkDescription
:
$
(
"
#linkDescription
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
$
(
"
#linkTitle
"
).
val
(
""
),
$
(
"
#linkAddress
"
).
val
(
""
),
$
(
"
#linkDescription
"
).
val
(
""
),
admin
.
linkList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
linkList
.
pageInfo
.
currentPage
===
admin
.
linkList
.
pageInfo
.
pageCount
&&
admin
.
linkList
.
pageInfo
.
pageCount
++
;
var
n
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
linkList
.
pageInfo
.
pageCount
!==
parseInt
(
n
[
n
.
length
-
1
])
&&
admin
.
setHashByPage
(
admin
.
linkList
.
pageInfo
.
pageCount
),
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
get
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#updateLink
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/
"
+
n
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
&&
(
admin
.
linkList
.
id
=
n
,
$
(
"
#linkTitleUpdate
"
).
val
(
i
.
link
.
linkTitle
),
$
(
"
#linkAddressUpdate
"
).
val
(
i
.
link
.
linkAddress
),
$
(
"
#linkDescriptionUpdate
"
).
val
(
i
.
link
.
linkDescription
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
i
=
{
link
:{
linkTitle
:
$
(
"
#linkTitleUpdate
"
).
val
(),
oId
:
this
.
id
,
linkAddress
:
$
(
"
#linkAddressUpdate
"
).
val
(),
linkDescription
:
$
(
"
#linkDescriptionUpdate
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
i
,
e
){
$
(
"
#updateLink
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
&&
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
i
,
e
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
permalinkLabel
+
'
"
'
+
Util
.
htmlDecode
(
e
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/
"
+
i
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
var
n
=
admin
.
linkList
.
pageInfo
.
currentPage
;
1
===
admin
.
linkList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
linkList
.
pageInfo
.
pageCount
&&
admin
.
linkList
.
pageInfo
.
currentPage
===
admin
.
linkList
.
pageInfo
.
pageCount
&&
(
admin
.
linkList
.
pageInfo
.
pageCount
--
,
n
=
admin
.
linkList
.
pageInfo
.
pageCount
);
var
t
=
window
.
location
.
hash
.
split
(
"
/
"
);
n
!==
parseInt
(
t
[
t
.
length
-
1
])
&&
admin
.
setHashByPage
(
n
),
admin
.
linkList
.
getList
(
n
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
validate
:
function
(
i
){
if
(
i
||
(
i
=
""
),
""
===
$
(
"
#linkTitle
"
+
i
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
titleEmptyLabel
),
$
(
"
#linkTitle
"
+
i
).
focus
().
val
(
""
);
else
if
(
""
===
$
(
"
#linkAddress
"
+
i
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
addressEmptyLabel
),
$
(
"
#linkAddress
"
+
i
).
focus
().
val
(
""
);
else
{
if
(
/^
\w
+:
\/\/
/
.
test
(
$
(
"
#linkAddress
"
+
i
).
val
()))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
addressInvalidLabel
),
$
(
"
#linkAddress
"
+
i
).
focus
().
val
(
""
)}
return
!
1
},
changeOrder
:
function
(
i
,
e
,
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
{
oId
:
i
.
toString
(),
direction
:
n
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
link-list
"
]
=
{
obj
:
admin
.
linkList
,
init
:
admin
.
linkList
.
init
,
refresh
:
admin
.
linkList
.
getList
};
admin
.
linkList
=
{
tablePagination
:
new
TablePaginate
(
"
link
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
id
:
""
,
init
:
function
(
i
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
linkOrder
"
,
width
:
60
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
linkTitleLabel
,
index
:
"
linkTitle
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
urlLabel
,
index
:
"
linkAddress
"
,
minWidth
:
180
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
linkDescriptionLabel
,
index
:
"
linkDescription
"
,
width
:
360
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
i
),
$
(
"
#updateLink
"
).
dialog
({
title
:
$
(
"
#updateLink
"
).
data
(
"
title
"
),
width
:
700
,
height
:
290
,
modal
:
!
0
,
hideFooter
:
!
0
})},
getList
:
function
(
l
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
0
===
l
&&
(
l
=
1
),
this
.
pageInfo
.
currentPage
=
l
;
var
s
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/links/
"
+
l
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
var
n
=
i
.
links
,
t
=
[];
admin
.
linkList
.
pageInfo
.
currentCount
=
n
.
length
,
admin
.
linkList
.
pageInfo
.
pageCount
=
0
===
i
.
pagination
.
paginationPageCount
?
1
:
i
.
pagination
.
paginationPageCount
;
for
(
var
a
=
0
;
a
<
n
.
length
;
a
++
)
t
[
a
]
=
{},
0
===
a
?
1
===
n
.
length
?
t
[
a
].
linkOrder
=
""
:
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
:
a
===
n
.
length
-
1
?
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
t
[
a
].
linkOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.linkList.changeOrder(
'
+
n
[
a
].
oId
+
"
,
"
+
a
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
,
t
[
a
].
linkTitle
=
n
[
a
].
linkTitle
,
t
[
a
].
linkAddress
=
"
<a target='_blank' class='no-underline' href='
"
+
n
[
a
].
linkAddress
+
"
'>
"
+
n
[
a
].
linkAddress
+
"
</a>
"
,
t
[
a
].
linkDescription
=
n
[
a
].
linkDescription
,
t
[
a
].
expendRow
=
"
<span><a href='
"
+
n
[
a
].
linkAddress
+
"
' target='_blank'>
"
+
Label
.
viewLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.linkList.get('
"
+
n
[
a
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.linkList.del('
"
+
n
[
a
].
oId
+
"
', '
"
+
encodeURIComponent
(
n
[
a
].
linkTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a></span>
"
;
s
.
tablePagination
.
updateTablePagination
(
t
,
l
,
i
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
i
=
{
link
:{
linkTitle
:
$
(
"
#linkTitle
"
).
val
(),
linkAddress
:
$
(
"
#linkAddress
"
).
val
(),
linkDescription
:
$
(
"
#linkDescription
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
$
(
"
#linkTitle
"
).
val
(
""
),
$
(
"
#linkAddress
"
).
val
(
""
),
$
(
"
#linkDescription
"
).
val
(
""
),
admin
.
linkList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
linkList
.
pageInfo
.
currentPage
===
admin
.
linkList
.
pageInfo
.
pageCount
&&
admin
.
linkList
.
pageInfo
.
pageCount
++
;
var
n
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
linkList
.
pageInfo
.
pageCount
!==
parseInt
(
n
[
n
.
length
-
1
])
&&
admin
.
setHashByPage
(
admin
.
linkList
.
pageInfo
.
pageCount
),
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
get
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#updateLink
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/
"
+
n
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
&&
(
admin
.
linkList
.
id
=
n
,
$
(
"
#linkTitleUpdate
"
).
val
(
i
.
link
.
linkTitle
),
$
(
"
#linkAddressUpdate
"
).
val
(
i
.
link
.
linkAddress
),
$
(
"
#linkDescriptionUpdate
"
).
val
(
i
.
link
.
linkDescription
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
i
=
{
link
:{
linkTitle
:
$
(
"
#linkTitleUpdate
"
).
val
(),
oId
:
this
.
id
,
linkAddress
:
$
(
"
#linkAddressUpdate
"
).
val
(),
linkDescription
:
$
(
"
#linkDescriptionUpdate
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
i
),
success
:
function
(
i
,
e
){
$
(
"
#updateLink
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
&&
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
i
,
e
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
permalinkLabel
+
'
"
'
+
Util
.
htmlDecode
(
e
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/
"
+
i
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
var
n
=
admin
.
linkList
.
pageInfo
.
currentPage
;
1
===
admin
.
linkList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
linkList
.
pageInfo
.
pageCount
&&
admin
.
linkList
.
pageInfo
.
currentPage
===
admin
.
linkList
.
pageInfo
.
pageCount
&&
(
admin
.
linkList
.
pageInfo
.
pageCount
--
,
n
=
admin
.
linkList
.
pageInfo
.
pageCount
);
var
t
=
window
.
location
.
hash
.
split
(
"
/
"
);
n
!==
parseInt
(
t
[
t
.
length
-
1
])
&&
admin
.
setHashByPage
(
n
),
admin
.
linkList
.
getList
(
n
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
validate
:
function
(
i
){
if
(
i
||
(
i
=
""
),
""
===
$
(
"
#linkTitle
"
+
i
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
titleEmptyLabel
),
$
(
"
#linkTitle
"
+
i
).
focus
().
val
(
""
);
else
if
(
""
===
$
(
"
#linkAddress
"
+
i
).
val
().
replace
(
/
\s
/g
,
""
))
$
(
"
#tipMsg
"
).
text
(
Label
.
addressEmptyLabel
),
$
(
"
#linkAddress
"
+
i
).
focus
().
val
(
""
);
else
{
if
(
/^
\w
+:
\/\/
/
.
test
(
$
(
"
#linkAddress
"
+
i
).
val
()))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
addressInvalidLabel
),
$
(
"
#linkAddress
"
+
i
).
focus
().
val
(
""
)}
return
!
1
},
changeOrder
:
function
(
i
,
e
,
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
t
=
{
oId
:
i
.
toString
(),
direction
:
n
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/link/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
admin
.
linkList
.
getList
(
admin
.
linkList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
link-list
"
]
=
{
obj
:
admin
.
linkList
,
init
:
admin
.
linkList
.
init
,
refresh
:
admin
.
linkList
.
getList
};
admin
.
preference
=
{
locale
:
""
,
init
:
function
(){
$
(
"
#tabPreference
"
).
tabs
(),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/preference/
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
result
,
textStatus
){
if
(
$
(
"
#tipMsg
"
).
text
(
result
.
msg
),
result
.
sc
){
var
preference
=
result
.
preference
;
$
(
"
#metaKeywords
"
).
val
(
preference
.
metaKeywords
),
$
(
"
#metaDescription
"
).
val
(
preference
.
metaDescription
),
$
(
"
#blogTitle
"
).
val
(
preference
.
blogTitle
),
$
(
"
#blogSubtitle
"
).
val
(
preference
.
blogSubtitle
),
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(
preference
.
mostCommentArticleDisplayCount
),
$
(
"
#mostViewArticleDisplayCount
"
).
val
(
preference
.
mostViewArticleDisplayCount
),
$
(
"
#recentCommentDisplayCount
"
).
val
(
preference
.
recentCommentDisplayCount
),
$
(
"
#mostUsedTagDisplayCount
"
).
val
(
preference
.
mostUsedTagDisplayCount
),
$
(
"
#articleListDisplayCount
"
).
val
(
preference
.
articleListDisplayCount
),
$
(
"
#articleListPaginationWindowSize
"
).
val
(
preference
.
articleListPaginationWindowSize
),
$
(
"
#localeString
"
).
val
(
preference
.
localeString
),
$
(
"
#timeZoneId
"
).
val
(
preference
.
timeZoneId
),
$
(
"
#noticeBoard
"
).
val
(
preference
.
noticeBoard
),
$
(
"
#footerContent
"
).
val
(
preference
.
footerContent
),
$
(
"
#htmlHead
"
).
val
(
preference
.
htmlHead
),
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(
preference
.
externalRelevantArticlesDisplayCount
),
$
(
"
#relevantArticlesDisplayCount
"
).
val
(
preference
.
relevantArticlesDisplayCount
),
$
(
"
#randomArticlesDisplayCount
"
).
val
(
preference
.
randomArticlesDisplayCount
),
$
(
"
#customVars
"
).
val
(
preference
.
customVars
),
"
true
"
===
preference
.
enableArticleUpdateHint
?
$
(
"
#enableArticleUpdateHint
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
#enableArticleUpdateHint
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
allowVisitDraftViaPermalink
?
$
(
"
#allowVisitDraftViaPermalink
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
allowVisitDraftViaPermalink
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
syncGitHub
?
$
(
"
#syncGitHub
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
syncGitHub
"
).
removeAttr
(
"
checked
"
),
syncGitHub
,
admin
.
preference
.
locale
=
preference
.
localeString
,
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
preference
.
skinDirName
);
for
(
var
skins
=
eval
(
"
(
"
+
preference
.
skins
+
"
)
"
),
skinsHTML
=
""
,
i
=
0
;
i
<
skins
.
length
;
i
++
){
var
selectedClass
=
""
;
skins
[
i
].
skinName
===
preference
.
skinName
&&
skins
[
i
].
skinDirName
===
preference
.
skinDirName
&&
(
selectedClass
+=
"
selected
"
),
skinsHTML
+=
'
<div class="fn__left skinItem
'
+
selectedClass
+
'
"><div class="ft__center">
'
+
skins
[
i
].
skinName
+
'
</div><img class="skinPreview" src="
'
+
Label
.
staticServePath
+
"
/skins/
"
+
skins
[
i
].
skinDirName
+
'
/preview.png"/><div><button class="update small" data-name="
'
+
skins
[
i
].
skinDirName
+
'
">
'
+
Label
.
enableLabel
+
'
</button><button class="small" onclick="window.open(
\'
'
+
Label
.
servePath
+
"
?skin=
"
+
skins
[
i
].
skinName
+
"
')
\"
>
"
+
Label
.
previewLabel
+
"
</button></div></div>
"
}
$
(
"
#skinMain
"
).
append
(
skinsHTML
+
"
<div class='fn__clear'></div>
"
),
$
(
"
.skinItem .update
"
).
click
(
function
(){
$
(
"
.skinItem
"
).
removeClass
(
"
selected
"
),
$
(
this
).
closest
(
"
.skinItem
"
).
addClass
(
"
selected
"
),
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
,
$
(
this
).
data
(
"
name
"
)),
admin
.
preference
.
update
()});
for
(
var
signs
=
eval
(
"
(
"
+
preference
.
signs
+
"
)
"
),
j
=
1
;
j
<
signs
.
length
;
j
++
)
$
(
"
#preferenceSign
"
+
j
).
val
(
signs
[
j
].
signHTML
);
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
),
$
(
"
#hljsTheme
"
).
val
(
preference
.
hljsTheme
),
$
(
"
#feedOutputMode
"
).
val
(
preference
.
feedOutputMode
),
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
),
$
(
"
#faviconURL
"
).
val
(
preference
.
faviconURL
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
validate
:
function
(){
return
/^
\d
+$/
.
test
(
$
(
"
#mostUsedTagDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#recentCommentDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#mostCommentArticleDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#mostViewArticleDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#articleListDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#articleListPaginationWindowSize
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#randomArticlesDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#relevantArticlesDisplayCount
"
).
val
())?
!!
/^
\d
+$/
.
test
(
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
())
||
(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
externalRelevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#externalRelevantArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
relevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#relevantArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
randomArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#randomArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
windowSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#articleListPaginationWindowSize
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
pageSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#articleListDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostViewArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostViewArticleDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostCommentArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostCommentArticleDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexRecentCommentDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#recentCommentDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexTagDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostUsedTagDisplayCount
"
).
focus
(),
!
1
)},
update
:
function
(){
if
(
admin
.
preference
.
validate
()){
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
e
=
[{
oId
:
0
,
signHTML
:
""
},{
oId
:
1
,
signHTML
:
$
(
"
#preferenceSign1
"
).
val
()},{
oId
:
2
,
signHTML
:
$
(
"
#preferenceSign2
"
).
val
()},{
oId
:
3
,
signHTML
:
$
(
"
#preferenceSign3
"
).
val
()}],
t
=
{
preference
:{
metaKeywords
:
$
(
"
#metaKeywords
"
).
val
(),
metaDescription
:
$
(
"
#metaDescription
"
).
val
(),
blogTitle
:
$
(
"
#blogTitle
"
).
val
(),
blogSubtitle
:
$
(
"
#blogSubtitle
"
).
val
(),
mostCommentArticleDisplayCount
:
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(),
mostViewArticleDisplayCount
:
$
(
"
#mostViewArticleDisplayCount
"
).
val
(),
recentCommentDisplayCount
:
$
(
"
#recentCommentDisplayCount
"
).
val
(),
mostUsedTagDisplayCount
:
$
(
"
#mostUsedTagDisplayCount
"
).
val
(),
articleListDisplayCount
:
$
(
"
#articleListDisplayCount
"
).
val
(),
articleListPaginationWindowSize
:
$
(
"
#articleListPaginationWindowSize
"
).
val
(),
skinDirName
:
$
(
"
#skinMain
"
).
data
(
"
skinDirName
"
),
localeString
:
$
(
"
#localeString
"
).
val
(),
timeZoneId
:
$
(
"
#timeZoneId
"
).
val
(),
noticeBoard
:
$
(
"
#noticeBoard
"
).
val
(),
footerContent
:
$
(
"
#footerContent
"
).
val
(),
htmlHead
:
$
(
"
#htmlHead
"
).
val
(),
externalRelevantArticlesDisplayCount
:
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(),
relevantArticlesDisplayCount
:
$
(
"
#relevantArticlesDisplayCount
"
).
val
(),
randomArticlesDisplayCount
:
$
(
"
#randomArticlesDisplayCount
"
).
val
(),
enableArticleUpdateHint
:
$
(
"
#enableArticleUpdateHint
"
).
prop
(
"
checked
"
),
signs
:
e
,
allowVisitDraftViaPermalink
:
$
(
"
#allowVisitDraftViaPermalink
"
).
prop
(
"
checked
"
),
articleListStyle
:
$
(
"
#articleListDisplay
"
).
val
(),
hljsTheme
:
$
(
"
#hljsTheme
"
).
val
(),
feedOutputMode
:
$
(
"
#feedOutputMode
"
).
val
(),
feedOutputCnt
:
$
(
"
#feedOutputCnt
"
).
val
(),
faviconURL
:
$
(
"
#faviconURL
"
).
val
(),
syncGitHub
:
$
(
"
#syncGitHub
"
).
prop
(
"
checked
"
),
commentable
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
),
customVars
:
$
(
"
#customVars
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/preference/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
&&
window
.
location
.
reload
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})}}},
admin
.
register
.
preference
=
{
obj
:
admin
.
preference
,
init
:
admin
.
preference
.
init
,
refresh
:
function
(){
admin
.
clearTip
()}};
admin
.
preference
=
{
locale
:
""
,
init
:
function
(){
$
(
"
#tabPreference
"
).
tabs
(),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/preference/
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
result
,
textStatus
){
if
(
$
(
"
#tipMsg
"
).
text
(
result
.
msg
),
result
.
sc
){
var
preference
=
result
.
preference
;
$
(
"
#metaKeywords
"
).
val
(
preference
.
metaKeywords
),
$
(
"
#metaDescription
"
).
val
(
preference
.
metaDescription
),
$
(
"
#blogTitle
"
).
val
(
preference
.
blogTitle
),
$
(
"
#blogSubtitle
"
).
val
(
preference
.
blogSubtitle
),
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(
preference
.
mostCommentArticleDisplayCount
),
$
(
"
#mostViewArticleDisplayCount
"
).
val
(
preference
.
mostViewArticleDisplayCount
),
$
(
"
#recentCommentDisplayCount
"
).
val
(
preference
.
recentCommentDisplayCount
),
$
(
"
#mostUsedTagDisplayCount
"
).
val
(
preference
.
mostUsedTagDisplayCount
),
$
(
"
#articleListDisplayCount
"
).
val
(
preference
.
articleListDisplayCount
),
$
(
"
#articleListPaginationWindowSize
"
).
val
(
preference
.
articleListPaginationWindowSize
),
$
(
"
#localeString
"
).
val
(
preference
.
localeString
),
$
(
"
#timeZoneId
"
).
val
(
preference
.
timeZoneId
),
$
(
"
#noticeBoard
"
).
val
(
preference
.
noticeBoard
),
$
(
"
#footerContent
"
).
val
(
preference
.
footerContent
),
$
(
"
#htmlHead
"
).
val
(
preference
.
htmlHead
),
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(
preference
.
externalRelevantArticlesDisplayCount
),
$
(
"
#relevantArticlesDisplayCount
"
).
val
(
preference
.
relevantArticlesDisplayCount
),
$
(
"
#randomArticlesDisplayCount
"
).
val
(
preference
.
randomArticlesDisplayCount
),
$
(
"
#customVars
"
).
val
(
preference
.
customVars
),
"
true
"
===
preference
.
enableArticleUpdateHint
?
$
(
"
#enableArticleUpdateHint
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
#enableArticleUpdateHint
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
allowVisitDraftViaPermalink
?
$
(
"
#allowVisitDraftViaPermalink
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
allowVisitDraftViaPermalink
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
commentable
?
$
(
"
#commentable
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
commentable
"
).
removeAttr
(
"
checked
"
),
"
true
"
===
preference
.
syncGitHub
?
$
(
"
#syncGitHub
"
).
attr
(
"
checked
"
,
"
checked
"
):
$
(
"
syncGitHub
"
).
removeAttr
(
"
checked
"
),
admin
.
preference
.
locale
=
preference
.
localeString
;
for
(
var
signs
=
eval
(
"
(
"
+
preference
.
signs
+
"
)
"
),
j
=
1
;
j
<
signs
.
length
;
j
++
)
$
(
"
#preferenceSign
"
+
j
).
val
(
signs
[
j
].
signHTML
);
$
(
"
#articleListDisplay
"
).
val
(
preference
.
articleListStyle
),
$
(
"
#hljsTheme
"
).
val
(
preference
.
hljsTheme
),
$
(
"
#feedOutputMode
"
).
val
(
preference
.
feedOutputMode
),
$
(
"
#feedOutputCnt
"
).
val
(
preference
.
feedOutputCnt
),
$
(
"
#faviconURL
"
).
val
(
preference
.
faviconURL
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
validate
:
function
(){
return
/^
\d
+$/
.
test
(
$
(
"
#mostUsedTagDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#recentCommentDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#mostCommentArticleDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#mostViewArticleDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#articleListDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#articleListPaginationWindowSize
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#randomArticlesDisplayCount
"
).
val
())?
/^
\d
+$/
.
test
(
$
(
"
#relevantArticlesDisplayCount
"
).
val
())?
!!
/^
\d
+$/
.
test
(
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
())
||
(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
externalRelevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#externalRelevantArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
relevantArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#relevantArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
randomArticlesDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#randomArticlesDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
windowSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#articleListPaginationWindowSize
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
pageSizeLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#articleListDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostViewArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostViewArticleDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexMostCommentArticleDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostCommentArticleDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexRecentCommentDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#recentCommentDisplayCount
"
).
focus
(),
!
1
):(
$
(
"
#tipMsg
"
).
text
(
"
[
"
+
Label
.
paramSettingsLabel
+
"
-
"
+
Label
.
indexTagDisplayCntLabel
+
"
]
"
+
Label
.
nonNegativeIntegerOnlyLabel
),
$
(
"
#mostUsedTagDisplayCount
"
).
focus
(),
!
1
)},
update
:
function
(){
if
(
admin
.
preference
.
validate
()){
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
e
=
[{
oId
:
0
,
signHTML
:
""
},{
oId
:
1
,
signHTML
:
$
(
"
#preferenceSign1
"
).
val
()},{
oId
:
2
,
signHTML
:
$
(
"
#preferenceSign2
"
).
val
()},{
oId
:
3
,
signHTML
:
$
(
"
#preferenceSign3
"
).
val
()}],
t
=
{
preference
:{
metaKeywords
:
$
(
"
#metaKeywords
"
).
val
(),
metaDescription
:
$
(
"
#metaDescription
"
).
val
(),
blogTitle
:
$
(
"
#blogTitle
"
).
val
(),
blogSubtitle
:
$
(
"
#blogSubtitle
"
).
val
(),
mostCommentArticleDisplayCount
:
$
(
"
#mostCommentArticleDisplayCount
"
).
val
(),
mostViewArticleDisplayCount
:
$
(
"
#mostViewArticleDisplayCount
"
).
val
(),
recentCommentDisplayCount
:
$
(
"
#recentCommentDisplayCount
"
).
val
(),
mostUsedTagDisplayCount
:
$
(
"
#mostUsedTagDisplayCount
"
).
val
(),
articleListDisplayCount
:
$
(
"
#articleListDisplayCount
"
).
val
(),
articleListPaginationWindowSize
:
$
(
"
#articleListPaginationWindowSize
"
).
val
(),
localeString
:
$
(
"
#localeString
"
).
val
(),
timeZoneId
:
$
(
"
#timeZoneId
"
).
val
(),
noticeBoard
:
$
(
"
#noticeBoard
"
).
val
(),
footerContent
:
$
(
"
#footerContent
"
).
val
(),
htmlHead
:
$
(
"
#htmlHead
"
).
val
(),
externalRelevantArticlesDisplayCount
:
$
(
"
#externalRelevantArticlesDisplayCount
"
).
val
(),
relevantArticlesDisplayCount
:
$
(
"
#relevantArticlesDisplayCount
"
).
val
(),
randomArticlesDisplayCount
:
$
(
"
#randomArticlesDisplayCount
"
).
val
(),
enableArticleUpdateHint
:
$
(
"
#enableArticleUpdateHint
"
).
prop
(
"
checked
"
),
signs
:
e
,
allowVisitDraftViaPermalink
:
$
(
"
#allowVisitDraftViaPermalink
"
).
prop
(
"
checked
"
),
articleListStyle
:
$
(
"
#articleListDisplay
"
).
val
(),
hljsTheme
:
$
(
"
#hljsTheme
"
).
val
(),
feedOutputMode
:
$
(
"
#feedOutputMode
"
).
val
(),
feedOutputCnt
:
$
(
"
#feedOutputCnt
"
).
val
(),
faviconURL
:
$
(
"
#faviconURL
"
).
val
(),
syncGitHub
:
$
(
"
#syncGitHub
"
).
prop
(
"
checked
"
),
commentable
:
$
(
"
#commentable
"
).
prop
(
"
checked
"
),
customVars
:
$
(
"
#customVars
"
).
val
()}};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/preference/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
t
),
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
$
(
"
#localeString
"
).
val
()
!==
admin
.
preference
.
locale
&&
window
.
location
.
reload
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})}}},
admin
.
register
.
preference
=
{
obj
:
admin
.
preference
,
init
:
admin
.
preference
.
init
,
refresh
:
function
(){
admin
.
clearTip
()}};
admin
.
themeList
=
{
skinDirName
:
""
,
mobileSkinDirName
:
""
,
init
:
function
(){
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/skin
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
i
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
){
admin
.
themeList
.
skinDirName
=
i
.
skin
.
skinDirName
,
admin
.
themeList
.
mobileSkinDirName
=
i
.
skin
.
mobileSkinDirName
;
for
(
var
a
=
JSON
.
parse
(
i
.
skin
.
skins
),
s
=
""
,
t
=
0
;
t
<
a
.
length
;
t
++
){
var
n
=
""
;
a
[
t
].
skinDirName
===
i
.
skin
.
skinDirName
&&
(
n
=
"
selected
"
),
s
+=
'
<div class="fn__left skinItem
'
+
n
+
'
"><div class="ft__center">
'
+
a
[
t
].
skinDirName
+
'
</div><img class="skinPreview" src="
'
+
Label
.
staticServePath
+
"
/skins/
"
+
a
[
t
].
skinDirName
+
'
/preview.png"/><div>
'
,
a
[
t
].
skinDirName
!==
i
.
skin
.
skinDirName
&&
(
s
+=
'
<button class="small update fn__left" data-name="
'
+
a
[
t
].
skinDirName
+
'
">
'
+
Label
.
enableLabel
+
"
</button>
"
),
a
[
t
].
skinDirName
!==
i
.
skin
.
mobileSkinDirName
&&
(
s
+=
'
<button class="small mobile fn__left" data-name="
'
+
a
[
t
].
skinDirName
+
'
">
'
+
Label
.
setMobileLabel
+
"
</button>
"
),
s
+=
'
<button class="small fn__right" onclick="window.open(
\'
'
+
Label
.
servePath
+
"
?skin=
"
+
a
[
t
].
skinDirName
+
"
')
\"
>
"
+
Label
.
previewLabel
+
"
</button></div></div>
"
}
$
(
"
#skinMain
"
).
html
(
s
+
"
<div class='fn__clear'></div>
"
),
$
(
"
.skinItem .update
"
).
click
(
function
(){
admin
.
themeList
.
update
(
$
(
this
).
data
(
"
name
"
),
"
pc
"
)}),
$
(
"
.skinItem .mobile
"
).
click
(
function
(){
admin
.
themeList
.
update
(
$
(
this
).
data
(
"
name
"
),
"
mobile
"
)}),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
);
var
a
=
{
skin
:{
skinDirName
:
admin
.
themeList
.
skinDirName
,
mobileSkinDirName
:
admin
.
themeList
.
mobileSkinDirName
}};
"
pc
"
===
e
?
a
.
skin
.
skinDirName
=
i
:
a
.
skin
.
mobileSkinDirName
=
i
,
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/skin
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
a
),
success
:
function
(
i
,
e
){
$
(
"
#tipMsg
"
).
text
(
i
.
msg
),
i
.
sc
&&
admin
.
themeList
.
init
(),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
theme-list
"
]
=
{
obj
:
admin
.
themeList
,
init
:
admin
.
themeList
.
init
,
refresh
:
function
(){
$
(
"
#loadMsg
"
).
text
(
""
)}};
admin
.
pluginList
=
{
tablePagination
:
new
TablePaginate
(
"
plugin
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
pluginNameLabel
,
index
:
"
name
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
statusLabel
,
index
:
"
status
"
,
minWidth
:
80
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
authorLabel
,
index
:
"
author
"
,
width
:
200
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
versionLabel
,
index
:
"
version
"
,
width
:
120
}]),
this
.
tablePagination
.
initPagination
(),
$
(
"
#pluginSetting
"
).
dialog
({
width
:
700
,
height
:
180
,
modal
:
!
0
,
hideFooter
:
!
0
}),
this
.
getList
(
t
)},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
l
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/plugins/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
admin
.
pluginList
.
pageInfo
.
currentPage
=
n
;
for
(
var
a
=
t
.
plugins
,
i
=
0
;
i
<
a
.
length
;
i
++
)
a
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.pluginList.changeStatus('
"
+
a
[
i
].
oId
+
"
', '
"
+
a
[
i
].
status
+
"
')
\"
>
"
,
"
ENABLED
"
===
a
[
i
].
status
?(
a
[
i
].
status
=
Label
.
enabledLabel
,
a
[
i
].
expendRow
+=
Label
.
disableLabel
):(
a
[
i
].
status
=
Label
.
disabledLabel
,
a
[
i
].
expendRow
+=
Label
.
enableLabel
),
a
[
i
].
expendRow
+=
"
</a>
"
,
"
{}
"
!=
a
[
i
].
setting
&&
(
a
[
i
].
expendRow
+=
"
<a href='javascript:void(0)' onclick=
\"
admin.pluginList.toSetting('
"
+
a
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
settingLabel
+
"
</a>
"
);
l
.
tablePagination
.
updateTablePagination
(
t
.
plugins
,
n
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
toSetting
:
function
(
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
{
oId
:
t
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/plugin/toSetting
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
e
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
$
(
"
#pluginSetting
"
).
html
(
t
),
$
(
"
#pluginSetting
"
).
dialog
(
"
open
"
),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
changeStatus
:
function
(
t
,
e
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
a
=
{
oId
:
t
,
status
:
e
=
"
ENABLED
"
===
e
?
"
DISABLED
"
:
"
ENABLED
"
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/plugin/status/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
a
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
?(
$
(
"
#loadMsg
"
).
text
(
""
),
window
.
location
.
reload
()):
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
plugin-list
"
]
=
{
obj
:
admin
.
pluginList
,
init
:
admin
.
pluginList
.
init
,
refresh
:
function
(){
$
(
"
#loadMsg
"
).
text
(
""
)}};
admin
.
pluginList
=
{
tablePagination
:
new
TablePaginate
(
"
plugin
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
init
:
function
(
t
){
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
pluginNameLabel
,
index
:
"
name
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
statusLabel
,
index
:
"
status
"
,
minWidth
:
80
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
authorLabel
,
index
:
"
author
"
,
width
:
200
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
versionLabel
,
index
:
"
version
"
,
width
:
120
}]),
this
.
tablePagination
.
initPagination
(),
$
(
"
#pluginSetting
"
).
dialog
({
width
:
700
,
height
:
180
,
modal
:
!
0
,
hideFooter
:
!
0
}),
this
.
getList
(
t
)},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
l
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/plugins/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
t
,
e
){
if
(
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
){
admin
.
pluginList
.
pageInfo
.
currentPage
=
n
;
for
(
var
a
=
t
.
plugins
,
i
=
0
;
i
<
a
.
length
;
i
++
)
a
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.pluginList.changeStatus('
"
+
a
[
i
].
oId
+
"
', '
"
+
a
[
i
].
status
+
"
')
\"
>
"
,
"
ENABLED
"
===
a
[
i
].
status
?(
a
[
i
].
status
=
Label
.
enabledLabel
,
a
[
i
].
expendRow
+=
Label
.
disableLabel
):(
a
[
i
].
status
=
Label
.
disabledLabel
,
a
[
i
].
expendRow
+=
Label
.
enableLabel
),
a
[
i
].
expendRow
+=
"
</a>
"
,
"
{}
"
!=
a
[
i
].
setting
&&
(
a
[
i
].
expendRow
+=
"
<a href='javascript:void(0)' onclick=
\"
admin.pluginList.toSetting('
"
+
a
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
settingLabel
+
"
</a>
"
);
l
.
tablePagination
.
updateTablePagination
(
t
.
plugins
,
n
,
t
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
toSetting
:
function
(
t
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
{
oId
:
t
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/plugin/toSetting
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
e
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
$
(
"
#pluginSetting
"
).
html
(
t
),
$
(
"
#pluginSetting
"
).
dialog
(
"
open
"
),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
changeStatus
:
function
(
t
,
e
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
a
=
{
oId
:
t
,
status
:
e
=
"
ENABLED
"
===
e
?
"
DISABLED
"
:
"
ENABLED
"
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/plugin/status/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
a
),
success
:
function
(
t
,
e
){
$
(
"
#tipMsg
"
).
text
(
t
.
msg
),
t
.
sc
?(
$
(
"
#loadMsg
"
).
text
(
""
),
window
.
location
.
reload
()):
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
plugin-list
"
]
=
{
obj
:
admin
.
pluginList
,
init
:
admin
.
pluginList
.
init
,
refresh
:
function
(){
$
(
"
#loadMsg
"
).
text
(
""
)}};
admin
.
userList
=
{
tablePagination
:
new
TablePaginate
(
"
user
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
userInfo
:{
oId
:
""
,
userRole
:
""
},
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
userNameLabel
,
index
:
"
userName
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
roleLabel
,
index
:
"
isAdmin
"
,
width
:
120
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
e
),
$
(
"
#userUpdate
"
).
dialog
({
width
:
700
,
height
:
450
,
modal
:
!
0
,
hideFooter
:
!
0
})},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
this
.
pageInfo
.
currentPage
=
n
;
var
r
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/users/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
e
.
users
,
s
=
[];
if
(
admin
.
userList
.
pageInfo
.
currentCount
=
t
.
length
,
admin
.
userList
.
pageInfo
.
pageCount
=
e
.
pagination
.
paginationPageCount
,
t
.
length
<
1
)
return
$
(
"
#tipMsg
"
).
text
(
"
No user
"
+
Label
.
reportIssueLabel
),
void
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#tipMsg
"
).
text
(
Label
.
uploadMsg
);
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
)
s
[
i
]
=
{},
s
[
i
].
userName
=
t
[
i
].
userName
,
"
adminRole
"
===
t
[
i
].
userRole
?(
s
[
i
].
isAdmin
=
"
"
+
Label
.
administratorLabel
,
s
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
t
[
i
].
oId
+
"
', '
"
+
t
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
"
):(
s
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
t
[
i
].
oId
+
"
', '
"
+
t
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.userList.del('
"
+
t
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
t
[
i
].
userName
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.userList.changeRole('
"
+
t
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
changeRoleLabel
+
"
</a>
"
,
"
defaultRole
"
===
t
[
i
].
userRole
?
s
[
i
].
isAdmin
=
Label
.
commonUserLabel
:
s
[
i
].
isAdmin
=
Label
.
visitorUserLabel
),
r
.
tablePagination
.
updateTablePagination
(
s
,
n
,
e
.
pagination
);
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
get
:
function
(
t
,
s
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#userUpdate
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/user/
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
$
(
"
#userURLUpdate
"
).
val
(
e
.
user
.
userURL
),
$
(
"
#userAvatarUpdate
"
).
val
(
e
.
user
.
userAvatar
),
$
(
"
#userB3KeyUpdate
"
).
val
(
e
.
user
.
userB3Key
),
$
(
"
#userNameUpdate
"
).
val
(
e
.
user
.
userName
).
data
(
"
userInfo
"
,{
oId
:
t
,
userRole
:
s
})),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
$
(
"
#userNameUpdate
"
).
data
(
"
userInfo
"
),
a
=
{
userName
:
$
(
"
#userNameUpdate
"
).
val
(),
oId
:
e
.
oId
,
userURL
:
$
(
"
#userURLUpdate
"
).
val
(),
userRole
:
e
.
userRole
,
userAvatar
:
$
(
"
#userAvatarUpdate
"
).
val
(),
userB3Key
:
$
(
"
#userB3KeyUpdate
"
).
val
()};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/user/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
a
),
success
:
function
(
e
,
a
){
$
(
"
#userUpdate
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
e
,
a
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
userLabel
+
'
"
'
+
Util
.
htmlDecode
(
a
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/user/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
userList
.
pageInfo
.
currentPage
;
1
===
admin
.
userList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
userList
.
pageInfo
.
pageCount
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
&&
(
admin
.
userList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
userList
.
pageInfo
.
pageCount
);
var
s
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
!==
parseInt
(
s
[
s
.
length
-
1
])
&&
admin
.
setHashByPage
(
t
),
admin
.
userList
.
getList
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
changeRole
:
function
(
e
){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/changeRole/
"
+
e
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
userList
.
pageInfo
.
currentPage
;
1
===
admin
.
userList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
userList
.
pageInfo
.
pageCount
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
&&
(
admin
.
userList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
userList
.
pageInfo
.
pageCount
);
var
s
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
!==
parseInt
(
s
[
s
.
length
-
1
])
&&
admin
.
setHashByPage
(
t
),
admin
.
userList
.
getList
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
validate
:
function
(
e
){
e
||
(
e
=
""
);
var
a
=
$
(
"
#userName
"
+
e
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
return
!
(
a
.
length
<
2
||
20
<
a
.
length
)
||
(
$
(
"
#tipMsg
"
).
text
(
Label
.
nameTooLongLabel
),
$
(
"
#userName
"
+
e
).
focus
(),
!
1
)}},
admin
.
register
[
"
user-list
"
]
=
{
obj
:
admin
.
userList
,
init
:
admin
.
userList
.
init
,
refresh
:
admin
.
userList
.
getList
};
admin
.
userList
=
{
tablePagination
:
new
TablePaginate
(
"
user
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
userInfo
:{
oId
:
""
,
userRole
:
""
},
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
userNameLabel
,
index
:
"
userName
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
roleLabel
,
index
:
"
isAdmin
"
,
width
:
120
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
e
),
$
(
"
#userUpdate
"
).
dialog
({
width
:
700
,
height
:
450
,
modal
:
!
0
,
hideFooter
:
!
0
})},
getList
:
function
(
n
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
this
.
pageInfo
.
currentPage
=
n
;
var
r
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/users/
"
+
n
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
e
.
users
,
s
=
[];
if
(
admin
.
userList
.
pageInfo
.
currentCount
=
t
.
length
,
admin
.
userList
.
pageInfo
.
pageCount
=
e
.
pagination
.
paginationPageCount
,
t
.
length
<
1
)
return
$
(
"
#tipMsg
"
).
text
(
"
No user
"
+
Label
.
reportIssueLabel
),
void
$
(
"
#loadMsg
"
).
text
(
""
);
$
(
"
#tipMsg
"
).
text
(
Label
.
uploadMsg
);
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
)
s
[
i
]
=
{},
s
[
i
].
userName
=
t
[
i
].
userName
,
"
adminRole
"
===
t
[
i
].
userRole
?(
s
[
i
].
isAdmin
=
"
"
+
Label
.
administratorLabel
,
s
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
t
[
i
].
oId
+
"
', '
"
+
t
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a>
"
):(
s
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.userList.get('
"
+
t
[
i
].
oId
+
"
', '
"
+
t
[
i
].
userRole
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.userList.del('
"
+
t
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
t
[
i
].
userName
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.userList.changeRole('
"
+
t
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
changeRoleLabel
+
"
</a>
"
,
"
defaultRole
"
===
t
[
i
].
userRole
?
s
[
i
].
isAdmin
=
Label
.
commonUserLabel
:
s
[
i
].
isAdmin
=
Label
.
visitorUserLabel
),
r
.
tablePagination
.
updateTablePagination
(
s
,
n
,
e
.
pagination
);
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
get
:
function
(
t
,
s
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#userUpdate
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/user/
"
+
t
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
$
(
"
#userURLUpdate
"
).
val
(
e
.
user
.
userURL
),
$
(
"
#userAvatarUpdate
"
).
val
(
e
.
user
.
userAvatar
),
$
(
"
#userB3KeyUpdate
"
).
val
(
e
.
user
.
userB3Key
),
$
(
"
#userNameUpdate
"
).
val
(
e
.
user
.
userName
).
data
(
"
userInfo
"
,{
oId
:
t
,
userRole
:
s
})),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
$
(
"
#userNameUpdate
"
).
data
(
"
userInfo
"
),
a
=
{
userName
:
$
(
"
#userNameUpdate
"
).
val
(),
oId
:
e
.
oId
,
userURL
:
$
(
"
#userURLUpdate
"
).
val
(),
userRole
:
e
.
userRole
,
userAvatar
:
$
(
"
#userAvatarUpdate
"
).
val
(),
userB3Key
:
$
(
"
#userB3KeyUpdate
"
).
val
()};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/user/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
a
),
success
:
function
(
e
,
a
){
$
(
"
#userUpdate
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
admin
.
userList
.
getList
(
admin
.
userList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
e
,
a
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
userLabel
+
'
"
'
+
Util
.
htmlDecode
(
a
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/user/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
userList
.
pageInfo
.
currentPage
;
1
===
admin
.
userList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
userList
.
pageInfo
.
pageCount
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
&&
(
admin
.
userList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
userList
.
pageInfo
.
pageCount
);
var
s
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
!==
parseInt
(
s
[
s
.
length
-
1
])
&&
admin
.
setHashByPage
(
t
),
admin
.
userList
.
getList
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
changeRole
:
function
(
e
){
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/changeRole/
"
+
e
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
a
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
t
=
admin
.
userList
.
pageInfo
.
currentPage
;
1
===
admin
.
userList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
userList
.
pageInfo
.
pageCount
&&
admin
.
userList
.
pageInfo
.
currentPage
===
admin
.
userList
.
pageInfo
.
pageCount
&&
(
admin
.
userList
.
pageInfo
.
pageCount
--
,
t
=
admin
.
userList
.
pageInfo
.
pageCount
);
var
s
=
window
.
location
.
hash
.
split
(
"
/
"
);
t
!==
parseInt
(
s
[
s
.
length
-
1
])
&&
admin
.
setHashByPage
(
t
),
admin
.
userList
.
getList
(
t
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
validate
:
function
(
e
){
e
||
(
e
=
""
);
var
a
=
$
(
"
#userName
"
+
e
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
return
!
(
a
.
length
<
2
||
20
<
a
.
length
)
||
(
$
(
"
#tipMsg
"
).
text
(
Label
.
nameTooLongLabel
),
$
(
"
#userName
"
+
e
).
focus
(),
!
1
)}},
admin
.
register
[
"
user-list
"
]
=
{
obj
:
admin
.
userList
,
init
:
admin
.
userList
.
init
,
refresh
:
admin
.
userList
.
getList
};
admin
.
categoryList
=
{
tablePagination
:
new
TablePaginate
(
"
category
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
linkOrder
"
,
width
:
60
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
titleLabel
,
index
:
"
categoryTitle
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
"
URI
"
,
index
:
"
categoryURI
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
descriptionLabel
,
index
:
"
categoryDesc
"
,
minWidth
:
180
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
e
),
$
(
"
#categoryUpdate
"
).
dialog
({
title
:
$
(
"
#categoryUpdate
"
).
data
(
"
title
"
),
width
:
700
,
height
:
358
,
modal
:
!
0
,
hideFooter
:
!
0
}),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/tags
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
if
(
!
(
e
.
tags
.
length
<=
0
)){
for
(
var
a
=
[],
o
=
0
;
o
<
e
.
tags
.
length
;
o
++
)
a
.
push
(
e
.
tags
[
o
].
tagTitle
);
$
(
"
#categoryTags
"
).
completed
({
height
:
160
,
buttonText
:
Label
.
selectLabel
,
data
:
a
}),
$
(
"
#loadMsg
"
).
text
(
""
)}}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
getList
:
function
(
g
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
this
.
pageInfo
.
currentPage
=
g
;
var
n
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/categories/
"
+
g
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
a
=
e
.
categories
,
o
=
[];
admin
.
categoryList
.
pageInfo
.
currentCount
=
a
.
length
,
admin
.
categoryList
.
pageInfo
.
pageCount
=
0
===
e
.
pagination
.
paginationPageCount
?
1
:
e
.
pagination
.
paginationPageCount
;
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
o
[
i
]
=
{},
0
===
i
?
1
===
a
.
length
?
o
[
i
].
linkOrder
=
""
:
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
:
i
===
a
.
length
-
1
?
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
,
o
[
i
].
categoryTitle
=
a
[
i
].
categoryTitle
,
o
[
i
].
categoryURI
=
a
[
i
].
categoryURI
,
o
[
i
].
categoryDesc
=
a
[
i
].
categoryDescription
,
o
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.categoryList.get('
"
+
a
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.categoryList.del('
"
+
a
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
a
[
i
].
categoryTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a>
"
;
n
.
tablePagination
.
updateTablePagination
(
o
,
g
,
e
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
{
categoryTitle
:
$
(
"
#categoryName
"
).
val
(),
categoryTags
:
$
(
"
#categoryTags
"
).
val
(),
categoryURI
:
$
(
"
#categoryURI
"
).
val
(),
categoryDescription
:
$
(
"
#categoryDesc
"
).
val
()};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
e
),
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
$
(
"
#categoryName
"
).
val
(
""
),
$
(
"
#categoryTags
"
).
val
(
""
),
$
(
"
#categoryURI
"
).
val
(
""
),
$
(
"
#categoryDesc
"
).
val
(
""
),
admin
.
categoryList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
categoryList
.
pageInfo
.
currentPage
===
admin
.
categoryList
.
pageInfo
.
pageCount
&&
admin
.
categoryList
.
pageInfo
.
pageCount
++
;
var
a
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
categoryList
.
pageInfo
.
pageCount
!==
parseInt
(
a
[
a
.
length
-
1
])
&&
admin
.
setHashByPage
(
admin
.
categoryList
.
pageInfo
.
pageCount
),
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
get
:
function
(
a
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#categoryUpdate
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/
"
+
a
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
$
(
"
#categoryNameUpdate
"
).
val
(
e
.
categoryTitle
).
data
(
"
oId
"
,
a
),
$
(
"
#categoryURIUpdate
"
).
val
(
e
.
categoryURI
),
$
(
"
#categoryDescUpdate
"
).
val
(
e
.
categoryDescription
),
$
(
"
#categoryTagsUpdate
"
).
val
(
e
.
categoryTags
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
{
categoryTitle
:
$
(
"
#categoryNameUpdate
"
).
val
(),
oId
:
$
(
"
#categoryNameUpdate
"
).
data
(
"
oId
"
),
categoryTags
:
$
(
"
#categoryTagsUpdate
"
).
val
(),
categoryURI
:
$
(
"
#categoryURIUpdate
"
).
val
(),
categoryDescription
:
$
(
"
#categoryDescUpdate
"
).
val
()};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
e
),
success
:
function
(
e
,
t
){
$
(
"
#categoryUpdate
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
e
,
t
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
categoryLabel
+
'
"
'
+
Util
.
htmlDecode
(
t
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
a
=
admin
.
categoryList
.
pageInfo
.
currentPage
;
1
===
admin
.
categoryList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
categoryList
.
pageInfo
.
pageCount
&&
admin
.
categoryList
.
pageInfo
.
currentPage
===
admin
.
categoryList
.
pageInfo
.
pageCount
&&
(
admin
.
categoryList
.
pageInfo
.
pageCount
--
,
a
=
admin
.
categoryList
.
pageInfo
.
pageCount
);
var
o
=
window
.
location
.
hash
.
split
(
"
/
"
);
a
!==
parseInt
(
o
[
o
.
length
-
1
])
&&
admin
.
setHashByPage
(
a
),
admin
.
categoryList
.
getList
(
a
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
validate
:
function
(
e
){
e
||
(
e
=
""
);
var
t
=
$
(
"
#categoryName
"
+
e
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
t
.
length
<
2
||
32
<
t
.
length
)
$
(
"
#tipMsg
"
).
text
(
Label
.
categoryTooLongLabel
),
$
(
"
#categoryName
"
+
e
).
focus
();
else
{
if
(
""
!==
$
.
trim
(
$
(
"
#categoryTags
"
+
e
).
val
()))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
tagsEmptyLabel
),
$
(
"
#categoryTags
"
+
e
).
focus
()}
return
!
1
},
changeOrder
:
function
(
e
,
t
,
a
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
o
=
{
oId
:
e
.
toString
(),
direction
:
a
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
o
),
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
category-list
"
]
=
{
obj
:
admin
.
categoryList
,
init
:
admin
.
categoryList
.
init
,
refresh
:
admin
.
categoryList
.
getList
};
admin
.
categoryList
=
{
tablePagination
:
new
TablePaginate
(
"
category
"
),
pageInfo
:{
currentCount
:
1
,
pageCount
:
1
,
currentPage
:
1
},
init
:
function
(
e
){
this
.
tablePagination
.
buildTable
([{
text
:
""
,
index
:
"
linkOrder
"
,
width
:
60
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
titleLabel
,
index
:
"
categoryTitle
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
"
URI
"
,
index
:
"
categoryURI
"
,
width
:
230
},{
style
:
"
padding-left: 12px;
"
,
text
:
Label
.
descriptionLabel
,
index
:
"
categoryDesc
"
,
minWidth
:
180
}]),
this
.
tablePagination
.
initPagination
(),
this
.
getList
(
e
),
$
(
"
#categoryUpdate
"
).
dialog
({
title
:
$
(
"
#categoryUpdate
"
).
data
(
"
title
"
),
width
:
700
,
height
:
358
,
modal
:
!
0
,
hideFooter
:
!
0
}),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/tags
"
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
if
(
!
(
e
.
tags
.
length
<=
0
)){
for
(
var
a
=
[],
o
=
0
;
o
<
e
.
tags
.
length
;
o
++
)
a
.
push
(
e
.
tags
[
o
].
tagTitle
);
$
(
"
#categoryTags
"
).
completed
({
height
:
160
,
buttonText
:
Label
.
selectLabel
,
data
:
a
}),
$
(
"
#loadMsg
"
).
text
(
""
)}}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
getList
:
function
(
g
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
this
.
pageInfo
.
currentPage
=
g
;
var
n
=
this
;
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/categories/
"
+
g
+
"
/
"
+
Label
.
PAGE_SIZE
+
"
/
"
+
Label
.
WINDOW_SIZE
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
a
=
e
.
categories
,
o
=
[];
admin
.
categoryList
.
pageInfo
.
currentCount
=
a
.
length
,
admin
.
categoryList
.
pageInfo
.
pageCount
=
0
===
e
.
pagination
.
paginationPageCount
?
1
:
e
.
pagination
.
paginationPageCount
;
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
o
[
i
]
=
{},
0
===
i
?
1
===
a
.
length
?
o
[
i
].
linkOrder
=
""
:
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
:
i
===
a
.
length
-
1
?
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> </div>
'
:
o
[
i
].
linkOrder
=
'
<div class="table-center" style="width:38px"> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
up
\'
);" class="icon-move-up"></span> <span onclick="admin.categoryList.changeOrder(
'
+
a
[
i
].
oId
+
"
,
"
+
i
+
'
,
\'
down
\'
);" class="icon-move-down"></span> </div>
'
,
o
[
i
].
categoryTitle
=
a
[
i
].
categoryTitle
,
o
[
i
].
categoryURI
=
a
[
i
].
categoryURI
,
o
[
i
].
categoryDesc
=
a
[
i
].
categoryDescription
,
o
[
i
].
expendRow
=
"
<a href='javascript:void(0)' onclick=
\"
admin.categoryList.get('
"
+
a
[
i
].
oId
+
"
')
\"
>
"
+
Label
.
updateLabel
+
"
</a> <a href='javascript:void(0)' onclick=
\"
admin.categoryList.del('
"
+
a
[
i
].
oId
+
"
', '
"
+
encodeURIComponent
(
a
[
i
].
categoryTitle
)
+
"
')
\"
>
"
+
Label
.
removeLabel
+
"
</a>
"
;
n
.
tablePagination
.
updateTablePagination
(
o
,
g
,
e
.
pagination
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})},
add
:
function
(){
if
(
this
.
validate
()){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
{
categoryTitle
:
$
(
"
#categoryName
"
).
val
(),
categoryTags
:
$
(
"
#categoryTags
"
).
val
(),
categoryURI
:
$
(
"
#categoryURI
"
).
val
(),
categoryDescription
:
$
(
"
#categoryDesc
"
).
val
()};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/
"
,
type
:
"
POST
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
e
),
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
$
(
"
#categoryName
"
).
val
(
""
),
$
(
"
#categoryTags
"
).
val
(
""
),
$
(
"
#categoryURI
"
).
val
(
""
),
$
(
"
#categoryDesc
"
).
val
(
""
),
admin
.
categoryList
.
pageInfo
.
currentCount
===
Label
.
PAGE_SIZE
&&
admin
.
categoryList
.
pageInfo
.
currentPage
===
admin
.
categoryList
.
pageInfo
.
pageCount
&&
admin
.
categoryList
.
pageInfo
.
pageCount
++
;
var
a
=
window
.
location
.
hash
.
split
(
"
/
"
);
admin
.
categoryList
.
pageInfo
.
pageCount
!==
parseInt
(
a
[
a
.
length
-
1
])
&&
admin
.
setHashByPage
(
admin
.
categoryList
.
pageInfo
.
pageCount
),
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
pageCount
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
get
:
function
(
a
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
(
"
#categoryUpdate
"
).
dialog
(
"
open
"
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/
"
+
a
,
type
:
"
GET
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
(
$
(
"
#categoryNameUpdate
"
).
val
(
e
.
categoryTitle
).
data
(
"
oId
"
,
a
),
$
(
"
#categoryURIUpdate
"
).
val
(
e
.
categoryURI
),
$
(
"
#categoryDescUpdate
"
).
val
(
e
.
categoryDescription
),
$
(
"
#categoryTagsUpdate
"
).
val
(
e
.
categoryTags
)),
$
(
"
#loadMsg
"
).
text
(
""
)}})},
update
:
function
(){
if
(
this
.
validate
(
"
Update
"
)){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
e
=
{
categoryTitle
:
$
(
"
#categoryNameUpdate
"
).
val
(),
oId
:
$
(
"
#categoryNameUpdate
"
).
data
(
"
oId
"
),
categoryTags
:
$
(
"
#categoryTagsUpdate
"
).
val
(),
categoryURI
:
$
(
"
#categoryURIUpdate
"
).
val
(),
categoryDescription
:
$
(
"
#categoryDescUpdate
"
).
val
()};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
e
),
success
:
function
(
e
,
t
){
$
(
"
#categoryUpdate
"
).
dialog
(
"
close
"
),
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
&&
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
del
:
function
(
e
,
t
){
confirm
(
Label
.
confirmRemoveLabel
+
Label
.
categoryLabel
+
'
"
'
+
Util
.
htmlDecode
(
t
)
+
'
"?
'
)
&&
(
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
),
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/
"
+
e
,
type
:
"
DELETE
"
,
cache
:
!
1
,
success
:
function
(
e
,
t
){
if
(
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
e
.
sc
){
var
a
=
admin
.
categoryList
.
pageInfo
.
currentPage
;
1
===
admin
.
categoryList
.
pageInfo
.
currentCount
&&
1
!==
admin
.
categoryList
.
pageInfo
.
pageCount
&&
admin
.
categoryList
.
pageInfo
.
currentPage
===
admin
.
categoryList
.
pageInfo
.
pageCount
&&
(
admin
.
categoryList
.
pageInfo
.
pageCount
--
,
a
=
admin
.
categoryList
.
pageInfo
.
pageCount
);
var
o
=
window
.
location
.
hash
.
split
(
"
/
"
);
a
!==
parseInt
(
o
[
o
.
length
-
1
])
&&
admin
.
setHashByPage
(
a
),
admin
.
categoryList
.
getList
(
a
),
$
(
"
#loadMsg
"
).
text
(
""
)}
else
$
(
"
#loadMsg
"
).
text
(
""
)}}))},
validate
:
function
(
e
){
e
||
(
e
=
""
);
var
t
=
$
(
"
#categoryName
"
+
e
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
t
.
length
<
2
||
32
<
t
.
length
)
$
(
"
#tipMsg
"
).
text
(
Label
.
categoryTooLongLabel
),
$
(
"
#categoryName
"
+
e
).
focus
();
else
{
if
(
""
!==
$
.
trim
(
$
(
"
#categoryTags
"
+
e
).
val
()))
return
!
0
;
$
(
"
#tipMsg
"
).
text
(
Label
.
tagsEmptyLabel
),
$
(
"
#categoryTags
"
+
e
).
focus
()}
return
!
1
},
changeOrder
:
function
(
e
,
t
,
a
){
$
(
"
#loadMsg
"
).
text
(
Label
.
loadingLabel
),
$
(
"
#tipMsg
"
).
text
(
""
);
var
o
=
{
oId
:
e
.
toString
(),
direction
:
a
};
$
.
ajax
({
url
:
Label
.
servePath
+
"
/console/category/order/
"
,
type
:
"
PUT
"
,
cache
:
!
1
,
data
:
JSON
.
stringify
(
o
),
success
:
function
(
e
,
t
){
$
(
"
#tipMsg
"
).
text
(
e
.
msg
),
admin
.
categoryList
.
getList
(
admin
.
categoryList
.
pageInfo
.
currentPage
),
$
(
"
#loadMsg
"
).
text
(
""
)}})}},
admin
.
register
[
"
category-list
"
]
=
{
obj
:
admin
.
categoryList
,
init
:
admin
.
categoryList
.
init
,
refresh
:
admin
.
categoryList
.
getList
};
...
...
src/main/webapp/js/common.min.js
View file @
f8dcb628
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/highlight.js@9.15.6/styles/
"
+
Label
.
hljsStyle
+
"
.min.css
"
,
"
vditorHljsStyle
"
);
var
e
=
function
(){
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
(),
$
(
"
pre > code
"
).
addClass
(
"
hljs
"
)};
Label
.
markedAvailable
||
(
"
undefined
"
==
typeof
hljs
?
$
.
ajax
({
url
:
"
https://cdn.jsdelivr.net/npm/vditor@1.2.5/src/assets/js/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.2.5/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
}}())},
replaceEmString
:
function
(
e
){
var
t
=
e
.
split
(
"
[em
"
);
if
(
1
===
t
.
length
)
return
e
;
e
=
t
[
0
];
for
(
var
i
=
1
;
i
<
t
.
length
;
i
++
){
var
n
=
t
[
i
].
substr
(
0
,
2
);
e
+=
"
<img width='20' src='
"
+
Label
.
staticServePath
+
"
/images/emotions/em
"
+
n
+
"
.png' alt='
"
+
Label
[
"
em
"
+
n
+
"
Label
"
]
+
"
' title='
"
+
Label
[
"
em
"
+
n
+
"
Label
"
]
+
"
'/>
"
+
t
[
i
].
substr
(
3
)}
return
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
🎸一款小而美的博客系统,专为程序员设计。
"
+
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
(
Util
.
replaceEmString
(
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=/
"
}};
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/highlight.js@9.15.6/styles/
"
+
Label
.
hljsStyle
+
"
.min.css
"
,
"
vditorHljsStyle
"
);
var
e
=
function
(){
hljs
.
initHighlighting
.
called
=!
1
,
hljs
.
initHighlighting
()};
Label
.
markedAvailable
||
(
"
undefined
"
==
typeof
hljs
?
$
.
ajax
({
url
:
"
https://cdn.jsdelivr.net/npm/vditor@1.2.5/src/assets/js/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.2.5/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
}}())},
replaceEmString
:
function
(
e
){
var
t
=
e
.
split
(
"
[em
"
);
if
(
1
===
t
.
length
)
return
e
;
e
=
t
[
0
];
for
(
var
i
=
1
;
i
<
t
.
length
;
i
++
){
var
n
=
t
[
i
].
substr
(
0
,
2
);
e
+=
"
<img width='20' src='
"
+
Label
.
staticServePath
+
"
/images/emotions/em
"
+
n
+
"
.png' alt='
"
+
Label
[
"
em
"
+
n
+
"
Label
"
]
+
"
' title='
"
+
Label
[
"
em
"
+
n
+
"
Label
"
]
+
"
'/>
"
+
t
[
i
].
substr
(
3
)}
return
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
🎸一款小而美的博客系统,专为程序员设计。
"
+
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
(
Util
.
replaceEmString
(
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
\ No newline at end of file
skins
@
a5d63c72
Subproject commit
87265b97bce95132ea233903c3e91f9b101a31ca
Subproject commit
a5d63c72257319eefc2c90fec1961765413d3ff9
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