Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo
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
Commits
12f1479d
Commit
12f1479d
authored
Nov 09, 2016
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改进 - 修复单元测试 & 压缩静态资源
parent
ee7ac72f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
129 additions
and
27 deletions
+129
-27
src/main/webapp/css/default-admin.min.css
src/main/webapp/css/default-admin.min.css
+1
-1
src/main/webapp/js/admin/latkeAdmin.js
src/main/webapp/js/admin/latkeAdmin.js
+119
-16
src/main/webapp/js/admin/latkeAdmin.min.js
src/main/webapp/js/admin/latkeAdmin.min.js
+1
-1
src/main/webapp/js/page.min.js
src/main/webapp/js/page.min.js
+1
-1
src/test/java/org/b3log/solo/service/ArticleQueryServiceTestCase.java
...a/org/b3log/solo/service/ArticleQueryServiceTestCase.java
+2
-2
src/test/java/org/b3log/solo/service/TagQueryServiceTestCase.java
.../java/org/b3log/solo/service/TagQueryServiceTestCase.java
+5
-6
No files found.
src/main/webapp/css/default-admin.min.css
View file @
12f1479d
...
...
@@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
body
,
input
,
textarea
{
font-family
:
"Helvetica Neue"
,
"Luxi Sans"
,
"DejaVu Sans"
,
Tahoma
,
"Hiragino Sans GB"
,
"Microsoft Yahei"
,
sans-serif
}
html
,
body
{
min-width
:
1024px
;
color
:
#767676
;
background
:
#f1f2f7
;
font-size
:
13px
}
a
{
color
:
#4183c4
;
text-decoration
:
none
}
a
:visited
{
color
:
#7ba9d6
}
a
:active
{
color
:
#2c5d8d
}
a
:hover
{
text-decoration
:
underline
}
button
.selected
{
background
:
url("../images/bowknot/completed.png")
no-repeat
scroll
right
bottom
transparent
!important
;
color
:
#d54121
!important
;
border-color
:
#b0b5b9
!important
}
@font-face
{
font-family
:
'icomoon'
;
src
:
url('fonts/icomoon.eot?1450')
;
src
:
url('fonts/icomoon.eot?#iefix')
format
(
'embedded-opentype'
),
url('fonts/icomoon.ttf?1450')
format
(
'truetype'
),
url('fonts/icomoon.woff?1450')
format
(
'woff'
),
url('fonts/icomoon.svg#icomoon')
format
(
'svg'
);
font-weight
:
normal
;
font-style
:
normal
}
[
class
^=
"icon-"
],[
class
*=
" icon-"
]
{
font-family
:
'icomoon'
;
speak
:
none
;
font-style
:
normal
;
font-weight
:
normal
;
font-variant
:
normal
;
text-transform
:
none
;
line-height
:
1
;
-webkit-font-smoothing
:
antialiased
;
-moz-osx-font-smoothing
:
grayscale
}
a
[
class
^=
"icon-"
],
a
[
class
*=
" icon-"
]
{
color
:
#333
}
a
[
class
^=
"icon-"
]
:hover
,
a
[
class
*=
" icon-"
]
:hover
{
text-decoration
:
none
;
color
:
#4183c4
}
.icon-upload
:before
{
content
:
"\f0ee"
}
.icon-copy
:before
{
content
:
"\e908"
}
.icon-time
:before
{
content
:
"\e906"
}
.icon-sortasc
:before
{
content
:
"\e905"
}
.icon-locked
:before
{
content
:
"\e61e"
}
.icon-close
:before
{
content
:
"\e909"
}
.icon-points
:before
{
content
:
"\e900"
}
.icon-goods
:before
{
content
:
"\e904"
}
.icon-bold
:before
{
content
:
"\e000"
}
.icon-italic
:before
{
content
:
"\e001"
}
.icon-quote
:before
{
content
:
"\e003"
}
.icon-unordered-list
:before
{
content
:
"\e004"
}
.icon-ordered-list
:before
{
content
:
"\e005"
}
.icon-link
:before
{
content
:
"\e006"
}
.icon-image
:before
{
content
:
"\e007"
}
.icon-play
:before
{
content
:
"\e008"
}
.icon-music
:before
{
content
:
"\e009"
}
.icon-contract
:before
{
content
:
"\e00a"
}
.icon-fullscreen
:before
{
content
:
"\e00b"
}
.icon-question
:before
{
content
:
"\e00c"
}
.icon-info
:before
{
content
:
"\e00d"
}
.icon-undo
:before
{
content
:
"\e00e"
}
.icon-redo
:before
{
content
:
"\e00f"
}
.icon-code
:before
{
content
:
"\e011"
}
.icon-preview
:before
{
content
:
"\e002"
}
.icon-navigation
:before
{
content
:
"\e903"
}
.icon-thumbs-down
:before
{
content
:
"\e901"
}
.icon-thumbs-up
:before
{
content
:
"\e902"
}
.icon-video
:before
{
content
:
"\f057"
}
.icon-feed
:before
{
content
:
"\e61f"
}
.icon-article
:before
{
content
:
"\e61d"
}
.icon-star
:before
{
content
:
"\e600"
}
.icon-register
:before
{
content
:
"\e602"
}
.icon-logout
:before
{
content
:
"\e603"
}
.icon-setting
:before
{
content
:
"\e604"
}
.icon-google
:before
{
content
:
"\e605"
}
.icon-search
:before
{
content
:
"\e606"
}
.icon-weibo
:before
{
content
:
"\e607"
}
.icon-date
:before
{
content
:
"\e608"
}
.icon-view
:before
{
content
:
"\e609"
}
.icon-cmts
:before
{
content
:
"\e60a"
}
.icon-refresh
:before
{
content
:
"\e60b"
}
.icon-up
:before
{
content
:
"\e60c"
}
.icon-twitter
:before
{
content
:
"\e60d"
}
.icon-edit
:before
{
content
:
"\e60e"
}
.icon-tencent
:before
{
content
:
"\e60f"
}
.icon-tag
:before
{
content
:
"\e610"
}
.icon-tags
:before
{
content
:
"\e611"
}
.icon-addfile
:before
{
content
:
"\e612"
}
.icon-login
:before
{
content
:
"\e613"
}
.icon-articles
:before
{
content
:
"\e614"
}
.icon-userrole
:before
{
content
:
"\e615"
}
.icon-email
:before
{
content
:
"\e616"
}
.icon-flag
:before
{
content
:
"\e617"
}
.icon-chevron-down
:before
{
content
:
"\e618"
;
margin-right
:
10px
}
.icon-chevron-up
:before
{
content
:
"\e619"
;
margin-right
:
10px
}
.icon-reply
:before
{
content
:
"\e61a"
}
.icon-clock
:before
{
content
:
"\e61b"
}
.icon-compass
:before
{
content
:
"\e61c"
}
.icon-heart
:before
{
content
:
"\e9da"
}
.icon-wechat
:before
{
content
:
"\e907"
}
.aboutIcon
{
background-position
:
-16px
-48px
}
#allPanel
{
height
:
auto
;
min-height
:
100%
;
position
:
relative
}
#tabsPanel
{
margin
:
50px
0
0
240px
;
padding
:
15px
}
#tabsPanel
>
div
{
padding-bottom
:
36px
}
#tabsPanel_article-list
,
#tabsPanel_draft-list
,
#tabsPanel_comment-list
,
#tabsPanel_plugin-list
,
#tabsPanel_page-list
>
div
:first-child
,
#tabsPanel_user-list
>
div
:first-child
,
#tabsPanel_link-list
>
div
:first-child
{
background-color
:
#FFF
;
border-radius
:
4px
;
margin-bottom
:
40px
;
overflow
:
hidden
}
.tip
{
font-weight
:
bold
;
margin
:
0
auto
;
overflow
:
hidden
;
padding
:
2px
0
;
position
:
fixed
;
text-align
:
center
;
top
:
3px
;
left
:
255px
;
z-index
:
1001
}
#tipMsg
,
#loadMsg
{
color
:
#31708f
;
background-color
:
#d9edf7
;
border-radius
:
4px
;
line-height
:
40px
;
display
:
inline-block
}
.footer
{
bottom
:
12px
;
position
:
absolute
;
text-align
:
center
;
width
:
100%
;
padding-left
:
240px
;
box-sizing
:
border-box
}
#top
{
height
:
50px
;
position
:
fixed
;
box-shadow
:
1px
0
3px
rgba
(
0
,
0
,
0
,
.15
);
width
:
100%
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1000
}
#top
>
a
{
background
:
#1fb5ad
;
float
:
left
;
width
:
240px
;
height
:
50px
;
position
:
relative
;
color
:
#f7f7f7
;
text-align
:
center
;
text-decoration
:
none
;
font-size
:
20px
;
line-height
:
50px
}
#top
>
.right
a
{
color
:
#555
;
line-height
:
50px
;
margin
:
0
10px
;
border
:
1px
solid
#f6f6f6
;
background-color
:
#f6f6f6
;
border-radius
:
100px
;
padding
:
10px
;
text-decoration
:
none
}
#top
>
.right
a
:hover
{
color
:
#333
}
#tabs
{
height
:
100%
;
min-height
:
468px
;
width
:
240px
;
margin-top
:
50px
;
position
:
fixed
;
top
:
0
;
background-color
:
#32323a
;
overflow
:
auto
}
#tabs
ul
{
list-style
:
none
}
#tabs
li
{
margin-left
:
0
;
border-bottom
:
1px
solid
rgba
(
255
,
255
,
255
,
0.05
)}
#tabs
li
>
div
>
a
,
#tabs
#tabToolsTitle
,
#tabs
#tabArticleTitle
{
color
:
#aeb2b7
;
display
:
block
;
text-decoration
:
none
;
letter-spacing
:
1px
;
padding
:
18px
0
18px
25px
;
line-height
:
18px
;
height
:
18px
;
transition
:
all
.3s
ease
}
#tabs
a
:hover
,
#tabs
a
.tab-current
,
#tabs
#tabToolsTitle
.tab-current
,
#tabs
#tabArticleTitle
.tab-current
,
#tabs
#tabToolsTitle
:hover
,
#tabs
#tabArticleTitle
:hover
{
background-color
:
#28282e
;
color
:
#1fb5ad
}
#tabs
li
li
{
border-bottom
:
0
}
#tabs
li
li
>
div
>
a
{
padding
:
13px
0
13px
46px
;
line-height
:
15px
;
height
:
15px
;
background-color
:
#28282e
}
#tabs
li
li
>
div
>
a
:hover
,
#tabs
li
li
>
div
>
a
.tab-current
{
background-color
:
#202025
}
#tabs
.commentIcon
,
#tabs
.postIcon
,
#tabs
.preferenceIcon
,
#tabs
.usersIcon
,
#tabs
.aboutIcon
{
display
:
none
}
.sub-tabs
{
background-color
:
#e0e1e7
;
border-radius
:
4px
4px
0
0
;
overflow
:
hidden
}
.sub-tabs
ul
{
float
:
left
;
list-style
:
none
outside
none
;
margin-right
:
24px
}
.sub-tabs
li
{
float
:
left
;
margin
:
0
}
.sub-tabs
li
a
{
border-right
:
1px
solid
#e0e1e7
;
color
:
#898989
;
display
:
block
;
line-height
:
18px
;
padding
:
20px
15px
;
text-decoration
:
none
}
.sub-tabs
.tab-current
,
.sub-tabs
.tab-current
:hover
,
.sub-tabs
a
:hover
{
background-color
:
#fff
;
color
:
#1fb5ad
}
.sub-tabs-main
{
background-color
:
#fff
;
padding
:
15px
;
border-radius
:
0
0
4px
4px
}
.form
>
div
{
margin
:
15px
0
}
.form
label
{
margin-bottom
:
10px
;
display
:
inline-block
}
.form
input
[
type
=
'text'
],
.form
input
[
type
=
'password'
],
.form
textarea
{
font-size
:
14px
;
outline
:
medium
none
;
width
:
100%
;
padding
:
6px
12px
;
height
:
34px
;
box-sizing
:
border-box
;
border
:
1px
solid
#e2e2e4
;
color
:
#333
;
border-radius
:
4px
;
transition
:
border-color
ease-in-out
.15s
,
box-shadow
ease-in-out
.15s
}
.form
textarea
{
height
:
auto
}
.form
input
[
type
=
'text'
]
:focus
,
.form
input
[
type
=
'password'
]
:focus
,
.form
textarea
:focus
{
box-shadow
:
none
;
border-color
:
#1fb5ad
}
.form
button
,
.completed-ck
span
{
padding
:
6px
12px
;
margin-bottom
:
0
;
font-size
:
14px
;
font-weight
:
400
;
text-align
:
center
;
white-space
:
nowrap
;
vertical-align
:
middle
;
cursor
:
pointer
;
user-select
:
none
;
background-image
:
none
;
border
:
1px
solid
#1fb5ad
;
border-radius
:
4px
;
background-color
:
#1fb5ad
;
color
:
#fff
;
height
:
auto
;
outline
:
0
}
.form
button
:hover
{
background-color
:
#1ca59e
;
border-color
:
#1ca59e
}
.module-panel
{
border-radius
:
4px
;
background-color
:
#fff
;
margin-bottom
:
20px
;
min-height
:
160px
}
.module-header
{
background
:
#fafafa
;
padding
:
15px
;
border-bottom
:
1px
solid
#eff2f7
;
border-top-left-radius
:
3px
;
border-top-right-radius
:
3px
}
.module-header
h2
{
font-size
:
13px
;
font-weight
:
400
}
.module-header
a
{
color
:
#767676
;
text-decoration
:
none
}
.module-header
a
:hover
{
color
:
#1fb5ad
}
.module-panel
.module-body
{
padding
:
15px
}
.module-panel
.module-body
li
{
padding
:
10px
;
line-height
:
18px
;
border-bottom
:
1px
solid
#ddd
}
.module-panel
.module-body
li
:hover
{
background-color
:
#f5f5f5
}
.module-panel
.module-body
li
a
:hover
{
text-decoration
:
none
}
.comment-title
{
background-color
:
#ececec
;
border-bottom
:
1px
solid
#dfdfdf
;
border-top
:
1px
solid
#f9f9f9
;
padding
:
3px
6px
3px
12px
}
#comments
{
height
:
462px
;
overflow
:
auto
}
button
#submitArticle
,
#unSubmitArticle
{
background-color
:
#fa8564
;
border-color
:
#fa8564
}
button
#submitArticle
:hover
,
#unSubmitArticle
:hover
{
background-color
:
#ec6459
;
border-color
:
#ec6459
}
.CodeMirror
{
border-radius
:
0
0
3px
3px
;
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,
0.075
)
inset
;
border
:
1px
solid
#ccc
;
margin-bottom
:
20px
;
border-top-width
:
0
;
height
:
470px
}
.comment-content
.CodeMirror
{
height
:
170px
}
#skinsPanel
{
min-width
:
328px
;
width
:
99%
}
.skinPreview
{
cursor
:
pointer
;
height
:
160px
;
margin
:
6px
;
width
:
280px
}
.skinItem
{
background-color
:
#fafafa
;
border-radius
:
3px
;
box-shadow
:
1px
1px
3px
#333
;
line-height
:
16px
;
margin
:
24px
12px
;
padding
:
5px
;
text-align
:
center
}
#skinMain
.skinItem.selected
{
background-color
:
#1fb5ad
}
.skinItem
:hover
{
background-color
:
#EEE
}
.f-blue
,
.error-msg
{
color
:
#36c
}
.signs
button
{
margin
:
0
12px
}
#keyOfSolo
{
width
:
200px
}
.small-head
{
float
:
left
;
height
:
35px
;
margin
:
3px
9px
0
3px
;
width
:
35px
}
#commentTable
.table-main
td
{
vertical-align
:
top
}
.about-logo
{
float
:
left
;
margin
:
62px
36px
62px
24px
}
.about-margin
{
font-size
:
20px
;
margin
:
20px
0
}
.ico-alipay-me
{
background-image
:
url("../images/alipay-me.png")
;
font-size
:
20px
;
height
:
24px
;
margin
:
20px
0
;
width
:
126px
}
.completed-input
{
margin
:
2px
12px
0
0
}
.completed-panel
{
background-color
:
#ececec
;
border
:
1px
solid
#ccc
;
color
:
#00c
;
display
:
none
;
overflow
:
auto
;
padding
:
2px
;
position
:
absolute
;
z-index
:
10
}
.completed-panel
a
{
display
:
block
;
text-decoration
:
none
}
.completed-panel
a
.selected
{
background-color
:
#fff
;
color
:
#d54121
}
.completed-ck
{
margin-top
:
9px
}
.completed-ck
span
{
margin
:
5px
10px
5px
0
;
display
:
inline-block
;
background-color
:
#c7cbd6
;
border-color
:
#c7cbd6
}
.completed-ck
span
:hover
{
background-color
:
#b0b5b9
;
border-color
:
#b0b5b9
}
.completed-ck
span
.selected
{
color
:
#d54121
;
background
:
url(../images/bowknot/completed.png)
no-repeat
right
bottom
}
.dialog-background
{
background-color
:
#000
;
display
:
none
;
filter
:
alpha
(
opacity
=
30
);
height
:
100%
;
left
:
0
;
opacity
:
.3
;
position
:
absolute
;
top
:
0
;
width
:
100%
;
z-index
:
90
}
.dialog-panel
{
display
:
none
;
position
:
absolute
;
z-index
:
100
}
.dialog-title
{
color
:
#fff
;
float
:
left
;
font-size
:
12px
;
line-height
:
27px
;
margin-left
:
3px
}
.dialog-header-bg
{
background
:
url("../images/icon.png")
repeat
scroll
center
bottom
#f1f1f1
;
border-color
:
#c0c0c0
#D9D9D9
#d9d9d9
;
border-radius
:
6px
6px
0
0
;
border-style
:
solid
;
border-width
:
1px
1px
0
;
cursor
:
move
;
height
:
34px
}
.dialog-close-icon
{
background
:
url("../images/bowknot/dialog-close.png")
no-repeat
scroll
0
0
transparent
;
cursor
:
pointer
;
float
:
right
;
height
:
18px
;
margin-top
:
6px
;
padding
:
3px
;
width
:
22px
}
.dialog-close-icon
:hover
{
background-image
:
url("../images/bowknot/dialog-close-hover.png")
}
.dialog-main
{
background-color
:
#fff
;
border
:
2px
solid
#666
;
border-color
:
#c0c0c0
#D9D9D9
#d9d9d9
;
border-top-width
:
0
;
padding
:
12px
}
.paginate-paginate
div
.button.paginate-page
,
.paginate-paginate
a
,
.paginate-pageCount
,
.pagination-pages
{
border
:
1px
solid
#eff2f7
;
padding
:
6px
12px
;
cursor
:
pointer
;
float
:
left
;
line-height
:
18px
;
background
:
#eee
;
height
:
18px
;
margin-left
:
1px
;
border-radius
:
0
;
text-decoration
:
none
;
color
:
#333
}
.pagination-current-page
,
.paginate-pageCount
{
cursor
:
auto
}
.paginate-pageCount
{
margin-left
:
10px
}
.pagination-current-page
,
.paginate-paginate
a
:hover
,
.paginate-paginate
div
.button.paginate-page
:hover
,
.pagination-pages
:hover
{
border-color
:
#2eb4ad
;
background-color
:
#2eb4ad
;
color
:
#FFF
}
.paginate-paginate
div
.button
{
padding
:
0
;
float
:
left
;
border
:
0
;
background
:
0
}
.paginate-inputPage
{
height
:
26px
;
width
:
24px
;
margin
:
0
5px
}
.table-main
{
margin
:
0
;
padding
:
0
;
position
:
relative
}
.table-main
table
{
word-break
:
break-all
;
word-wrap
:
break-word
}
.table-header
{
border-bottom
:
1px
solid
#ddd
;
background-color
:
#fafafa
;
padding
:
15px
0
}
.table-header
th
{
line-height
:
18px
;
text-align
:
left
;
text-indent
:
6px
;
font-weight
:
normal
}
.table-main
td
{
border-bottom
:
1px
solid
#ddd
;
color
:
#767676
;
padding
:
10px
0
}
.table-lineHover
.table-hasExpend
td
{
border-bottom
:
0
}
.table-heiglight
td
,
.table-lineHover
td
{
background-color
:
#f5f5f5
;
border-right-color
:
#f5f5f5
}
.table-expendRow
td
{
padding
:
0
0
5px
36px
}
.table-expendRow
td
span
{
margin-left
:
60px
}
.table-expendRow
td
a
{
padding
:
1px
5px
;
font-size
:
12px
;
line-height
:
1.5
;
border-radius
:
3px
;
text-decoration
:
none
;
color
:
#FFF
;
background-color
:
#c7cbd6
;
border-color
:
#c7cbd6
}
.table-expendRow
td
a
:hover
{
background-color
:
#b0b5b9
;
border-color
:
#b0b5b9
}
.table-center
{
margin
:
0
auto
}
.table-upIcon
,
.table-downIcon
{
background-image
:
url("../images/icon.png")
;
cursor
:
pointer
;
float
:
left
;
height
:
16px
;
width
:
16px
;
background-position
:
-81px
-32px
}
.table-upIcon
{
background-position
:
-64px
-32px
;
margin-right
:
6px
}
.table-tag
{
color
:
#d54121
;
font-size
:
12px
;
font-style
:
italic
;
margin-left
:
10px
}
.tip-panel
{
background-color
:
#FFF
;
box-shadow
:
0
3px
10px
#8b8b8b
;
display
:
none
;
max-height
:
500px
;
max-width
:
500px
;
overflow
:
hidden
;
padding
:
3px
;
position
:
absolute
;
z-index
:
1
}
\ No newline at end of file
body
,
input
,
textarea
{
font-family
:
"Helvetica Neue"
,
"Luxi Sans"
,
"DejaVu Sans"
,
Tahoma
,
"Hiragino Sans GB"
,
"Microsoft Yahei"
,
sans-serif
}
html
,
body
{
min-width
:
1024px
;
color
:
#767676
;
background
:
#f1f2f7
;
font-size
:
13px
}
a
{
color
:
#4183c4
;
text-decoration
:
none
}
a
:visited
{
color
:
#7ba9d6
}
a
:active
{
color
:
#2c5d8d
}
a
:hover
{
text-decoration
:
underline
}
button
.selected
{
background
:
url("../images/bowknot/completed.png")
no-repeat
scroll
right
bottom
transparent
!important
;
color
:
#d54121
!important
;
border-color
:
#b0b5b9
!important
}
@font-face
{
font-family
:
'icomoon'
;
src
:
url('fonts/icomoon.eot?1450')
;
src
:
url('fonts/icomoon.eot?#iefix')
format
(
'embedded-opentype'
),
url('fonts/icomoon.ttf?1450')
format
(
'truetype'
),
url('fonts/icomoon.woff?1450')
format
(
'woff'
),
url('fonts/icomoon.svg#icomoon')
format
(
'svg'
);
font-weight
:
normal
;
font-style
:
normal
}
.content-reset
{
font-family
:
"Helvetica Neue"
,
"Luxi Sans"
,
"DejaVu Sans"
,
Tahoma
,
"Hiragino Sans GB"
,
"Microsoft Yahei"
,
sans-serif
;
word-wrap
:
break-word
;
overflow
:
hidden
;
line-height
:
1.5
}
.content-reset
ul
,
.content-reset
ol
{
padding-left
:
2em
;
margin-top
:
0
;
margin-bottom
:
16px
}
.content-reset
h1
,
.content-reset
h2
,
.content-reset
h3
,
.content-reset
h4
,
.content-reset
h5
,
.content-reset
h6
{
margin-top
:
24px
;
margin-bottom
:
16px
;
font-weight
:
600
;
line-height
:
1.25
}
.content-reset
h1
{
padding-bottom
:
.3em
;
font-size
:
2em
}
.content-reset
h2
{
padding-bottom
:
.3em
;
font-size
:
1.5em
}
.content-reset
h3
{
font-size
:
1.25em
}
.content-reset
h4
{
font-size
:
1em
}
.content-reset
h5
{
font-size
:
.875em
}
.content-reset
h6
{
font-size
:
.85em
}
.content-reset
p
{
margin-top
:
0
;
margin-bottom
:
16px
}
.content-reset
blockquote
{
padding
:
0
1em
;
color
:
#777
;
border-left
:
.25em
solid
#ddd
;
margin-bottom
:
16px
}
.content-reset
blockquote
p
{
margin
:
0
}
.content-reset
iframe
{
border
:
1px
solid
#ccc
}
.content-reset
table
{
width
:
100%
;
border
:
1px
solid
#dedede
;
margin
:
15px
auto
;
border-collapse
:
collapse
;
empty-cells
:
show
}
.content-reset
thead
{
text-align
:
center
}
.content-reset
td
,
.content-reset
th
{
height
:
35px
;
border
:
1px
solid
#dedede
;
padding
:
0
10px
}
.content-reset
th
{
font-weight
:
bold
;
text-align
:
center
!important
;
background
:
rgba
(
158
,
188
,
226
,
0.2
)}
.content-reset
tbody
tr
:nth-child
(
2n
)
{
background
:
rgba
(
158
,
188
,
226
,
0.12
)}
.content-reset
tr
:hover
{
background
:
#efefef
}
.content-reset
code
{
padding
:
.2em
.4em
;
margin
:
0
;
font-size
:
85%
;
background-color
:
rgba
(
252
,
41
,
41
,
0.12
);
border-radius
:
3px
;
color
:
#d23f31
;
font-family
:
mononoki
,
Consolas
,
"Liberation Mono"
,
Menlo
,
Courier
,
monospace
}
.content-reset
pre
>
code
{
padding
:
.5em
;
border-radius
:
0
;
color
:
#333
;
background-color
:
rgba
(
0
,
0
,
0
,
0.04
);
background-image
:
url(../images/code-bg.png)
;
background-size
:
20px
20px
;
border-radius
:
5px
}
.content-reset
kbd
{
display
:
inline-block
;
padding
:
3px
5px
;
font
:
11px
Consolas
,
"Liberation Mono"
,
Menlo
,
Courier
,
monospace
;
line-height
:
10px
;
color
:
#555
;
vertical-align
:
middle
;
background-color
:
#fcfcfc
;
border
:
solid
1px
#ccc
;
border-bottom-color
:
#bbb
;
border-radius
:
3px
;
box-shadow
:
inset
0
-1px
0
#bbb
}
[
class
^=
"icon-"
],[
class
*=
" icon-"
]
{
font-family
:
'icomoon'
;
speak
:
none
;
font-style
:
normal
;
font-weight
:
normal
;
font-variant
:
normal
;
text-transform
:
none
;
line-height
:
1
;
-webkit-font-smoothing
:
antialiased
;
-moz-osx-font-smoothing
:
grayscale
}
a
[
class
^=
"icon-"
],
a
[
class
*=
" icon-"
]
{
color
:
#333
}
a
[
class
^=
"icon-"
]
:hover
,
a
[
class
*=
" icon-"
]
:hover
{
text-decoration
:
none
;
color
:
#4183c4
}
.icon-upload
:before
{
content
:
"\f0ee"
}
.icon-copy
:before
{
content
:
"\e908"
}
.icon-time
:before
{
content
:
"\e906"
}
.icon-sortasc
:before
{
content
:
"\e905"
}
.icon-locked
:before
{
content
:
"\e61e"
}
.icon-close
:before
{
content
:
"\e909"
}
.icon-points
:before
{
content
:
"\e900"
}
.icon-goods
:before
{
content
:
"\e904"
}
.icon-bold
:before
{
content
:
"\e000"
}
.icon-italic
:before
{
content
:
"\e001"
}
.icon-quote
:before
{
content
:
"\e003"
}
.icon-unordered-list
:before
{
content
:
"\e004"
}
.icon-ordered-list
:before
{
content
:
"\e005"
}
.icon-link
:before
{
content
:
"\e006"
}
.icon-image
:before
{
content
:
"\e007"
}
.icon-play
:before
{
content
:
"\e008"
}
.icon-music
:before
{
content
:
"\e009"
}
.icon-contract
:before
{
content
:
"\e00a"
}
.icon-fullscreen
:before
{
content
:
"\e00b"
}
.icon-question
:before
{
content
:
"\e00c"
}
.icon-info
:before
{
content
:
"\e00d"
}
.icon-undo
:before
{
content
:
"\e00e"
}
.icon-redo
:before
{
content
:
"\e00f"
}
.icon-code
:before
{
content
:
"\e011"
}
.icon-preview
:before
{
content
:
"\e002"
}
.icon-navigation
:before
{
content
:
"\e903"
}
.icon-thumbs-down
:before
{
content
:
"\e901"
}
.icon-thumbs-up
:before
{
content
:
"\e902"
}
.icon-video
:before
{
content
:
"\f057"
}
.icon-feed
:before
{
content
:
"\e61f"
}
.icon-article
:before
{
content
:
"\e61d"
}
.icon-star
:before
{
content
:
"\e600"
}
.icon-register
:before
{
content
:
"\e602"
}
.icon-logout
:before
{
content
:
"\e603"
}
.icon-setting
:before
{
content
:
"\e604"
}
.icon-google
:before
{
content
:
"\e605"
}
.icon-search
:before
{
content
:
"\e606"
}
.icon-weibo
:before
{
content
:
"\e607"
}
.icon-date
:before
{
content
:
"\e608"
}
.icon-view
:before
{
content
:
"\e609"
}
.icon-cmts
:before
{
content
:
"\e60a"
}
.icon-refresh
:before
{
content
:
"\e60b"
}
.icon-up
:before
{
content
:
"\e60c"
}
.icon-twitter
:before
{
content
:
"\e60d"
}
.icon-edit
:before
{
content
:
"\e60e"
}
.icon-tencent
:before
{
content
:
"\e60f"
}
.icon-tag
:before
{
content
:
"\e610"
}
.icon-tags
:before
{
content
:
"\e611"
}
.icon-addfile
:before
{
content
:
"\e612"
}
.icon-login
:before
{
content
:
"\e613"
}
.icon-articles
:before
{
content
:
"\e614"
}
.icon-userrole
:before
{
content
:
"\e615"
}
.icon-email
:before
{
content
:
"\e616"
}
.icon-flag
:before
{
content
:
"\e617"
}
.icon-chevron-down
:before
{
content
:
"\e618"
;
margin-right
:
10px
}
.icon-chevron-up
:before
{
content
:
"\e619"
;
margin-right
:
10px
}
.icon-reply
:before
{
content
:
"\e61a"
}
.icon-clock
:before
{
content
:
"\e61b"
}
.icon-compass
:before
{
content
:
"\e61c"
}
.icon-heart
:before
{
content
:
"\e9da"
}
.icon-wechat
:before
{
content
:
"\e907"
}
.aboutIcon
{
background-position
:
-16px
-48px
}
#allPanel
{
height
:
auto
;
min-height
:
100%
;
position
:
relative
}
#tabsPanel
{
margin
:
50px
0
0
240px
;
padding
:
15px
}
#tabsPanel
>
div
{
padding-bottom
:
36px
}
#tabsPanel_article-list
,
#tabsPanel_draft-list
,
#tabsPanel_comment-list
,
#tabsPanel_plugin-list
,
#tabsPanel_page-list
>
div
:first-child
,
#tabsPanel_user-list
>
div
:first-child
,
#tabsPanel_link-list
>
div
:first-child
{
background-color
:
#FFF
;
border-radius
:
4px
;
margin-bottom
:
40px
;
overflow
:
hidden
}
.tip
{
font-weight
:
bold
;
margin
:
0
auto
;
overflow
:
hidden
;
padding
:
2px
0
;
position
:
fixed
;
text-align
:
center
;
top
:
3px
;
left
:
255px
;
z-index
:
1001
}
#tipMsg
,
#loadMsg
{
color
:
#31708f
;
background-color
:
#d9edf7
;
border-radius
:
4px
;
line-height
:
40px
;
display
:
inline-block
}
.footer
{
bottom
:
12px
;
position
:
absolute
;
text-align
:
center
;
width
:
100%
;
padding-left
:
240px
;
box-sizing
:
border-box
}
#top
{
height
:
50px
;
position
:
fixed
;
box-shadow
:
1px
0
3px
rgba
(
0
,
0
,
0
,
.15
);
width
:
100%
;
top
:
0
;
background-color
:
#fff
;
z-index
:
80
}
#top
>
a
{
background
:
#1fb5ad
;
float
:
left
;
width
:
240px
;
height
:
50px
;
position
:
relative
;
color
:
#f7f7f7
;
text-align
:
center
;
text-decoration
:
none
;
font-size
:
20px
;
line-height
:
50px
}
#top
>
.right
a
{
color
:
#555
;
line-height
:
50px
;
margin
:
0
10px
;
border
:
1px
solid
#f6f6f6
;
background-color
:
#f6f6f6
;
border-radius
:
100px
;
padding
:
10px
;
text-decoration
:
none
}
#top
>
.right
a
:hover
{
color
:
#333
}
#tabs
{
height
:
100%
;
min-height
:
468px
;
width
:
240px
;
margin-top
:
50px
;
position
:
fixed
;
top
:
0
;
background-color
:
#32323a
;
overflow
:
auto
}
#tabs
ul
{
list-style
:
none
}
#tabs
li
{
margin-left
:
0
;
border-bottom
:
1px
solid
rgba
(
255
,
255
,
255
,
0.05
)}
#tabs
li
>
div
>
a
,
#tabs
#tabToolsTitle
,
#tabs
#tabArticleTitle
{
color
:
#aeb2b7
;
display
:
block
;
text-decoration
:
none
;
letter-spacing
:
1px
;
padding
:
18px
0
18px
25px
;
line-height
:
18px
;
height
:
18px
;
transition
:
all
.3s
ease
}
#tabs
a
:hover
,
#tabs
a
.tab-current
,
#tabs
#tabToolsTitle
.tab-current
,
#tabs
#tabArticleTitle
.tab-current
,
#tabs
#tabToolsTitle
:hover
,
#tabs
#tabArticleTitle
:hover
{
background-color
:
#28282e
;
color
:
#1fb5ad
}
#tabs
li
li
{
border-bottom
:
0
}
#tabs
li
li
>
div
>
a
{
padding
:
13px
0
13px
46px
;
line-height
:
15px
;
height
:
15px
;
background-color
:
#28282e
}
#tabs
li
li
>
div
>
a
:hover
,
#tabs
li
li
>
div
>
a
.tab-current
{
background-color
:
#202025
}
#tabs
.commentIcon
,
#tabs
.postIcon
,
#tabs
.preferenceIcon
,
#tabs
.usersIcon
,
#tabs
.aboutIcon
{
display
:
none
}
.sub-tabs
{
background-color
:
#e0e1e7
;
border-radius
:
4px
4px
0
0
;
overflow
:
hidden
}
.sub-tabs
ul
{
float
:
left
;
list-style
:
none
outside
none
;
margin-right
:
24px
}
.sub-tabs
li
{
float
:
left
;
margin
:
0
}
.sub-tabs
li
a
{
border-right
:
1px
solid
#e0e1e7
;
color
:
#898989
;
display
:
block
;
line-height
:
18px
;
padding
:
20px
15px
;
text-decoration
:
none
}
.sub-tabs
.tab-current
,
.sub-tabs
.tab-current
:hover
,
.sub-tabs
a
:hover
{
background-color
:
#fff
;
color
:
#1fb5ad
}
.sub-tabs-main
{
background-color
:
#fff
;
padding
:
15px
;
border-radius
:
0
0
4px
4px
}
.form
>
div
{
margin
:
15px
0
}
.form
label
{
margin-bottom
:
10px
;
display
:
inline-block
}
.form
input
[
type
=
'text'
],
.form
input
[
type
=
'password'
],
.form
textarea
{
font-size
:
14px
;
outline
:
medium
none
;
width
:
100%
;
padding
:
6px
12px
;
height
:
34px
;
box-sizing
:
border-box
;
border
:
1px
solid
#e2e2e4
;
color
:
#333
;
border-radius
:
4px
;
transition
:
border-color
ease-in-out
.15s
,
box-shadow
ease-in-out
.15s
}
.form
textarea
{
height
:
auto
}
.form
input
[
type
=
'text'
]
:focus
,
.form
input
[
type
=
'password'
]
:focus
,
.form
textarea
:focus
{
box-shadow
:
none
;
border-color
:
#1fb5ad
}
.form
button
,
.completed-ck
span
{
padding
:
6px
12px
;
margin-bottom
:
0
;
font-size
:
14px
;
font-weight
:
400
;
text-align
:
center
;
white-space
:
nowrap
;
vertical-align
:
middle
;
cursor
:
pointer
;
user-select
:
none
;
background-image
:
none
;
border
:
1px
solid
#1fb5ad
;
border-radius
:
4px
;
background-color
:
#1fb5ad
;
color
:
#fff
;
height
:
auto
;
outline
:
0
}
.form
button
:hover
{
background-color
:
#1ca59e
;
border-color
:
#1ca59e
}
.module-panel
{
border-radius
:
4px
;
background-color
:
#fff
;
margin-bottom
:
20px
;
min-height
:
160px
}
.module-header
{
background
:
#fafafa
;
padding
:
15px
;
border-bottom
:
1px
solid
#eff2f7
;
border-top-left-radius
:
3px
;
border-top-right-radius
:
3px
}
.module-header
h2
{
font-size
:
13px
;
font-weight
:
400
}
.module-header
a
{
color
:
#767676
;
text-decoration
:
none
}
.module-header
a
:hover
{
color
:
#1fb5ad
}
.module-panel
.module-body
{
padding
:
15px
}
.module-panel
.module-body
li
{
padding
:
10px
;
line-height
:
18px
;
border-bottom
:
1px
solid
#ddd
}
.module-panel
.module-body
li
:hover
{
background-color
:
#f5f5f5
}
.module-panel
.module-body
li
a
:hover
{
text-decoration
:
none
}
.comment-title
{
background-color
:
#ececec
;
border-bottom
:
1px
solid
#dfdfdf
;
border-top
:
1px
solid
#f9f9f9
;
padding
:
3px
6px
3px
12px
}
#comments
{
height
:
462px
;
overflow
:
auto
}
button
#submitArticle
,
#unSubmitArticle
{
background-color
:
#fa8564
;
border-color
:
#fa8564
}
button
#submitArticle
:hover
,
#unSubmitArticle
:hover
{
background-color
:
#ec6459
;
border-color
:
#ec6459
}
.CodeMirror
{
border-radius
:
0
0
3px
3px
;
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,
0.075
)
inset
;
border
:
1px
solid
#ccc
;
margin-bottom
:
20px
;
border-top-width
:
0
;
height
:
470px
}
.comment-content
.CodeMirror
{
height
:
170px
}
#skinsPanel
{
min-width
:
328px
;
width
:
99%
}
.skinPreview
{
cursor
:
pointer
;
height
:
160px
;
margin
:
6px
;
width
:
280px
}
.skinItem
{
background-color
:
#fafafa
;
border-radius
:
3px
;
box-shadow
:
1px
1px
3px
#333
;
line-height
:
16px
;
margin
:
24px
12px
;
padding
:
5px
;
text-align
:
center
}
#skinMain
.skinItem.selected
{
background-color
:
#1fb5ad
}
.skinItem
:hover
{
background-color
:
#EEE
}
.f-blue
,
.error-msg
{
color
:
#36c
}
.signs
button
{
margin
:
0
12px
}
#keyOfSolo
{
width
:
200px
}
.small-head
{
float
:
left
;
height
:
35px
;
margin
:
3px
9px
0
3px
;
width
:
35px
}
#commentTable
.table-main
td
{
vertical-align
:
top
}
.about-logo
{
float
:
left
;
margin
:
62px
36px
62px
24px
}
.about-margin
{
font-size
:
20px
;
margin
:
20px
0
}
.ico-alipay-me
{
background-image
:
url("../images/alipay-me.png")
;
font-size
:
20px
;
height
:
24px
;
margin
:
20px
0
;
width
:
126px
}
.completed-input
{
margin
:
2px
12px
0
0
}
.completed-panel
{
background-color
:
#ececec
;
border
:
1px
solid
#ccc
;
color
:
#00c
;
display
:
none
;
overflow
:
auto
;
padding
:
2px
;
position
:
absolute
;
z-index
:
10
}
.completed-panel
a
{
display
:
block
;
text-decoration
:
none
}
.completed-panel
a
.selected
{
background-color
:
#fff
;
color
:
#d54121
}
.completed-ck
{
margin-top
:
9px
}
.completed-ck
span
{
margin
:
5px
10px
5px
0
;
display
:
inline-block
;
background-color
:
#c7cbd6
;
border-color
:
#c7cbd6
}
.completed-ck
span
:hover
{
background-color
:
#b0b5b9
;
border-color
:
#b0b5b9
}
.completed-ck
span
.selected
{
color
:
#d54121
;
background
:
url(../images/bowknot/completed.png)
no-repeat
right
bottom
}
.dialog-background
{
background-color
:
#000
;
display
:
none
;
filter
:
alpha
(
opacity
=
30
);
height
:
100%
;
left
:
0
;
opacity
:
.3
;
position
:
absolute
;
top
:
0
;
width
:
100%
;
z-index
:
90
}
.dialog-panel
{
display
:
none
;
position
:
absolute
;
z-index
:
100
}
.dialog-title
{
color
:
#fff
;
float
:
left
;
font-size
:
12px
;
line-height
:
27px
;
margin-left
:
3px
}
.dialog-header-bg
{
background
:
url("../images/icon.png")
repeat
scroll
center
bottom
#f1f1f1
;
border-color
:
#c0c0c0
#D9D9D9
#d9d9d9
;
border-radius
:
6px
6px
0
0
;
border-style
:
solid
;
border-width
:
1px
1px
0
;
cursor
:
move
;
height
:
34px
}
.dialog-close-icon
{
background
:
url("../images/bowknot/dialog-close.png")
no-repeat
scroll
0
0
transparent
;
cursor
:
pointer
;
float
:
right
;
height
:
18px
;
margin-top
:
6px
;
padding
:
3px
;
width
:
22px
}
.dialog-close-icon
:hover
{
background-image
:
url("../images/bowknot/dialog-close-hover.png")
}
.dialog-main
{
background-color
:
#fff
;
border
:
2px
solid
#666
;
border-color
:
#c0c0c0
#D9D9D9
#d9d9d9
;
border-top-width
:
0
;
padding
:
12px
}
.paginate-paginate
div
.button.paginate-page
,
.paginate-paginate
a
,
.paginate-pageCount
,
.pagination-pages
{
border
:
1px
solid
#eff2f7
;
padding
:
6px
12px
;
cursor
:
pointer
;
float
:
left
;
line-height
:
18px
;
background
:
#eee
;
height
:
18px
;
margin-left
:
1px
;
border-radius
:
0
;
text-decoration
:
none
;
color
:
#333
}
.pagination-current-page
,
.paginate-pageCount
{
cursor
:
auto
}
.paginate-pageCount
{
margin-left
:
10px
}
.pagination-current-page
,
.paginate-paginate
a
:hover
,
.paginate-paginate
div
.button.paginate-page
:hover
,
.pagination-pages
:hover
{
border-color
:
#2eb4ad
;
background-color
:
#2eb4ad
;
color
:
#FFF
}
.paginate-paginate
div
.button
{
padding
:
0
;
float
:
left
;
border
:
0
;
background
:
0
}
.paginate-inputPage
{
height
:
26px
;
width
:
24px
;
margin
:
0
5px
}
.table-main
{
margin
:
0
;
padding
:
0
;
position
:
relative
}
.table-main
table
{
word-break
:
break-all
;
word-wrap
:
break-word
}
.table-header
{
border-bottom
:
1px
solid
#ddd
;
background-color
:
#fafafa
;
padding
:
15px
0
}
.table-header
th
{
line-height
:
18px
;
text-align
:
left
;
text-indent
:
6px
;
font-weight
:
normal
}
.table-main
td
{
border-bottom
:
1px
solid
#ddd
;
color
:
#767676
;
padding
:
10px
0
}
.table-lineHover
.table-hasExpend
td
{
border-bottom
:
0
}
.table-heiglight
td
,
.table-lineHover
td
{
background-color
:
#f5f5f5
;
border-right-color
:
#f5f5f5
}
.table-expendRow
td
{
padding
:
0
0
5px
36px
}
.table-expendRow
td
span
{
margin-left
:
60px
}
.table-expendRow
td
a
{
padding
:
1px
5px
;
font-size
:
12px
;
line-height
:
1.5
;
border-radius
:
3px
;
text-decoration
:
none
;
color
:
#FFF
;
background-color
:
#c7cbd6
;
border-color
:
#c7cbd6
}
.table-expendRow
td
a
:hover
{
background-color
:
#b0b5b9
;
border-color
:
#b0b5b9
}
.table-center
{
margin
:
0
auto
}
.table-upIcon
,
.table-downIcon
{
background-image
:
url("../images/icon.png")
;
cursor
:
pointer
;
float
:
left
;
height
:
16px
;
width
:
16px
;
background-position
:
-81px
-32px
}
.table-upIcon
{
background-position
:
-64px
-32px
;
margin-right
:
6px
}
.table-tag
{
color
:
#d54121
;
font-size
:
12px
;
font-style
:
italic
;
margin-left
:
10px
}
.tip-panel
{
background-color
:
#FFF
;
box-shadow
:
0
3px
10px
#8b8b8b
;
display
:
none
;
max-height
:
500px
;
max-width
:
500px
;
overflow
:
hidden
;
padding
:
3px
;
position
:
absolute
;
z-index
:
1
}
\ No newline at end of file
src/main/webapp/js/admin/latkeAdmin.js
View file @
12f1479d
...
...
@@ -282,13 +282,13 @@ var admin = new Admin();/*
* @fileoverview editor
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.1.0.
4, May 30, 2015
* @version 1.1.0.
5, Nov 8, 2016
*/
admin
.
editors
=
{};
/*
* @description Create Editor can use all editor.
* @description Create
Solo
Editor can use all editor.
* e.g: TinyMCE, wnd
* @constructor
* @param conf 编辑器初始化参数
...
...
@@ -298,7 +298,7 @@ admin.editors = {};
* @param conf.type 编辑器种类
* @param conf.codeMirrorLanguage codeMirror 编辑器当前解析语言
*/
var
Editor
=
function
(
conf
)
{
var
Solo
Editor
=
function
(
conf
)
{
this
.
_defaults
=
{
type
:
"
tinyMCE
"
,
kind
:
""
,
...
...
@@ -310,7 +310,7 @@ var Editor = function (conf) {
this
.
_init
();
};
$
.
extend
(
Editor
.
prototype
,
{
$
.
extend
(
Solo
Editor
.
prototype
,
{
/*
* @description 初始化
*/
...
...
@@ -612,7 +612,7 @@ admin.editors.KindEditor = {
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
2.1.4, Aug 26
, 2016
* @version 1.
3.1.4, Nov 8
, 2016
*/
Util
.
processClipBoard
=
function
(
text
,
cm
)
{
...
...
@@ -623,6 +623,43 @@ Util.processClipBoard = function (text, cm) {
text
=
$
(
'
<div>
'
+
text
+
'
</div>
'
).
text
().
replace
(
/
\n{2,}
/g
,
'
\n\n
'
).
replace
(
/ /g
,
'
'
);
return
$
.
trim
(
text
);
};
/**
* @description 获取字符串开始位置
* @param {String} string 需要匹配的字符串
* @param {String} prefix 匹配字符
* @return {Integer} 以匹配字符开头的位置
*/
Util
.
startsWith
=
function
(
string
,
prefix
)
{
return
(
string
.
match
(
"
^
"
+
prefix
)
==
prefix
);
};
/**
* 粘贴中包含图片和文案时,需要处理为 markdown 语法
* @param {object} clipboardData
* @param {object} cm
* @returns {String}
*/
Util
.
processClipBoard
=
function
(
clipboardData
,
cm
)
{
if
(
clipboardData
.
getData
(
"
text/html
"
)
===
''
&&
clipboardData
.
items
.
length
===
2
)
{
return
''
;
}
var
text
=
toMarkdown
(
clipboardData
.
getData
(
"
text/html
"
),
{
converters
:
[
{
filter
:
'
img
'
,
replacement
:
function
(
innerHTML
,
node
)
{
if
(
1
===
node
.
attributes
.
length
)
{
return
""
;
}
return
"

"
;
}
}
],
gfm
:
true
});
// ascii 160 替换为 30
text
=
$
(
'
<div>
'
+
text
+
'
</div>
'
).
text
().
replace
(
/
\n{2,}
/g
,
'
\n\n
'
).
replace
(
/ /g
,
'
'
);
return
$
.
trim
(
text
);
};
admin
.
editors
.
CodeMirror
=
{
/*
* @description 初始化编辑器
...
...
@@ -635,33 +672,99 @@ admin.editors.CodeMirror = {
* @returns {obj} editor
*/
init
:
function
(
conf
)
{
var
emojis
=
"
+1,-1,100,1234,8ball,a,ab,abc,abcd,accept,aerial_tramway,airplane,alarm_clock,alien,ambulance,anchor,angel,anger,angry,anguished,ant,apple,aquarius,aries,arrow_backward,arrow_double_down,arrow_double_up,arrow_down,arrow_down_small,arrow_forward,arrow_heading_down,arrow_heading_up,arrow_left,arrow_lower_left,arrow_lower_right,arrow_right,arrow_right_hook,arrow_up,arrow_up_down,arrow_up_small,arrow_upper_left,arrow_upper_right,arrows_clockwise,arrows_counterclockwise,art,articulated_lorry,astonished,atm,b,baby,baby_bottle,baby_chick,baby_symbol,back,baggage_claim,balloon,ballot_box_with_check,bamboo,banana,bangbang,bank,bar_chart,barber,baseball,basketball,bath,bathtub,battery,bear,bee,beer,beers,beetle,beginner,bell,bento,bicyclist,bike,bikini,bird,birthday,black_circle,black_joker,black_medium_small_square,black_medium_square,black_nib,black_small_square,black_square,black_square_button,blossom,blowfish,blue_book,blue_car,blue_heart,blush,boar,boat,bomb,book,bookmark,bookmark_tabs,books,boom,boot,bouquet,bow,bowling,bowtie,boy,bread,bride_with_veil,bridge_at_night,briefcase,broken_heart,bug,bulb,bullettrain_front,bullettrain_side,bus,busstop,bust_in_silhouette,busts_in_silhouette,cactus,cake,calendar,calling,camel,camera,cancer,candy,capital_abcd,capricorn,car,card_index,carousel_horse,cat,cat2,cd,chart,chart_with_downwards_trend,chart_with_upwards_trend,checkered_flag,cherries,cherry_blossom,chestnut,chicken,children_crossing,chocolate_bar,christmas_tree,church,cinema,circus_tent,city_sunrise,city_sunset,cl,clap,clapper,clipboard,clock1,clock10,clock1030,clock11,clock1130,clock12,clock1230,clock130,clock2,clock230,clock3,clock330,clock4,clock430,clock5,clock530,clock6,clock630,clock7,clock730,clock8,clock830,clock9,clock930,closed_book,closed_lock_with_key,closed_umbrella,cloud,clubs,cn,cocktail,coffee,cold_sweat,collision,computer,confetti_ball,confounded,confused,congratulations,construction,construction_worker,convenience_store,cookie,cool,cop,copyright,corn,couple,couple_with_heart,couplekiss,cow,cow2,credit_card,crescent_moon,crocodile,crossed_flags,crown,cry,crying_cat_face,crystal_ball,cupid,curly_loop,currency_exchange,curry,custard,customs,cyclone,dancer,dancers,dango,dart,dash,date,de,deciduous_tree,department_store,diamond_shape_with_a_dot_inside,diamonds,disappointed,disappointed_relieved,dizzy,dizzy_face,do_not_litter,dog,dog2,dollar,dolls,dolphin,donut,door,doughnut,dragon,dragon_face,dress,dromedary_camel,droplet,dvd,e-mail,ear,ear_of_rice,earth_africa,earth_americas,earth_asia,egg,eggplant,eight,eight_pointed_black_star,eight_spoked_asterisk,electric_plug,elephant,email,end,envelope,es,euro,european_castle,european_post_office,evergreen_tree,exclamation,expressionless,eyeglasses,eyes,facepunch,factory,fallen_leaf,family,fast_forward,fax,fearful,feelsgood,feet,ferris_wheel,file_folder,finnadie,fire,fire_engine,fireworks,first_quarter_moon,first_quarter_moon_with_face,fish,fish_cake,fishing_pole_and_fish,fist,five,flags,flashlight,floppy_disk,flower_playing_cards,flushed,foggy,football,fork_and_knife,fountain,four,four_leaf_clover,fr,free,fried_shrimp,fries,frog,frowning,fu,fuelpump,full_moon,full_moon_with_face,game_die,gb,gem,gemini,ghost,gift,gift_heart,girl,globe_with_meridians,goat,goberserk,godmode,golf,grapes,green_apple,green_book,green_heart,grey_exclamation,grey_question,grimacing,grin,grinning,guardsman,guitar,gun,haircut,hamburger,hammer,hamster,hand,handbag,hankey,hash,hatched_chick,hatching_chick,headphones,hear_no_evil,heart,heart_decoration,heart_eyes,heart_eyes_cat,heartbeat,heartpulse,hearts,heavy_check_mark,heavy_division_sign,heavy_dollar_sign,heavy_exclamation_mark,heavy_minus_sign,heavy_multiplication_x,heavy_plus_sign,helicopter,herb,hibiscus,high_brightness,high_heel,hocho,honey_pot,honeybee,horse,horse_racing,hospital,hotel,hotsprings,hourglass,hourglass_flowing_sand,house,house_with_garden,hurtrealbad,hushed,ice_cream,icecream,id,ideograph_advantage,imp,inbox_tray,incoming_envelope,information_desk_person,information_source,innocent,interrobang,iphone,it,izakaya_lantern,jack_o_lantern,japan,japanese_castle,japanese_goblin,japanese_ogre,jeans,joy,joy_cat,jp,key,keycap_ten,kimono,kiss,kissing,kissing_cat,kissing_closed_eyes,kissing_face,kissing_heart,kissing_smiling_eyes,koala,koko,kr,large_blue_circle,large_blue_diamond,large_orange_diamond,last_quarter_moon,last_quarter_moon_with_face,laughing,leaves,ledger,left_luggage,left_right_arrow,leftwards_arrow_with_hook,lemon,leo,leopard,libra,light_rail,link,lips,lipstick,lock,lock_with_ink_pen,lollipop,loop,loudspeaker,love_hotel,love_letter,low_brightness,m,mag,mag_right,mahjong,mailbox,mailbox_closed,mailbox_with_mail,mailbox_with_no_mail,man,man_with_gua_pi_mao,man_with_turban,mans_shoe,maple_leaf,mask,massage,meat_on_bone,mega,melon,memo,mens,metal,metro,microphone,microscope,milky_way,minibus,minidisc,mobile_phone_off,money_with_wings,moneybag,monkey,monkey_face,monorail,mortar_board,mount_fuji,mountain_bicyclist,mountain_cableway,mountain_railway,mouse,mouse2,movie_camera,moyai,muscle,mushroom,musical_keyboard,musical_note,musical_score,mute,nail_care,name_badge,neckbeard,necktie,negative_squared_cross_mark,neutral_face,new,new_moon,new_moon_with_face,newspaper,ng,nine,no_bell,no_bicycles,no_entry,no_entry_sign,no_good,no_mobile_phones,no_mouth,no_pedestrians,no_smoking,non-potable_water,nose,notebook,notebook_with_decorative_cover,notes,nut_and_bolt,o,o2,ocean,octocat,octopus,oden,office,ok,ok_hand,ok_woman,older_man,older_woman,on,oncoming_automobile,oncoming_bus,oncoming_police_car,oncoming_taxi,one,open_file_folder,open_hands,open_mouth,ophiuchus,orange_book,outbox_tray,ox,package,page_facing_up,page_with_curl,pager,palm_tree,panda_face,paperclip,parking,part_alternation_mark,partly_sunny,passport_control,paw_prints,peach,pear,pencil,pencil2,penguin,pensive,performing_arts,persevere,person_frowning,person_with_blond_hair,person_with_pouting_face,phone,pig,pig2,pig_nose,pill,pineapple,pisces,pizza,plus1,point_down,point_left,point_right,point_up,point_up_2,police_car,poodle,poop,post_office,postal_horn,postbox,potable_water,pouch,poultry_leg,pound,pouting_cat,pray,princess,punch,purple_heart,purse,pushpin,put_litter_in_its_place,question,rabbit,rabbit2,racehorse,radio,radio_button,rage,rage1,rage2,rage3,rage4,railway_car,rainbow,raised_hand,raised_hands,raising_hand,ram,ramen,rat,recycle,red_car,red_circle,registered,relaxed,relieved,repeat,repeat_one,restroom,revolving_hearts,rewind,ribbon,rice,rice_ball,rice_cracker,rice_scene,ring,rocket,roller_coaster,rooster,rose,rotating_light,round_pushpin,rowboat,ru,rugby_football,runner,running,running_shirt_with_sash,sa,sagittarius,sailboat,sake,sandal,santa,satellite,satisfied,saxophone,school,school_satchel,scissors,scorpius,scream,scream_cat,scroll,seat,secret,see_no_evil,seedling,seven,shaved_ice,sheep,shell,ship,shipit,shirt,shit,shoe,shower,signal_strength,six,six_pointed_star,ski,skull,sleeping,sleepy,slot_machine,small_blue_diamond,small_orange_diamond,small_red_triangle,small_red_triangle_down,smile,smile_cat,smiley,smiley_cat,smiling_imp,smirk,smirk_cat,smoking,snail,snake,snowboarder,snowflake,snowman,sob,soccer,soon,sos,sound,space_invader,spades,spaghetti,sparkle,sparkler,sparkles,sparkling_heart,speak_no_evil,speaker,speech_balloon,speedboat,squirrel,star,star2,stars,station,statue_of_liberty,steam_locomotive,stew,straight_ruler,strawberry,stuck_out_tongue,stuck_out_tongue_closed_eyes,stuck_out_tongue_winking_eye,sun_with_face,sunflower,sunglasses,sunny,sunrise,sunrise_over_mountains,surfer,sushi,suspect,suspension_railway,sweat,sweat_drops,sweat_smile,sweet_potato,swimmer,symbols,syringe,tada,tanabata_tree,tangerine,taurus,taxi,tea,telephone,telephone_receiver,telescope,tennis,tent,thought_balloon,three,thumbsdown,thumbsup,ticket,tiger,tiger2,tired_face,tm,toilet,tokyo_tower,tomato,tongue,top,tophat,tractor,traffic_light,train,train2,tram,triangular_flag_on_post,triangular_ruler,trident,triumph,trolleybus,trollface,trophy,tropical_drink,tropical_fish,truck,trumpet,tshirt,tulip,turtle,tv,twisted_rightwards_arrows,two,two_hearts,two_men_holding_hands,two_women_holding_hands,u5272,u5408,u55b6,u6307,u6708,u6709,u6e80,u7121,u7533,u7981,u7a7a,uk,umbrella,unamused,underage,unlock,up,us,v,vertical_traffic_light,vhs,vibration_mode,video_camera,video_game,violin,virgo,volcano,vs,walking,waning_crescent_moon,waning_gibbous_moon,warning,watch,water_buffalo,watermelon,wave,wavy_dash,waxing_crescent_moon,waxing_gibbous_moon,wc,weary,wedding,whale,whale2,wheelchair,white_check_mark,white_circle,white_flower,white_large_square,white_medium_small_square,white_medium_square,white_small_square,white_square_button,wind_chime,wine_glass,wink,wolf,woman,womans_clothes,womans_hat,womens,worried,wrench,x,yellow_heart,yen,yum,zap,zero,zzz
"
.
split
(
"
,
"
);
CodeMirror
.
registerHelper
(
"
hint
"
,
"
emoji
"
,
function
(
cm
)
{
var
word
=
/
[\w
$
]
+/
;
var
cur
=
cm
.
getCursor
(),
curLine
=
cm
.
getLine
(
cur
.
line
);
var
start
=
cur
.
ch
,
end
=
start
;
while
(
end
<
curLine
.
length
&&
word
.
test
(
curLine
.
charAt
(
end
)))
{
++
end
;
}
while
(
start
&&
word
.
test
(
curLine
.
charAt
(
start
-
1
)))
{
--
start
;
}
var
tok
=
cm
.
getTokenAt
(
cur
);
var
autocompleteHints
=
[];
var
input
=
tok
.
string
.
trim
();
var
matchCnt
=
0
;
for
(
var
i
=
0
;
i
<
emojis
.
length
;
i
++
)
{
var
displayText
=
emojis
[
i
];
var
text
=
emojis
[
i
];
if
(
Util
.
startsWith
(
text
,
input
))
{
autocompleteHints
.
push
({
displayText
:
'
<span style="font-size: 1rem;line-height:22px"><img style="width: 1rem;margin:3px 0;float:left" src="
'
+
latkeConfig
.
servePath
+
'
/js/lib/emojify.js-1.1.0/images/basic/
'
+
text
+
'
.png">
'
+
displayText
.
toString
()
+
'
</span>
'
,
text
:
"
:
"
+
text
+
"
:
"
});
matchCnt
++
;
}
if
(
matchCnt
>
10
)
{
break
;
}
}
return
{
list
:
autocompleteHints
,
from
:
CodeMirror
.
Pos
(
cur
.
line
,
start
),
to
:
CodeMirror
.
Pos
(
cur
.
line
,
end
)};
});
CodeMirror
.
commands
.
autocompleteEmoji
=
function
(
cm
)
{
cm
.
showHint
({
hint
:
CodeMirror
.
hint
.
emoji
,
completeSingle
:
false
});
return
CodeMirror
.
Pass
;
};
// init codemirror
var
commentEditor
=
new
CodeMirror
Editor
({
var
commentEditor
=
new
Editor
({
element
:
document
.
getElementById
(
conf
.
id
),
dragDrop
:
false
,
lineWrapping
:
true
,
status
:
false
,
htmlURL
:
latkeConfig
.
servePath
+
'
/console/markdown/2html
'
,
toolbar
:
[
{
name
:
'
bold
'
},
{
name
:
'
italic
'
},
'
|
'
,
{
name
:
'
link
'
},
{
name
:
'
quote
'
},
{
name
:
'
unordered-list
'
},
{
name
:
'
ordered-list
'
},
'
|
'
,
{
name
:
'
link
'
},
'
|
'
,
{
name
:
'
redo
'
},
{
name
:
'
undo
'
},
'
|
'
,
{
name
:
'
preview
'
}
],
{
name
:
'
preview
'
}
,
{
name
:
'
fullscreen
'
}
],
extraKeys
:
{
"
Cmd-/
"
:
"
autocompleteEmoji
"
,
"
Ctrl-/
"
:
"
autocompleteEmoji
"
},
status
:
false
}
});
commentEditor
.
render
();
this
[
conf
.
id
]
=
commentEditor
.
codemirror
;
this
[
conf
.
id
].
on
(
'
changes
'
,
function
(
cm
)
{
if
(
$
(
'
#
'
+
conf
.
id
).
parent
().
find
(
'
.CodeMirror-preview
'
).
length
===
0
)
{
return
false
;
}
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
'
/console/markdown/2html
'
,
type
:
"
POST
"
,
cache
:
false
,
data
:
{
markdownText
:
cm
.
getValue
()
},
success
:
function
(
result
,
textStatus
)
{
$
(
'
#
'
+
conf
.
id
).
parent
().
find
(
'
.CodeMirror-preview
'
).
html
(
result
.
html
);
hljs
.
initHighlighting
.
called
=
false
;
hljs
.
initHighlighting
();
}
});
});
// after render, call back function
if
(
typeof
(
conf
.
fun
)
===
"
function
"
)
{
conf
.
fun
();
...
...
@@ -827,7 +930,7 @@ $.extend(TablePaginate.prototype, {
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.4.
4, Jan 27
, 2016
* @version 1.3.4.
5, Nov 8
, 2016
*/
admin
.
article
=
{
currentEditorType
:
''
,
...
...
@@ -1290,14 +1393,14 @@ admin.article = {
});
// editor
admin
.
editors
.
articleEditor
=
new
Editor
({
admin
.
editors
.
articleEditor
=
new
Solo
Editor
({
id
:
"
articleContent
"
,
kind
:
"
all
"
,
fun
:
fun
,
height
:
500
});
admin
.
editors
.
abstractEditor
=
new
Editor
({
admin
.
editors
.
abstractEditor
=
new
Solo
Editor
({
id
:
"
abstract
"
,
kind
:
"
simple
"
,
height
:
200
...
...
@@ -1896,7 +1999,7 @@ admin.register["draft-list"] = {
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.2.
4, May 30, 2015
* @version 1.1.2.
5, Nov 8, 2016
*/
/* page-list 相关操作 */
...
...
@@ -1955,7 +2058,7 @@ admin.pageList = {
}
admin
.
pageList
.
currentEditorType
=
Label
.
editorType
;
admin
.
editors
.
pageEditor
=
new
Editor
({
admin
.
editors
.
pageEditor
=
new
Solo
Editor
({
language
:
language
,
kind
:
"
all
"
,
id
:
"
pageContent
"
...
...
src/main/webapp/js/admin/latkeAdmin.min.js
View file @
12f1479d
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/main/webapp/js/page.min.js
View file @
12f1479d
...
...
@@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
Page
=
function
(
tips
){
this
.
currentCommentId
=
""
;
this
.
tips
=
tips
};
$
.
extend
(
Page
.
prototype
,{
insertEmotions
:
function
(
name
){
var
_it
=
this
;
if
(
name
===
undefined
){
name
=
""
}
$
(
"
#emotions
"
+
name
+
"
span
"
).
click
(
function
(){
var
$comment
=
$
(
"
#comment
"
+
name
);
var
endPosition
=
_it
.
_getCursorEndPosition
(
$comment
[
0
]);
var
key
=
"
[
"
+
this
.
className
+
"
]
"
,
textValue
=
$comment
[
0
].
value
;
textValue
=
textValue
.
substring
(
0
,
endPosition
)
+
key
+
textValue
.
substring
(
endPosition
,
textValue
.
length
);
$
(
"
#comment
"
+
name
).
val
(
textValue
);
if
(
$
.
browser
.
msie
){
endPosition
-=
textValue
.
split
(
"
\n
"
).
length
-
1
;
var
oR
=
$comment
[
0
].
createTextRange
();
oR
.
collapse
(
true
);
oR
.
moveStart
(
"
character
"
,
endPosition
+
6
);
oR
.
select
()}
else
{
$comment
[
0
].
setSelectionRange
(
endPosition
+
6
,
endPosition
+
6
)}})},
_getCursorEndPosition
:
function
(
textarea
){
textarea
.
focus
();
if
(
textarea
.
setSelectionRange
){
return
textarea
.
selectionEnd
}
else
{
if
(
document
.
selection
){
var
i
=
0
,
oS
=
document
.
selection
.
createRange
(),
oR
=
document
.
body
.
createTextRange
();
oR
.
moveToElementText
(
textarea
);
oS
.
getBookmark
();
for
(
i
=
0
;
oR
.
compareEndPoints
(
"
StartToStart
"
,
oS
)
<
0
&&
oS
.
moveStart
(
"
character
"
,
-
1
)
!==
0
;
i
++
){
if
(
textarea
.
value
.
charAt
(
i
)
===
"
\n
"
){
i
++
}}
return
i
}}},
validateComment
:
function
(
state
){
if
(
Util
.
isLoggedIn
()){
var
commenterContent
=
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
2
>
commenterContent
.
length
||
commenterContent
.
length
>
500
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
commentContentCannotEmptyLabel
);
$
(
"
#comment
"
+
state
).
focus
()}
else
{
return
true
}
$
(
"
#commentErrorTip
"
+
state
).
show
();
return
false
}
var
commentName
=
$
(
"
#commentName
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
commenterContent
=
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
2
>
commentName
.
length
||
commentName
.
length
>
20
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
nameTooLongLabel
);
$
(
"
#commentName
"
+
state
).
focus
()}
else
{
if
(
$
(
"
#commentEmail
"
+
state
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
mailCannotEmptyLabel
);
$
(
"
#commentEmail
"
+
state
).
focus
()}
else
{
if
(
!
/^
((([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
(\.([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
)
*
)
|
((\x
22
)((((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(([\x
01-
\x
08
\x
0b
\x
0c
\x
0e-
\x
1f
\x
7f
]
|
\x
21|
[\x
23-
\x
5b
]
|
[\x
5d-
\x
7e
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(\\([\x
01-
\x
09
\x
0b
\x
0c
\x
0d-
\x
7f
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
]))))
*
(((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(\x
22
)))
@
((([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.)
+
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.?
$/i
.
test
(
$
(
"
#commentEmail
"
+
state
).
val
())){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
mailInvalidLabel
);
$
(
"
#commentEmail
"
+
state
).
focus
()}
else
{
if
(
2
>
commenterContent
.
length
||
commenterContent
.
length
>
500
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
commentContentCannotEmptyLabel
);
$
(
"
#comment
"
+
state
).
focus
()}
else
{
if
(
$
(
"
#commentValidate
"
+
state
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
captchaCannotEmptyLabel
);
$
(
"
#commentValidate
"
+
state
).
focus
()}
else
{
return
true
}}}}}
$
(
"
#commentErrorTip
"
+
state
).
show
();
return
false
},
replaceCommentsEm
:
function
(
selector
){
var
$commentContents
=
$
(
selector
);
for
(
var
i
=
0
;
i
<
$commentContents
.
length
;
i
++
){
var
str
=
$commentContents
[
i
].
innerHTML
;
$commentContents
[
i
].
innerHTML
=
Util
.
replaceEmString
(
str
)}},
_initSyntaxHighlighter
:
function
(
languages
){
for
(
var
i
=
0
;
i
<
languages
.
length
;
i
++
){
switch
(
languages
[
i
]){
case
"
groovy
"
:
languages
[
i
]
=
"
groovy
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushGroovy.js
"
;
break
;
case
"
java
"
:
languages
[
i
]
=
"
java
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushJava.js
"
;
break
;
case
"
php
"
:
languages
[
i
]
=
"
php
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPhp.js
"
;
break
;
case
"
scala
"
:
languages
[
i
]
=
"
scala
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushScala.js
"
;
break
;
case
"
sql
"
:
languages
[
i
]
=
"
sql
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushSql.js
"
;
break
;
case
"
applescript
"
:
languages
[
i
]
=
"
applescript
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushAppleScript.js
"
;
break
;
case
"
as3
"
:
case
"
actionscript3
"
:
languages
[
i
]
=
"
actionscript3 as3
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushAS3.js
"
;
break
;
case
"
bash
"
:
case
"
shell
"
:
languages
[
i
]
=
"
bash shell
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushBash.js
"
;
break
;
case
"
coldfusion
"
:
case
"
cf
"
:
languages
[
i
]
=
"
coldfusion cf
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushColdFusion.js
"
;
break
;
case
"
c#
"
:
case
"
c-sharp
"
:
case
"
csharp
"
:
languages
[
i
]
=
"
c# c-sharp csharp
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushCSharp.js
"
;
break
;
case
"
cpp
"
:
case
"
c
"
:
languages
[
i
]
=
"
cpp c
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushCpp.js
"
;
break
;
case
"
css
"
:
languages
[
i
]
=
"
css
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushCss.js
"
;
break
;
case
"
delphi
"
:
case
"
pascal
"
:
languages
[
i
]
=
"
delphi pascal
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushDelphi.js
"
;
break
;
case
"
diff
"
:
case
"
patch
"
:
case
"
pas
"
:
languages
[
i
]
=
"
diff patch pas
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushDiff.js
"
;
break
;
case
"
erl
"
:
case
"
erlang
"
:
languages
[
i
]
=
"
erl erlang
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushErlang.js
"
;
break
;
case
"
js
"
:
case
"
jscript
"
:
case
"
javascript
"
:
languages
[
i
]
=
"
js jscript javascript
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushJScript.js
"
;
break
;
case
"
jfx
"
:
case
"
javafx
"
:
languages
[
i
]
=
"
jfx javafx
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushJavaFX.js
"
;
break
;
case
"
perl
"
:
case
"
pl
"
:
languages
[
i
]
=
"
perl pl
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPerl.js
"
;
break
;
case
"
plain
"
:
case
"
text
"
:
languages
[
i
]
=
"
text plain
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPlain.js
"
;
break
;
case
"
ps
"
:
case
"
powershell
"
:
languages
[
i
]
=
"
ps powershell
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPowerShell.js
"
;
break
;
case
"
py
"
:
case
"
python
"
:
languages
[
i
]
=
"
py python
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPython.js
"
;
break
;
case
"
rails
"
:
case
"
ror
"
:
case
"
ruby
"
:
case
"
rb
"
:
languages
[
i
]
=
"
ruby rails ror rb
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushRuby.js
"
;
break
;
case
"
sass
"
:
case
"
scss
"
:
languages
[
i
]
=
"
sass scss
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushSass.js
"
;
break
;
case
"
vb
"
:
case
"
vbnet
"
:
languages
[
i
]
=
"
vb vbnet
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushVb.js
"
;
break
;
case
"
xml
"
:
case
"
xhtml
"
:
case
"
xslt
"
:
case
"
html
"
:
languages
[
i
]
=
"
xml xhtml xslt html
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushXml.js
"
;
break
;
default
:
break
}}
SyntaxHighlighter
.
autoloader
.
apply
(
null
,
languages
);
SyntaxHighlighter
.
config
.
stripBrs
=
true
;
SyntaxHighlighter
.
all
()},
_loadSyntaxHighlighter
:
function
(
SHTheme
){
var
cssName
=
SHTheme
?
SHTheme
:
"
shCoreEclipse
"
,
that
=
this
;
if
(
document
.
createStyleSheet
){
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/styles/
"
+
cssName
+
"
.css
"
)}
else
{
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/styles/
"
+
cssName
+
"
.css' type='text/css' charset='utf-8' />
"
))}
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shCore.js
"
,
dataType
:
"
script
"
,
cache
:
true
,
success
:
function
(){
var
languages
=
[],
isScrip
=
false
;
$
(
"
.article-body pre, .code-highlight pre
"
).
each
(
function
(){
var
name
=
this
.
className
.
split
(
"
;
"
)[
0
];
var
language
=
name
.
substr
(
7
,
name
.
length
-
1
);
if
(
this
.
className
.
indexOf
(
"
html-script: true
"
)
>-
1
&&
(
language
!==
"
xml
"
&&
language
!==
"
xhtml
"
&&
language
!==
"
xslt
"
&&
language
!=
"
html
"
)){
isScrip
=
true
}
languages
.
push
(
language
)});
if
(
isScrip
){
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushXml.js
"
,
dataType
:
"
script
"
,
cache
:
true
,
success
:
function
(){
that
.
_initSyntaxHighlighter
(
languages
)}})}
else
{
that
.
_initSyntaxHighlighter
(
languages
)}}})},
parseLanguage
:
function
(
obj
){
var
isPrettify
=
false
,
isSH
=
false
;
$
(
"
.article-body pre, .code-highlight pre
"
).
each
(
function
(){
if
(
this
.
className
.
indexOf
(
"
brush
"
)
>-
1
){
isSH
=
true
}
if
(
this
.
className
.
indexOf
(
"
prettyprint
"
)
>-
1
){
isPrettify
=
true
}});
if
(
isSH
){
this
.
_loadSyntaxHighlighter
(
obj
?(
obj
.
SHTheme
?
obj
.
SHTheme
:
undefined
):
undefined
);
return
false
}
if
(
isPrettify
){
if
(
document
.
createStyleSheet
){
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.css
"
)}
else
{
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.css'>
"
))}
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.js
"
,
dataType
:
"
script
"
,
cache
:
true
,
success
:
function
(){
prettyPrint
()}});
return
false
}
if
(
document
.
createStyleSheet
){
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/highlight/styles/default.css
"
)}
else
{
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/highlight/styles/github.css'>
"
))}
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/highlight/highlight.pack.js
"
,
dataType
:
"
script
"
,
cache
:
true
,
success
:
function
(){
hljs
.
initHighlightingOnLoad
()}})},
load
:
function
(
obj
){
var
that
=
this
;
that
.
insertEmotions
();
that
.
parseLanguage
(
obj
?(
obj
.
language
?
obj
.
language
:
undefined
):
undefined
);
$
(
"
#commentValidate
"
).
keypress
(
function
(
event
){
if
(
event
.
keyCode
===
13
){
that
.
submitComment
()}});
$
(
"
#comment
"
).
keypress
(
function
(
event
){
if
(
event
.
keyCode
===
13
&&
event
.
ctrlKey
){
that
.
submitComment
()}});
$
(
"
#captcha
"
).
click
(
function
(){
$
(
this
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
())});
if
(
!
Util
.
isLoggedIn
()){
$
(
"
#commentEmail
"
).
val
(
Cookie
.
readCookie
(
"
commentEmail
"
));
$
(
"
#commentURL
"
).
val
(
Cookie
.
readCookie
(
"
commentURL
"
));
$
(
"
#commentName
"
).
val
(
Cookie
.
readCookie
(
"
commentName
"
))}
try
{
JSON
}
catch
(
e
){
document
.
write
(
'
<script src="
'
+
latkeConfig
.
staticServePath
+
'
/js/lib/json2.js"><
\
/script>
'
)}},
loadRandomArticles
:
function
(
headTitle
){
var
randomArticles1Label
=
this
.
tips
.
randomArticles1Label
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/get-random-articles.do
"
,
type
:
"
POST
"
,
success
:
function
(
result
,
textStatus
){
var
randomArticles
=
result
.
randomArticles
;
if
(
!
randomArticles
||
0
===
randomArticles
.
length
){
$
(
"
#randomArticles
"
).
remove
();
return
}
var
listHtml
=
""
;
for
(
var
i
=
0
;
i
<
randomArticles
.
length
;
i
++
){
var
article
=
randomArticles
[
i
];
var
title
=
article
.
articleTitle
;
var
randomArticleLiHtml
=
"
<li><a rel='nofollow' title='
"
+
title
+
"
' href='
"
+
latkeConfig
.
servePath
+
article
.
articlePermalink
+
"
'>
"
+
title
+
"
</a></li>
"
;
listHtml
+=
randomArticleLiHtml
}
var
titleHTML
=
headTitle
?
headTitle
:
"
<h4>
"
+
randomArticles1Label
+
"
</h4>
"
;
var
randomArticleListHtml
=
titleHTML
+
"
<ul class='marginLeft12'>
"
+
listHtml
+
"
</ul>
"
;
$
(
"
#randomArticles
"
).
append
(
randomArticleListHtml
)}})},
loadRelevantArticles
:
function
(
id
,
headTitle
){
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/article/id/
"
+
id
+
"
/relevant/articles
"
,
type
:
"
GET
"
,
success
:
function
(
data
,
textStatus
){
var
articles
=
data
.
relevantArticles
;
if
(
!
articles
||
0
===
articles
.
length
){
$
(
"
#relevantArticles
"
).
remove
();
return
}
var
listHtml
=
""
;
for
(
var
i
=
0
;
i
<
articles
.
length
;
i
++
){
var
article
=
articles
[
i
];
var
title
=
article
.
articleTitle
;
var
articleLiHtml
=
"
<li><a rel='nofollow' title='
"
+
title
+
"
' href='
"
+
latkeConfig
.
servePath
+
article
.
articlePermalink
+
"
'>
"
+
title
+
"
</a></li>
"
;
listHtml
+=
articleLiHtml
}
var
relevantArticleListHtml
=
headTitle
+
"
<ul class='marginLeft12'>
"
+
listHtml
+
"
</ul>
"
;
$
(
"
#relevantArticles
"
).
append
(
relevantArticleListHtml
)},
error
:
function
(){
$
(
"
#relevantArticles
"
).
remove
()}})},
loadExternalRelevantArticles
:
function
(
tags
,
headTitle
){
var
tips
=
this
.
tips
;
try
{
$
.
ajax
({
url
:
"
http://rhythm.b3log.org:80/get-articles-by-tags.do?tags=
"
+
tags
+
"
&blogHost=
"
+
tips
.
blogHost
+
"
&paginationPageSize=
"
+
tips
.
externalRelevantArticlesDisplayCount
,
type
:
"
GET
"
,
cache
:
true
,
dataType
:
"
jsonp
"
,
error
:
function
(){
$
(
"
#externalRelevantArticles
"
).
remove
()},
success
:
function
(
data
,
textStatus
){
var
articles
=
data
.
articles
;
if
(
!
articles
||
0
===
articles
.
length
){
$
(
"
#externalRelevantArticles
"
).
remove
();
return
}
var
listHtml
=
""
;
for
(
var
i
=
0
;
i
<
articles
.
length
;
i
++
){
var
article
=
articles
[
i
];
var
title
=
article
.
articleTitle
;
var
articleLiHtml
=
"
<li><a rel='nofollow' title='
"
+
title
+
"
' target='_blank' href='
"
+
article
.
articlePermalink
+
"
'>
"
+
title
+
"
</a></li>
"
;
listHtml
+=
articleLiHtml
}
var
titleHTML
=
headTitle
?
headTitle
:
"
<h4>
"
+
tips
.
externalRelevantArticles1Label
+
"
</h4>
"
;
var
randomArticleListHtml
=
titleHTML
+
"
<ul class='marginLeft12'>
"
+
listHtml
+
"
</ul>
"
;
$
(
"
#externalRelevantArticles
"
).
append
(
randomArticleListHtml
)}})}
catch
(
e
){}},
submitComment
:
function
(
commentId
,
state
){
if
(
!
state
){
state
=
""
}
var
that
=
this
,
tips
=
this
.
tips
,
type
=
"
article
"
;
if
(
tips
.
externalRelevantArticlesDisplayCount
===
undefined
){
type
=
"
page
"
}
if
(
this
.
validateComment
(
state
)){
$
(
"
#submitCommentButton
"
+
state
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
#commentErrorTip
"
+
state
).
show
().
html
(
this
.
tips
.
loadingLabel
);
var
requestJSONObject
=
{
oId
:
tips
.
oId
,
commentContent
:
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
)};
if
(
!
Util
.
isLoggedIn
()){
requestJSONObject
=
{
oId
:
tips
.
oId
,
commentContent
:
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
commentEmail
:
$
(
"
#commentEmail
"
+
state
).
val
(),
commentURL
:
Util
.
proessURL
(
$
(
"
#commentURL
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
)),
commentName
:
$
(
"
#commentName
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
captcha
:
$
(
"
#commentValidate
"
+
state
).
val
()};
Cookie
.
createCookie
(
"
commentName
"
,
requestJSONObject
.
commentName
,
365
);
Cookie
.
createCookie
(
"
commentEmail
"
,
requestJSONObject
.
commentEmail
,
365
);
Cookie
.
createCookie
(
"
commentURL
"
,
$
(
"
#commentURL
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
365
)}
if
(
state
===
"
Reply
"
){
requestJSONObject
.
commentOriginalCommentId
=
commentId
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
latkeConfig
.
servePath
+
"
/add-
"
+
type
+
"
-comment.do
"
,
cache
:
false
,
contentType
:
"
application/json
"
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
){
if
(
!
result
.
sc
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
result
.
msg
);
$
(
"
#comment
"
+
state
).
val
(
""
).
focus
();
$
(
"
#submitCommentButton
"
+
state
).
removeAttr
(
"
disabled
"
);
if
(
!
Util
.
isLoggedIn
()){
$
(
"
#captcha
"
+
state
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
())}
return
}
$
(
"
#comment
"
+
state
).
val
(
result
.
commentContent
);
$
(
"
#commentName
"
+
state
).
val
(
result
.
commentName
);
result
.
replyNameHTML
=
""
;
if
(
!
Util
.
isLoggedIn
()){
$
(
"
#captcha
"
+
state
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
());
if
(
$
(
"
#commentURL
"
+
state
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
){
result
.
replyNameHTML
=
"
<a>
"
+
$
(
"
#commentName
"
+
state
).
val
()
+
"
</a>
"
}
else
{
result
.
replyNameHTML
=
'
<a href="
'
+
Util
.
proessURL
(
$
(
"
#commentURL
"
+
state
).
val
())
+
'
" target="_blank">
'
+
$
(
"
#commentName
"
+
state
).
val
()
+
"
</a>
"
}
result
.
userName
=
result
.
commentName
}
else
{
result
.
replyNameHTML
=
'
<a href="
'
+
window
.
location
.
host
+
'
" target="_blank">
'
+
Util
.
getUserName
()
+
"
</a>
"
;
result
.
userName
=
Util
.
getUserName
()}
that
.
addCommentAjax
(
addComment
(
result
,
state
),
state
);
$
(
"
#submitCommentButton
"
+
state
).
removeAttr
(
"
disabled
"
)}})}},
addReplyForm
:
function
(
id
,
commentFormHTML
,
endHTML
){
var
that
=
this
;
if
(
id
===
this
.
currentCommentId
){
if
(
$
(
"
#commentNameReply
"
).
val
()
===
""
){
$
(
"
#commentNameReply
"
).
focus
()}
else
{
if
(
$
(
"
#commentEmailReply
"
).
val
()
===
""
){
$
(
"
#commentEmailReply
"
).
focus
()}
else
{
$
(
"
#commentReply
"
).
focus
()}}
return
}
$
(
"
#replyForm
"
).
remove
();
endHTML
=
endHTML
?
endHTML
:
""
;
if
(
endHTML
===
"
</div>
"
){
$
(
"
#
"
+
id
).
append
(
commentFormHTML
+
$
(
"
#commentForm
"
).
html
()
+
endHTML
)}
else
{
$
(
"
#
"
+
id
).
append
(
commentFormHTML
+
$
(
"
#commentForm
"
).
html
()
+
"
</table>
"
+
endHTML
)}
$
(
"
#replyForm input, #replyForm textarea
"
).
each
(
function
(){
this
.
id
=
this
.
id
+
"
Reply
"
});
$
(
"
#commentNameReply
"
).
val
(
Cookie
.
readCookie
(
"
commentName
"
));
$
(
"
#commentEmailReply
"
).
val
(
Cookie
.
readCookie
(
"
commentEmail
"
));
var
$label
=
$
(
"
#replyForm #commentURLLabel
"
);
if
(
$label
.
length
===
1
){
$label
.
attr
(
"
id
"
,
"
commentURLLabelReply
"
)}
$
(
"
#commentURLReply
"
).
val
(
Cookie
.
readCookie
(
"
commentURL
"
));
$
(
"
#replyForm #emotions
"
).
attr
(
"
id
"
,
"
emotionsReply
"
);
this
.
insertEmotions
(
"
Reply
"
);
$
(
"
#commentReply
"
).
unbind
().
keypress
(
function
(
event
){
if
(
event
.
keyCode
===
13
&&
event
.
ctrlKey
){
that
.
submitComment
(
id
,
"
Reply
"
);
event
.
preventDefault
()}});
$
(
"
#commentValidateReply
"
).
unbind
().
keypress
(
function
(
event
){
if
(
event
.
keyCode
===
13
){
that
.
submitComment
(
id
,
"
Reply
"
);
event
.
preventDefault
()}});
$
(
"
#replyForm #captcha
"
).
attr
(
"
id
"
,
"
captchaReply
"
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?
"
+
new
Date
().
getTime
()).
click
(
function
(){
$
(
this
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
())});
$
(
"
#replyForm #commentErrorTip
"
).
attr
(
"
id
"
,
"
commentErrorTipReply
"
).
html
(
""
).
hide
();
$
(
"
#replyForm #submitCommentButton
"
).
attr
(
"
id
"
,
"
submitCommentButtonReply
"
);
$
(
"
#replyForm #submitCommentButtonReply
"
).
unbind
(
"
click
"
).
removeAttr
(
"
onclick
"
).
click
(
function
(){
that
.
submitComment
(
id
,
"
Reply
"
)});
if
(
$
(
"
#commentNameReply
"
).
val
()
===
""
){
$
(
"
#commentNameReply
"
).
focus
()}
else
{
if
(
$
(
"
#commentEmailReply
"
).
val
()
===
""
){
$
(
"
#commentEmailReply
"
).
focus
()}
else
{
$
(
"
#commentReply
"
).
focus
()}}
this
.
currentCommentId
=
id
},
hideComment
:
function
(
id
){
$
(
"
#commentRef
"
+
id
).
hide
()},
showComment
:
function
(
it
,
id
,
top
,
parentTag
){
var
positionTop
=
parseInt
(
$
(
it
).
position
().
top
);
if
(
parentTag
){
positionTop
=
parseInt
(
$
(
it
).
parents
(
parentTag
).
position
().
top
)}
if
(
$
(
"
#commentRef
"
+
id
).
length
>
0
){
$
(
"
#commentRef
"
+
id
).
show
().
css
(
"
top
"
,(
positionTop
+
top
)
+
"
px
"
)}
else
{
var
$refComment
=
$
(
"
#
"
+
id
).
clone
();
$refComment
.
addClass
(
"
comment-body-ref
"
).
attr
(
"
id
"
,
"
commentRef
"
+
id
);
$refComment
.
find
(
"
#replyForm
"
).
remove
();
$
(
"
#comments
"
).
append
(
$refComment
);
$
(
"
#commentRef
"
+
id
).
css
(
"
top
"
,(
positionTop
+
top
)
+
"
px
"
)}},
addCommentAjax
:
function
(
commentHTML
,
state
){
if
(
$
(
"
#comments
"
).
children
().
length
>
0
){
$
(
$
(
"
#comments
"
).
children
()[
0
]).
before
(
commentHTML
)}
else
{
$
(
"
#comments
"
).
html
(
commentHTML
)}
if
(
state
===
""
){
$
(
"
#commentErrorTip
"
).
html
(
""
).
hide
();
$
(
"
#comment
"
).
val
(
""
);
$
(
"
#commentValidate
"
).
val
(
""
);
$
(
"
#captcha
"
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
())}
else
{
$
(
"
#replyForm
"
).
remove
()}
window
.
location
.
hash
=
"
#comments
"
}});
\ No newline at end of file
var
Page
=
function
(
tips
){
this
.
currentCommentId
=
""
;
this
.
tips
=
tips
};
$
.
extend
(
Page
.
prototype
,{
insertEmotions
:
function
(
name
){
var
_it
=
this
;
if
(
name
===
undefined
){
name
=
""
}
$
(
"
#emotions
"
+
name
+
"
span
"
).
click
(
function
(){
var
$comment
=
$
(
"
#comment
"
+
name
);
var
endPosition
=
_it
.
_getCursorEndPosition
(
$comment
[
0
]);
var
key
=
"
[
"
+
this
.
className
+
"
]
"
,
textValue
=
$comment
[
0
].
value
;
textValue
=
textValue
.
substring
(
0
,
endPosition
)
+
key
+
textValue
.
substring
(
endPosition
,
textValue
.
length
);
$
(
"
#comment
"
+
name
).
val
(
textValue
);
if
(
$
.
browser
.
msie
){
endPosition
-=
textValue
.
split
(
"
\n
"
).
length
-
1
;
var
oR
=
$comment
[
0
].
createTextRange
();
oR
.
collapse
(
true
);
oR
.
moveStart
(
"
character
"
,
endPosition
+
6
);
oR
.
select
()}
else
{
$comment
[
0
].
setSelectionRange
(
endPosition
+
6
,
endPosition
+
6
)}})},
_getCursorEndPosition
:
function
(
textarea
){
textarea
.
focus
();
if
(
textarea
.
setSelectionRange
){
return
textarea
.
selectionEnd
}
else
{
if
(
document
.
selection
){
var
i
=
0
,
oS
=
document
.
selection
.
createRange
(),
oR
=
document
.
body
.
createTextRange
();
oR
.
moveToElementText
(
textarea
);
oS
.
getBookmark
();
for
(
i
=
0
;
oR
.
compareEndPoints
(
"
StartToStart
"
,
oS
)
<
0
&&
oS
.
moveStart
(
"
character
"
,
-
1
)
!==
0
;
i
++
){
if
(
textarea
.
value
.
charAt
(
i
)
===
"
\n
"
){
i
++
}}
return
i
}}},
validateComment
:
function
(
state
){
if
(
Util
.
isLoggedIn
()){
var
commenterContent
=
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
2
>
commenterContent
.
length
||
commenterContent
.
length
>
500
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
commentContentCannotEmptyLabel
);
$
(
"
#comment
"
+
state
).
focus
()}
else
{
return
true
}
$
(
"
#commentErrorTip
"
+
state
).
show
();
return
false
}
var
commentName
=
$
(
"
#commentName
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
commenterContent
=
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
);
if
(
2
>
commentName
.
length
||
commentName
.
length
>
20
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
nameTooLongLabel
);
$
(
"
#commentName
"
+
state
).
focus
()}
else
{
if
(
$
(
"
#commentEmail
"
+
state
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
mailCannotEmptyLabel
);
$
(
"
#commentEmail
"
+
state
).
focus
()}
else
{
if
(
!
/^
((([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
(\.([
a-z
]
|
\d
|
[
!#
\$
%&'
\*\+\-\/
=
\?\^
_`{
\|
}~
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
+
)
*
)
|
((\x
22
)((((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(([\x
01-
\x
08
\x
0b
\x
0c
\x
0e-
\x
1f
\x
7f
]
|
\x
21|
[\x
23-
\x
5b
]
|
[\x
5d-
\x
7e
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(\\([\x
01-
\x
09
\x
0b
\x
0c
\x
0d-
\x
7f
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
]))))
*
(((\x
20|
\x
09
)
*
(\x
0d
\x
0a
))?(\x
20|
\x
09
)
+
)?(\x
22
)))
@
((([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
\d
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.)
+
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
|
(([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])([
a-z
]
|
\d
|-|
\.
|_|~|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])
*
([
a-z
]
|
[\u
00A0-
\u
D7FF
\u
F900-
\u
FDCF
\u
FDF0-
\u
FFEF
])))\.?
$/i
.
test
(
$
(
"
#commentEmail
"
+
state
).
val
())){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
mailInvalidLabel
);
$
(
"
#commentEmail
"
+
state
).
focus
()}
else
{
if
(
2
>
commenterContent
.
length
||
commenterContent
.
length
>
500
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
commentContentCannotEmptyLabel
);
$
(
"
#comment
"
+
state
).
focus
()}
else
{
if
(
$
(
"
#commentValidate
"
+
state
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
this
.
tips
.
captchaCannotEmptyLabel
);
$
(
"
#commentValidate
"
+
state
).
focus
()}
else
{
return
true
}}}}}
$
(
"
#commentErrorTip
"
+
state
).
show
();
return
false
},
replaceCommentsEm
:
function
(
selector
){
var
$commentContents
=
$
(
selector
);
for
(
var
i
=
0
;
i
<
$commentContents
.
length
;
i
++
){
var
str
=
$commentContents
[
i
].
innerHTML
;
$commentContents
[
i
].
innerHTML
=
Util
.
replaceEmString
(
str
)}},
_initSyntaxHighlighter
:
function
(
languages
){
for
(
var
i
=
0
;
i
<
languages
.
length
;
i
++
){
switch
(
languages
[
i
]){
case
"
groovy
"
:
languages
[
i
]
=
"
groovy
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushGroovy.js
"
;
break
;
case
"
java
"
:
languages
[
i
]
=
"
java
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushJava.js
"
;
break
;
case
"
php
"
:
languages
[
i
]
=
"
php
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPhp.js
"
;
break
;
case
"
scala
"
:
languages
[
i
]
=
"
scala
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushScala.js
"
;
break
;
case
"
sql
"
:
languages
[
i
]
=
"
sql
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushSql.js
"
;
break
;
case
"
applescript
"
:
languages
[
i
]
=
"
applescript
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushAppleScript.js
"
;
break
;
case
"
as3
"
:
case
"
actionscript3
"
:
languages
[
i
]
=
"
actionscript3 as3
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushAS3.js
"
;
break
;
case
"
bash
"
:
case
"
shell
"
:
languages
[
i
]
=
"
bash shell
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushBash.js
"
;
break
;
case
"
coldfusion
"
:
case
"
cf
"
:
languages
[
i
]
=
"
coldfusion cf
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushColdFusion.js
"
;
break
;
case
"
c#
"
:
case
"
c-sharp
"
:
case
"
csharp
"
:
languages
[
i
]
=
"
c# c-sharp csharp
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushCSharp.js
"
;
break
;
case
"
cpp
"
:
case
"
c
"
:
languages
[
i
]
=
"
cpp c
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushCpp.js
"
;
break
;
case
"
css
"
:
languages
[
i
]
=
"
css
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushCss.js
"
;
break
;
case
"
delphi
"
:
case
"
pascal
"
:
languages
[
i
]
=
"
delphi pascal
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushDelphi.js
"
;
break
;
case
"
diff
"
:
case
"
patch
"
:
case
"
pas
"
:
languages
[
i
]
=
"
diff patch pas
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushDiff.js
"
;
break
;
case
"
erl
"
:
case
"
erlang
"
:
languages
[
i
]
=
"
erl erlang
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushErlang.js
"
;
break
;
case
"
js
"
:
case
"
jscript
"
:
case
"
javascript
"
:
languages
[
i
]
=
"
js jscript javascript
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushJScript.js
"
;
break
;
case
"
jfx
"
:
case
"
javafx
"
:
languages
[
i
]
=
"
jfx javafx
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushJavaFX.js
"
;
break
;
case
"
perl
"
:
case
"
pl
"
:
languages
[
i
]
=
"
perl pl
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPerl.js
"
;
break
;
case
"
plain
"
:
case
"
text
"
:
languages
[
i
]
=
"
text plain
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPlain.js
"
;
break
;
case
"
ps
"
:
case
"
powershell
"
:
languages
[
i
]
=
"
ps powershell
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPowerShell.js
"
;
break
;
case
"
py
"
:
case
"
python
"
:
languages
[
i
]
=
"
py python
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushPython.js
"
;
break
;
case
"
rails
"
:
case
"
ror
"
:
case
"
ruby
"
:
case
"
rb
"
:
languages
[
i
]
=
"
ruby rails ror rb
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushRuby.js
"
;
break
;
case
"
sass
"
:
case
"
scss
"
:
languages
[
i
]
=
"
sass scss
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushSass.js
"
;
break
;
case
"
vb
"
:
case
"
vbnet
"
:
languages
[
i
]
=
"
vb vbnet
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushVb.js
"
;
break
;
case
"
xml
"
:
case
"
xhtml
"
:
case
"
xslt
"
:
case
"
html
"
:
languages
[
i
]
=
"
xml xhtml xslt html
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushXml.js
"
;
break
;
default
:
break
}}
SyntaxHighlighter
.
autoloader
.
apply
(
null
,
languages
);
SyntaxHighlighter
.
config
.
stripBrs
=
true
;
SyntaxHighlighter
.
all
()},
_loadSyntaxHighlighter
:
function
(
SHTheme
){
var
cssName
=
SHTheme
?
SHTheme
:
"
shCoreEclipse
"
,
that
=
this
;
if
(
document
.
createStyleSheet
){
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/styles/
"
+
cssName
+
"
.css
"
)}
else
{
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/styles/
"
+
cssName
+
"
.css' type='text/css' charset='utf-8' />
"
))}
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shCore.js
"
,
dataType
:
"
script
"
,
cache
:
true
,
success
:
function
(){
var
languages
=
[],
isScrip
=
false
;
$
(
"
.article-body pre, .code-highlight pre
"
).
each
(
function
(){
var
name
=
this
.
className
.
split
(
"
;
"
)[
0
];
var
language
=
name
.
substr
(
7
,
name
.
length
-
1
);
if
(
this
.
className
.
indexOf
(
"
html-script: true
"
)
>-
1
&&
(
language
!==
"
xml
"
&&
language
!==
"
xhtml
"
&&
language
!==
"
xslt
"
&&
language
!=
"
html
"
)){
isScrip
=
true
}
languages
.
push
(
language
)});
if
(
isScrip
){
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shBrushXml.js
"
,
dataType
:
"
script
"
,
cache
:
true
,
success
:
function
(){
that
.
_initSyntaxHighlighter
(
languages
)}})}
else
{
that
.
_initSyntaxHighlighter
(
languages
)}}})},
parseLanguage
:
function
(
obj
){
var
isPrettify
=
false
,
isSH
=
false
;
$
(
"
.article-body pre, .code-highlight pre
"
).
each
(
function
(){
if
(
this
.
className
.
indexOf
(
"
brush
"
)
>-
1
){
isSH
=
true
}
if
(
this
.
className
.
indexOf
(
"
prettyprint
"
)
>-
1
){
isPrettify
=
true
}});
if
(
isSH
){
this
.
_loadSyntaxHighlighter
(
obj
?(
obj
.
SHTheme
?
obj
.
SHTheme
:
undefined
):
undefined
);
return
false
}
if
(
isPrettify
){
if
(
document
.
createStyleSheet
){
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.css
"
)}
else
{
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.css'>
"
))}
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.js
"
,
dataType
:
"
script
"
,
cache
:
true
,
success
:
function
(){
prettyPrint
()}});
return
false
}
if
(
document
.
createStyleSheet
){
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/highlight.js-9.6.0/styles/default.css
"
)}
else
{
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/highlight.js-9.6.0/styles/github.css'>
"
))}
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/highlight.js-9.6.0/highlight.pack.js
"
,
dataType
:
"
script
"
,
cache
:
true
,
success
:
function
(){
hljs
.
initHighlightingOnLoad
()}})},
load
:
function
(
obj
){
var
that
=
this
;
that
.
insertEmotions
();
that
.
parseLanguage
(
obj
?(
obj
.
language
?
obj
.
language
:
undefined
):
undefined
);
$
(
"
#commentValidate
"
).
keypress
(
function
(
event
){
if
(
event
.
keyCode
===
13
){
that
.
submitComment
()}});
$
(
"
#comment
"
).
keypress
(
function
(
event
){
if
(
event
.
keyCode
===
13
&&
event
.
ctrlKey
){
that
.
submitComment
()}});
$
(
"
#captcha
"
).
click
(
function
(){
$
(
this
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
())});
if
(
!
Util
.
isLoggedIn
()){
$
(
"
#commentEmail
"
).
val
(
Cookie
.
readCookie
(
"
commentEmail
"
));
$
(
"
#commentURL
"
).
val
(
Cookie
.
readCookie
(
"
commentURL
"
));
$
(
"
#commentName
"
).
val
(
Cookie
.
readCookie
(
"
commentName
"
))}
try
{
JSON
}
catch
(
e
){
document
.
write
(
'
<script src="
'
+
latkeConfig
.
staticServePath
+
'
/js/lib/json2.js"><
\
/script>
'
)}},
loadRandomArticles
:
function
(
headTitle
){
var
randomArticles1Label
=
this
.
tips
.
randomArticles1Label
;
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/get-random-articles.do
"
,
type
:
"
POST
"
,
success
:
function
(
result
,
textStatus
){
var
randomArticles
=
result
.
randomArticles
;
if
(
!
randomArticles
||
0
===
randomArticles
.
length
){
$
(
"
#randomArticles
"
).
remove
();
return
}
var
listHtml
=
""
;
for
(
var
i
=
0
;
i
<
randomArticles
.
length
;
i
++
){
var
article
=
randomArticles
[
i
];
var
title
=
article
.
articleTitle
;
var
randomArticleLiHtml
=
"
<li><a rel='nofollow' title='
"
+
title
+
"
' href='
"
+
latkeConfig
.
servePath
+
article
.
articlePermalink
+
"
'>
"
+
title
+
"
</a></li>
"
;
listHtml
+=
randomArticleLiHtml
}
var
titleHTML
=
headTitle
?
headTitle
:
"
<h4>
"
+
randomArticles1Label
+
"
</h4>
"
;
var
randomArticleListHtml
=
titleHTML
+
"
<ul class='marginLeft12'>
"
+
listHtml
+
"
</ul>
"
;
$
(
"
#randomArticles
"
).
append
(
randomArticleListHtml
)}})},
loadRelevantArticles
:
function
(
id
,
headTitle
){
$
.
ajax
({
url
:
latkeConfig
.
servePath
+
"
/article/id/
"
+
id
+
"
/relevant/articles
"
,
type
:
"
GET
"
,
success
:
function
(
data
,
textStatus
){
var
articles
=
data
.
relevantArticles
;
if
(
!
articles
||
0
===
articles
.
length
){
$
(
"
#relevantArticles
"
).
remove
();
return
}
var
listHtml
=
""
;
for
(
var
i
=
0
;
i
<
articles
.
length
;
i
++
){
var
article
=
articles
[
i
];
var
title
=
article
.
articleTitle
;
var
articleLiHtml
=
"
<li><a rel='nofollow' title='
"
+
title
+
"
' href='
"
+
latkeConfig
.
servePath
+
article
.
articlePermalink
+
"
'>
"
+
title
+
"
</a></li>
"
;
listHtml
+=
articleLiHtml
}
var
relevantArticleListHtml
=
headTitle
+
"
<ul class='marginLeft12'>
"
+
listHtml
+
"
</ul>
"
;
$
(
"
#relevantArticles
"
).
append
(
relevantArticleListHtml
)},
error
:
function
(){
$
(
"
#relevantArticles
"
).
remove
()}})},
loadExternalRelevantArticles
:
function
(
tags
,
headTitle
){
var
tips
=
this
.
tips
;
try
{
$
.
ajax
({
url
:
"
http://rhythm.b3log.org:80/get-articles-by-tags.do?tags=
"
+
tags
+
"
&blogHost=
"
+
tips
.
blogHost
+
"
&paginationPageSize=
"
+
tips
.
externalRelevantArticlesDisplayCount
,
type
:
"
GET
"
,
cache
:
true
,
dataType
:
"
jsonp
"
,
error
:
function
(){
$
(
"
#externalRelevantArticles
"
).
remove
()},
success
:
function
(
data
,
textStatus
){
var
articles
=
data
.
articles
;
if
(
!
articles
||
0
===
articles
.
length
){
$
(
"
#externalRelevantArticles
"
).
remove
();
return
}
var
listHtml
=
""
;
for
(
var
i
=
0
;
i
<
articles
.
length
;
i
++
){
var
article
=
articles
[
i
];
var
title
=
article
.
articleTitle
;
var
articleLiHtml
=
"
<li><a rel='nofollow' title='
"
+
title
+
"
' target='_blank' href='
"
+
article
.
articlePermalink
+
"
'>
"
+
title
+
"
</a></li>
"
;
listHtml
+=
articleLiHtml
}
var
titleHTML
=
headTitle
?
headTitle
:
"
<h4>
"
+
tips
.
externalRelevantArticles1Label
+
"
</h4>
"
;
var
randomArticleListHtml
=
titleHTML
+
"
<ul class='marginLeft12'>
"
+
listHtml
+
"
</ul>
"
;
$
(
"
#externalRelevantArticles
"
).
append
(
randomArticleListHtml
)}})}
catch
(
e
){}},
submitComment
:
function
(
commentId
,
state
){
if
(
!
state
){
state
=
""
}
var
that
=
this
,
tips
=
this
.
tips
,
type
=
"
article
"
;
if
(
tips
.
externalRelevantArticlesDisplayCount
===
undefined
){
type
=
"
page
"
}
if
(
this
.
validateComment
(
state
)){
$
(
"
#submitCommentButton
"
+
state
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
#commentErrorTip
"
+
state
).
show
().
html
(
this
.
tips
.
loadingLabel
);
var
requestJSONObject
=
{
oId
:
tips
.
oId
,
commentContent
:
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
)};
if
(
!
Util
.
isLoggedIn
()){
requestJSONObject
=
{
oId
:
tips
.
oId
,
commentContent
:
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
commentEmail
:
$
(
"
#commentEmail
"
+
state
).
val
(),
commentURL
:
Util
.
proessURL
(
$
(
"
#commentURL
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
)),
commentName
:
$
(
"
#commentName
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
captcha
:
$
(
"
#commentValidate
"
+
state
).
val
()};
Cookie
.
createCookie
(
"
commentName
"
,
requestJSONObject
.
commentName
,
365
);
Cookie
.
createCookie
(
"
commentEmail
"
,
requestJSONObject
.
commentEmail
,
365
);
Cookie
.
createCookie
(
"
commentURL
"
,
$
(
"
#commentURL
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
365
)}
if
(
state
===
"
Reply
"
){
requestJSONObject
.
commentOriginalCommentId
=
commentId
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
latkeConfig
.
servePath
+
"
/add-
"
+
type
+
"
-comment.do
"
,
cache
:
false
,
contentType
:
"
application/json
"
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
){
if
(
!
result
.
sc
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
result
.
msg
);
$
(
"
#comment
"
+
state
).
val
(
""
).
focus
();
$
(
"
#submitCommentButton
"
+
state
).
removeAttr
(
"
disabled
"
);
if
(
!
Util
.
isLoggedIn
()){
$
(
"
#captcha
"
+
state
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
())}
return
}
$
(
"
#comment
"
+
state
).
val
(
result
.
commentContent
);
$
(
"
#commentName
"
+
state
).
val
(
result
.
commentName
);
result
.
replyNameHTML
=
""
;
if
(
!
Util
.
isLoggedIn
()){
$
(
"
#captcha
"
+
state
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
());
if
(
$
(
"
#commentURL
"
+
state
).
val
().
replace
(
/
\s
/g
,
""
)
===
""
){
result
.
replyNameHTML
=
"
<a>
"
+
$
(
"
#commentName
"
+
state
).
val
()
+
"
</a>
"
}
else
{
result
.
replyNameHTML
=
'
<a href="
'
+
Util
.
proessURL
(
$
(
"
#commentURL
"
+
state
).
val
())
+
'
" target="_blank">
'
+
$
(
"
#commentName
"
+
state
).
val
()
+
"
</a>
"
}
result
.
userName
=
result
.
commentName
}
else
{
result
.
replyNameHTML
=
'
<a href="
'
+
window
.
location
.
host
+
'
" target="_blank">
'
+
Util
.
getUserName
()
+
"
</a>
"
;
result
.
userName
=
Util
.
getUserName
()}
that
.
addCommentAjax
(
addComment
(
result
,
state
),
state
);
$
(
"
#submitCommentButton
"
+
state
).
removeAttr
(
"
disabled
"
)}})}},
addReplyForm
:
function
(
id
,
commentFormHTML
,
endHTML
){
var
that
=
this
;
if
(
id
===
this
.
currentCommentId
){
if
(
$
(
"
#commentNameReply
"
).
val
()
===
""
){
$
(
"
#commentNameReply
"
).
focus
()}
else
{
if
(
$
(
"
#commentEmailReply
"
).
val
()
===
""
){
$
(
"
#commentEmailReply
"
).
focus
()}
else
{
$
(
"
#commentReply
"
).
focus
()}}
return
}
$
(
"
#replyForm
"
).
remove
();
endHTML
=
endHTML
?
endHTML
:
""
;
if
(
endHTML
===
"
</div>
"
){
$
(
"
#
"
+
id
).
append
(
commentFormHTML
+
$
(
"
#commentForm
"
).
html
()
+
endHTML
)}
else
{
$
(
"
#
"
+
id
).
append
(
commentFormHTML
+
$
(
"
#commentForm
"
).
html
()
+
"
</table>
"
+
endHTML
)}
$
(
"
#replyForm input, #replyForm textarea
"
).
each
(
function
(){
this
.
id
=
this
.
id
+
"
Reply
"
});
$
(
"
#commentNameReply
"
).
val
(
Cookie
.
readCookie
(
"
commentName
"
));
$
(
"
#commentEmailReply
"
).
val
(
Cookie
.
readCookie
(
"
commentEmail
"
));
var
$label
=
$
(
"
#replyForm #commentURLLabel
"
);
if
(
$label
.
length
===
1
){
$label
.
attr
(
"
id
"
,
"
commentURLLabelReply
"
)}
$
(
"
#commentURLReply
"
).
val
(
Cookie
.
readCookie
(
"
commentURL
"
));
$
(
"
#replyForm #emotions
"
).
attr
(
"
id
"
,
"
emotionsReply
"
);
this
.
insertEmotions
(
"
Reply
"
);
$
(
"
#commentReply
"
).
unbind
().
keypress
(
function
(
event
){
if
(
event
.
keyCode
===
13
&&
event
.
ctrlKey
){
that
.
submitComment
(
id
,
"
Reply
"
);
event
.
preventDefault
()}});
$
(
"
#commentValidateReply
"
).
unbind
().
keypress
(
function
(
event
){
if
(
event
.
keyCode
===
13
){
that
.
submitComment
(
id
,
"
Reply
"
);
event
.
preventDefault
()}});
$
(
"
#replyForm #captcha
"
).
attr
(
"
id
"
,
"
captchaReply
"
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?
"
+
new
Date
().
getTime
()).
click
(
function
(){
$
(
this
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
())});
$
(
"
#replyForm #commentErrorTip
"
).
attr
(
"
id
"
,
"
commentErrorTipReply
"
).
html
(
""
).
hide
();
$
(
"
#replyForm #submitCommentButton
"
).
attr
(
"
id
"
,
"
submitCommentButtonReply
"
);
$
(
"
#replyForm #submitCommentButtonReply
"
).
unbind
(
"
click
"
).
removeAttr
(
"
onclick
"
).
click
(
function
(){
that
.
submitComment
(
id
,
"
Reply
"
)});
if
(
$
(
"
#commentNameReply
"
).
val
()
===
""
){
$
(
"
#commentNameReply
"
).
focus
()}
else
{
if
(
$
(
"
#commentEmailReply
"
).
val
()
===
""
){
$
(
"
#commentEmailReply
"
).
focus
()}
else
{
$
(
"
#commentReply
"
).
focus
()}}
this
.
currentCommentId
=
id
},
hideComment
:
function
(
id
){
$
(
"
#commentRef
"
+
id
).
hide
()},
showComment
:
function
(
it
,
id
,
top
,
parentTag
){
var
positionTop
=
parseInt
(
$
(
it
).
position
().
top
);
if
(
parentTag
){
positionTop
=
parseInt
(
$
(
it
).
parents
(
parentTag
).
position
().
top
)}
if
(
$
(
"
#commentRef
"
+
id
).
length
>
0
){
$
(
"
#commentRef
"
+
id
).
show
().
css
(
"
top
"
,(
positionTop
+
top
)
+
"
px
"
)}
else
{
var
$refComment
=
$
(
"
#
"
+
id
).
clone
();
$refComment
.
addClass
(
"
comment-body-ref
"
).
attr
(
"
id
"
,
"
commentRef
"
+
id
);
$refComment
.
find
(
"
#replyForm
"
).
remove
();
$
(
"
#comments
"
).
append
(
$refComment
);
$
(
"
#commentRef
"
+
id
).
css
(
"
top
"
,(
positionTop
+
top
)
+
"
px
"
)}},
addCommentAjax
:
function
(
commentHTML
,
state
){
if
(
$
(
"
#comments
"
).
children
().
length
>
0
){
$
(
$
(
"
#comments
"
).
children
()[
0
]).
before
(
commentHTML
)}
else
{
$
(
"
#comments
"
).
html
(
commentHTML
)}
if
(
state
===
""
){
$
(
"
#commentErrorTip
"
).
html
(
""
).
hide
();
$
(
"
#comment
"
).
val
(
""
);
$
(
"
#commentValidate
"
).
val
(
""
);
$
(
"
#captcha
"
).
attr
(
"
src
"
,
latkeConfig
.
servePath
+
"
/captcha.do?code=
"
+
Math
.
random
())}
else
{
$
(
"
#replyForm
"
).
remove
()}
window
.
location
.
hash
=
"
#comments
"
}});
\ No newline at end of file
src/test/java/org/b3log/solo/service/ArticleQueryServiceTestCase.java
View file @
12f1479d
...
...
@@ -29,7 +29,7 @@ import org.testng.annotations.Test;
* {@link ArticleQueryService} test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
2, Jun 28, 2013
* @version 1.0.0.
3, Nov 9, 2016
*/
@Test
(
suiteName
=
"service"
)
public
class
ArticleQueryServiceTestCase
extends
AbstractTestCase
{
...
...
@@ -132,7 +132,7 @@ public class ArticleQueryServiceTestCase extends AbstractTestCase {
public
void
getArticlesByTag
()
throws
Exception
{
final
TagQueryService
tagQueryService
=
getTagQueryService
();
JSONObject
result
=
tagQueryService
.
getTagByTitle
(
"
B3log
"
);
JSONObject
result
=
tagQueryService
.
getTagByTitle
(
"
Solo
"
);
Assert
.
assertNotNull
(
result
);
final
JSONObject
tag
=
result
.
getJSONObject
(
Tag
.
TAG
);
...
...
src/test/java/org/b3log/solo/service/TagQueryServiceTestCase.java
View file @
12f1479d
...
...
@@ -28,7 +28,7 @@ import org.testng.annotations.Test;
* {@link TagQueryService} test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
2, Aug 3, 2015
* @version 1.0.0.
3, Nov 9, 2016
*/
@Test
(
suiteName
=
"service"
)
public
class
TagQueryServiceTestCase
extends
AbstractTestCase
{
...
...
@@ -64,9 +64,8 @@ public class TagQueryServiceTestCase extends AbstractTestCase {
final
List
<
JSONObject
>
tags
=
tagQueryService
.
getTags
();
Assert
.
assertNotNull
(
tags
);
Assert
.
assertEquals
(
tags
.
size
(),
2
);
Assert
.
assertEquals
(
tags
.
get
(
0
).
getString
(
Tag
.
TAG_TITLE
),
"B3log"
);
Assert
.
assertEquals
(
tags
.
get
(
1
).
getString
(
Tag
.
TAG_TITLE
),
"Solo"
);
Assert
.
assertEquals
(
tags
.
size
(),
1
);
Assert
.
assertEquals
(
tags
.
get
(
0
).
getString
(
Tag
.
TAG_TITLE
),
"Solo"
);
}
/**
...
...
@@ -78,12 +77,12 @@ public class TagQueryServiceTestCase extends AbstractTestCase {
public
void
getTagByTitle
()
throws
Exception
{
final
TagQueryService
tagQueryService
=
getTagQueryService
();
final
JSONObject
result
=
tagQueryService
.
getTagByTitle
(
"
B3log
"
);
final
JSONObject
result
=
tagQueryService
.
getTagByTitle
(
"
Solo
"
);
Assert
.
assertNotNull
(
result
);
final
JSONObject
tag
=
result
.
getJSONObject
(
Tag
.
TAG
);
Assert
.
assertNotNull
(
tag
);
Assert
.
assertEquals
(
tag
.
getString
(
Tag
.
TAG_TITLE
),
"
B3log
"
);
Assert
.
assertEquals
(
tag
.
getString
(
Tag
.
TAG_TITLE
),
"
Solo
"
);
}
}
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