Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
0b51ef74
Unverified
Commit
0b51ef74
authored
Jul 05, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
更新看板娘模型加载地址
parent
768f4146
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
37 deletions
+3
-37
src/main/webapp/js/common.min.js
src/main/webapp/js/common.min.js
+1
-18
src/main/webapp/js/page.min.js
src/main/webapp/js/page.min.js
+0
-17
src/main/webapp/plugins/kanbanniang/assert/index.js
src/main/webapp/plugins/kanbanniang/assert/index.js
+2
-2
No files found.
src/main/webapp/js/common.min.js
View file @
0b51ef74
/*
* Solo - A beautiful, simple, stable, fast Java blogging system.
* Copyright (c) 2010-2018, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
var
Util
=
{
_isArticlePage
:
function
(
href
){
var
isArticle
=
true
;
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/tags/
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/tags.html
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/category/
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/archives.html
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/archives/
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/links.html
"
)
>-
1
){
isArticle
=
false
}
if
(
href
===
latkeConfig
.
servePath
){
isArticle
=
false
}
if
(
/^
[
0-9
]
*$/
.
test
(
href
.
replace
(
latkeConfig
.
servePath
+
"
/
"
,
""
))){
isArticle
=
false
}
return
isArticle
},
initPjax
:
function
(
cb
,
articelCB
){
if
(
$
(
"
#pjax
"
).
length
===
1
){
$
.
pjax
({
selector
:
"
a
"
,
container
:
"
#pjax
"
,
show
:
""
,
cache
:
false
,
storage
:
true
,
titleSuffix
:
""
,
filter
:
function
(
href
){
return
Util
.
_isArticlePage
(
href
)},
callback
:
function
(){
cb
()}});
NProgress
.
configure
({
showSpinner
:
false
});
$
(
"
#pjax
"
).
bind
(
"
pjax.start
"
,
function
(){
NProgress
.
start
()});
$
(
"
#pjax
"
).
bind
(
"
pjax.end
"
,
function
(){
NProgress
.
done
()});
return
}
if
(
$
(
"
#pjaxArticle
"
).
length
===
1
){
$
.
pjax
({
selector
:
"
a
"
,
container
:
"
#pjaxArticle
"
,
show
:
""
,
cache
:
false
,
storage
:
true
,
titleSuffix
:
""
,
filter
:
function
(
href
){
return
!
Util
.
_isArticlePage
(
href
)},
callback
:
function
(){
articelCB
()}});
NProgress
.
configure
({
showSpinner
:
false
});
$
(
"
#pjaxArticle
"
).
bind
(
"
pjax.start
"
,
function
(){
NProgress
.
start
()});
$
(
"
#pjaxArticle
"
).
bind
(
"
pjax.end
"
,
function
(){
NProgress
.
done
()});
return
}},
parseMarkdown
:
function
(
className
){
var
hasMathJax
=
false
;
var
hasFlow
=
false
;
var
className
=
className
||
"
article-body
"
;
$
(
"
.
"
+
className
).
each
(
function
(){
$
(
this
).
find
(
"
p
"
).
each
(
function
(){
if
(
$
(
this
).
text
().
indexOf
(
"
$
\\
"
)
>-
1
||
$
(
this
).
text
().
indexOf
(
"
$$
"
)
>-
1
){
hasMathJax
=
true
}});
if
(
$
(
this
).
find
(
"
code.lang-flow, code.language-flow
"
).
length
>
0
){
hasFlow
=
true
}});
if
(
hasMathJax
){
var
initMathJax
=
function
(){
MathJax
.
Hub
.
Config
({
tex2jax
:{
inlineMath
:[[
"
$
"
,
"
$
"
],[
"
\\
(
"
,
"
\\
)
"
]],
displayMath
:[[
"
$$
"
,
"
$$
"
]],
processEscapes
:
true
,
processEnvironments
:
true
,
skipTags
:[
"
pre
"
,
"
code
"
,
"
script
"
]}});
MathJax
.
Hub
.
Typeset
()};
if
(
typeof
MathJax
!==
"
undefined
"
){
initMathJax
()}
else
{
$
.
ajax
({
method
:
"
GET
"
,
url
:
"
https://cdn.staticfile.org/MathJax/MathJax-2.6-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&_=1473258780393
"
,
dataType
:
"
script
"
,
cache
:
true
}).
done
(
function
(){
initMathJax
()})}}
if
(
hasFlow
){
var
initFlow
=
function
(){
$
(
"
.
"
+
className
+
"
code.lang-flow, .
"
+
className
+
"
code.language-flow
"
).
each
(
function
(
index
){
var
$it
=
$
(
this
);
var
id
=
"
symFlow
"
+
(
new
Date
()).
getTime
()
+
index
;
$it
.
hide
();
var
diagram
=
flowchart
.
parse
(
$
.
trim
(
$it
.
text
()));
$it
.
parent
().
after
(
'
<div style="text-align: center" id="
'
+
id
+
'
"></div>
'
);
diagram
.
drawSVG
(
id
);
$it
.
parent
().
remove
();
$
(
"
#
"
+
id
).
find
(
"
svg
"
).
height
(
"
auto
"
).
width
(
"
auto
"
)})};
if
(
typeof
(
flowchart
)
!==
"
undefined
"
){
initFlow
()}
else
{
$
.
ajax
({
method
:
"
GET
"
,
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/flowchart/flowchart.min.js
"
,
dataType
:
"
script
"
,
cache
:
true
}).
done
(
function
(){
initFlow
()})}}},
isLoggedIn
:
function
(){
if
((
$
(
"
#admin
"
).
length
===
1
&&
$
(
"
#admin
"
).
data
(
"
login
"
))
||
latkeConfig
.
isLoggedIn
===
"
true
"
){
return
true
}
else
{
return
false
}},
getUserName
:
function
(){
if
(
$
(
"
#adminName
"
).
length
===
1
){
return
$
(
"
#adminName
"
).
text
()}
else
{
return
latkeConfig
.
userName
}},
error
:
function
(){
$
(
"
#tipMsg
"
).
text
(
"
Error:
"
+
arguments
[
0
]
+
"
File:
"
+
arguments
[
1
]
+
"
\n
Line:
"
+
arguments
[
2
]
+
"
please report this issue on https://github.com/b3log/solo/issues/new
"
);
$
(
"
#loadMsg
"
).
text
(
""
)},
killIE
:
function
(){
var
addKillPanel
=
function
(){
if
(
Cookie
.
readCookie
(
"
showKill
"
)
===
""
){
var
left
=
(
$
(
window
).
width
()
-
701
)
/
2
,
top1
=
(
$
(
window
).
height
()
-
420
)
/
2
;
$
(
"
body
"
).
append
(
"
<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6; top: 0px;z-index:11'></div><iframe style='left:
"
+
left
+
"
px;z-index:20;top:
"
+
top1
+
"
px; position: fixed; border: 0px none; width: 701px; height: 420px;' src='
"
+
latkeConfig
.
servePath
+
"
/kill-browser'></iframe>
"
)}};
if
(
$
.
browser
.
msie
){
if
(
$
.
browser
.
version
===
"
6.0
"
||
$
.
browser
.
version
===
"
7.0
"
){
addKillPanel
();
return
}
if
(
window
.
external
&&
window
.
external
.
twGetRunPath
){
var
path
=
external
.
twGetRunPath
();
if
(
path
&&
path
.
toLowerCase
().
indexOf
(
"
360se
"
)
>-
1
&&
window
.
location
.
href
.
indexOf
(
"
admin-index
"
)
>-
1
){
addKillPanel
();
return
}}}},
replaceEmString
:
function
(
str
){
var
commentSplited
=
str
.
split
(
"
[em
"
);
if
(
commentSplited
.
length
===
1
){
return
str
}
str
=
commentSplited
[
0
];
for
(
var
j
=
1
;
j
<
commentSplited
.
length
;
j
++
){
var
key
=
commentSplited
[
j
].
substr
(
0
,
2
);
str
+=
"
<img width='20' src='
"
+
latkeConfig
.
staticServePath
+
"
/images/emotions/em
"
+
key
+
"
.png' alt='
"
+
Label
[
"
em
"
+
key
+
"
Label
"
]
+
"
' title='
"
+
Label
[
"
em
"
+
key
+
"
Label
"
]
+
"
'/>
"
+
commentSplited
[
j
].
substr
(
3
)}
return
str
},
proessURL
:
function
(
url
){
if
(
!
/^
\w
+:
\/\/
/
.
test
(
url
)){
url
=
"
http://
"
+
url
}
return
url
},
switchMobile
:
function
(
skin
){
Cookie
.
createCookie
(
"
btouch_switch_toggle
"
,
skin
,
365
);
setTimeout
(
function
(){
location
.
reload
()},
1250
)},
setTopBar
:
function
(){
var
$top
=
$
(
"
#top
"
);
if
(
$top
.
length
===
1
){
var
$showTop
=
$
(
"
#showTop
"
);
$showTop
.
click
(
function
(){
$top
.
slideDown
();
$showTop
.
hide
()});
$
(
"
#hideTop
"
).
click
(
function
(){
$top
.
slideUp
();
$showTop
.
show
()})}},
goTop
:
function
(){
$
(
"
html, body
"
).
animate
({
scrollTop
:
0
},
800
)},
goBottom
:
function
(
bottom
){
if
(
!
bottom
){
bottom
=
0
}
var
wHeight
=
$
(
"
body
"
).
height
()
>
$
(
document
).
height
()?
$
(
"
body
"
).
height
():
$
(
document
).
height
();
window
.
scrollTo
(
0
,
wHeight
-
$
(
window
).
height
()
-
bottom
)},
init
:
function
(){
Util
.
killIE
();
Util
.
setTopBar
();
Util
.
parseMarkdown
()},
replaceSideEm
:
function
(
comments
){
for
(
var
i
=
0
;
i
<
comments
.
length
;
i
++
){
var
$comment
=
$
(
comments
[
i
]);
$comment
.
html
(
Util
.
replaceEmString
(
$comment
.
html
()))}},
buildTags
:
function
(
id
){
id
=
id
||
"
tags
"
;
var
classes
=
[
"
tags1
"
,
"
tags2
"
,
"
tags3
"
,
"
tags4
"
,
"
tags5
"
],
bList
=
$
(
"
#
"
+
id
+
"
b
"
).
get
();
var
max
=
parseInt
(
$
(
"
#
"
+
id
+
"
b
"
).
last
().
text
());
var
distance
=
Math
.
ceil
(
max
/
classes
.
length
);
for
(
var
i
=
0
;
i
<
bList
.
length
;
i
++
){
var
num
=
parseInt
(
bList
[
i
].
innerHTML
);
for
(
var
j
=
0
;
j
<
classes
.
length
;
j
++
){
if
(
num
>
j
*
distance
&&
num
<=
(
j
+
1
)
*
distance
){
bList
[
i
].
parentNode
.
className
=
classes
[
j
];
break
}}}
$
(
"
#
"
+
id
).
html
(
$
(
"
#
"
+
id
+
"
li
"
).
get
().
sort
(
function
(
a
,
b
){
var
valA
=
$
(
a
).
find
(
"
span
"
).
text
().
toLowerCase
();
var
valB
=
$
(
b
).
find
(
"
span
"
).
text
().
toLowerCase
();
return
valA
.
localeCompare
(
valB
)}))},
toDate
:
function
(
time
,
format
){
var
dateTime
=
new
Date
(
time
);
var
o
=
{
"
M+
"
:
dateTime
.
getMonth
()
+
1
,
"
d+
"
:
dateTime
.
getDate
(),
"
H+
"
:
dateTime
.
getHours
(),
"
m+
"
:
dateTime
.
getMinutes
(),
"
s+
"
:
dateTime
.
getSeconds
(),
"
q+
"
:
Math
.
floor
((
dateTime
.
getMonth
()
+
3
)
/
3
),
S
:
dateTime
.
getMilliseconds
()};
if
(
/
(
y+
)
/
.
test
(
format
)){
format
=
format
.
replace
(
RegExp
.
$1
,(
dateTime
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
))}
for
(
var
k
in
o
){
if
(
new
RegExp
(
"
(
"
+
k
+
"
)
"
).
test
(
format
)){
format
=
format
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
==
1
?
o
[
k
]:(
"
00
"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
))}}
return
format
},
getWinHeight
:
function
(){
if
(
window
.
innerHeight
){
return
window
.
innerHeight
}
if
(
document
.
compatMode
===
"
CSS1Compat
"
){
return
window
.
document
.
documentElement
.
clientHeight
}
return
window
.
document
.
body
.
clientHeight
}};
if
(
!
Cookie
){
var
Cookie
=
{
readCookie
:
function
(
name
){
var
nameEQ
=
name
+
"
=
"
;
var
ca
=
document
.
cookie
.
split
(
"
;
"
);
for
(
var
i
=
0
;
i
<
ca
.
length
;
i
++
){
var
c
=
ca
[
i
];
while
(
c
.
charAt
(
0
)
==
"
"
){
c
=
c
.
substring
(
1
,
c
.
length
)}
if
(
c
.
indexOf
(
nameEQ
)
==
0
){
return
decodeURIComponent
(
c
.
substring
(
nameEQ
.
length
,
c
.
length
))}}
return
""
},
eraseCookie
:
function
(
name
){
this
.
createCookie
(
name
,
""
,
-
1
)},
createCookie
:
function
(
name
,
value
,
days
){
var
expires
=
""
;
if
(
days
){
var
date
=
new
Date
();
date
.
setTime
(
date
.
getTime
()
+
(
days
*
24
*
60
*
60
*
1000
));
expires
=
"
; expires=
"
+
date
.
toGMTString
()}
document
.
cookie
=
name
+
"
=
"
+
encodeURIComponent
(
value
)
+
expires
+
"
; path=/
"
}}};
\ No newline at end of file
var
Util
=
{
_isArticlePage
:
function
(
href
){
var
isArticle
=
true
;
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/tags/
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/tags.html
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/category/
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/archives.html
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/archives/
"
)
>-
1
){
isArticle
=
false
}
if
(
href
.
indexOf
(
latkeConfig
.
servePath
+
"
/links.html
"
)
>-
1
){
isArticle
=
false
}
if
(
href
===
latkeConfig
.
servePath
){
isArticle
=
false
}
if
(
/^
[
0-9
]
*$/
.
test
(
href
.
replace
(
latkeConfig
.
servePath
+
"
/
"
,
""
))){
isArticle
=
false
}
return
isArticle
},
initPjax
:
function
(
cb
,
articelCB
){
if
(
$
(
"
#pjax
"
).
length
===
1
){
$
.
pjax
({
selector
:
"
a
"
,
container
:
"
#pjax
"
,
show
:
""
,
cache
:
false
,
storage
:
true
,
titleSuffix
:
""
,
filter
:
function
(
href
){
if
(
href
.
indexOf
(
"
data:image
"
)
>-
1
){
return
true
}
return
Util
.
_isArticlePage
(
href
)},
callback
:
function
(){
cb
()}});
NProgress
.
configure
({
showSpinner
:
false
});
$
(
"
#pjax
"
).
bind
(
"
pjax.start
"
,
function
(){
NProgress
.
start
()});
$
(
"
#pjax
"
).
bind
(
"
pjax.end
"
,
function
(){
NProgress
.
done
()});
return
}
if
(
$
(
"
#pjaxArticle
"
).
length
===
1
){
$
.
pjax
({
selector
:
"
a
"
,
container
:
"
#pjaxArticle
"
,
show
:
""
,
cache
:
false
,
storage
:
true
,
titleSuffix
:
""
,
filter
:
function
(
href
){
if
(
href
.
indexOf
(
"
data:image
"
)
>-
1
){
return
true
}
return
!
Util
.
_isArticlePage
(
href
)},
callback
:
function
(){
articelCB
()}});
NProgress
.
configure
({
showSpinner
:
false
});
$
(
"
#pjaxArticle
"
).
bind
(
"
pjax.start
"
,
function
(){
NProgress
.
start
()});
$
(
"
#pjaxArticle
"
).
bind
(
"
pjax.end
"
,
function
(){
NProgress
.
done
()});
return
}},
parseMarkdown
:
function
(
className
){
var
hasMathJax
=
false
;
var
hasFlow
=
false
;
var
className
=
className
||
"
article-body
"
;
$
(
"
.
"
+
className
).
each
(
function
(){
$
(
this
).
find
(
"
p
"
).
each
(
function
(){
if
(
$
(
this
).
text
().
indexOf
(
"
$
\\
"
)
>-
1
||
$
(
this
).
text
().
indexOf
(
"
$$
"
)
>-
1
){
hasMathJax
=
true
}});
if
(
$
(
this
).
find
(
"
code.lang-flow, code.language-flow
"
).
length
>
0
){
hasFlow
=
true
}});
if
(
hasMathJax
){
var
initMathJax
=
function
(){
MathJax
.
Hub
.
Config
({
tex2jax
:{
inlineMath
:[[
"
$
"
,
"
$
"
],[
"
\\
(
"
,
"
\\
)
"
]],
displayMath
:[[
"
$$
"
,
"
$$
"
]],
processEscapes
:
true
,
processEnvironments
:
true
,
skipTags
:[
"
pre
"
,
"
code
"
,
"
script
"
]}});
MathJax
.
Hub
.
Typeset
()};
if
(
typeof
MathJax
!==
"
undefined
"
){
initMathJax
()}
else
{
$
.
ajax
({
method
:
"
GET
"
,
url
:
"
https://cdn.staticfile.org/MathJax/MathJax-2.6-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&_=1473258780393
"
,
dataType
:
"
script
"
,
cache
:
true
}).
done
(
function
(){
initMathJax
()})}}
if
(
hasFlow
){
var
initFlow
=
function
(){
$
(
"
.
"
+
className
+
"
code.lang-flow, .
"
+
className
+
"
code.language-flow
"
).
each
(
function
(
index
){
var
$it
=
$
(
this
);
var
id
=
"
symFlow
"
+
(
new
Date
()).
getTime
()
+
index
;
$it
.
hide
();
var
diagram
=
flowchart
.
parse
(
$
.
trim
(
$it
.
text
()));
$it
.
parent
().
after
(
'
<div style="text-align: center" id="
'
+
id
+
'
"></div>
'
);
diagram
.
drawSVG
(
id
);
$it
.
parent
().
remove
();
$
(
"
#
"
+
id
).
find
(
"
svg
"
).
height
(
"
auto
"
).
width
(
"
auto
"
)})};
if
(
typeof
(
flowchart
)
!==
"
undefined
"
){
initFlow
()}
else
{
$
.
ajax
({
method
:
"
GET
"
,
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/flowchart/flowchart.min.js
"
,
dataType
:
"
script
"
,
cache
:
true
}).
done
(
function
(){
initFlow
()})}}},
isLoggedIn
:
function
(){
if
((
$
(
"
#admin
"
).
length
===
1
&&
$
(
"
#admin
"
).
data
(
"
login
"
))
||
latkeConfig
.
isLoggedIn
===
"
true
"
){
return
true
}
else
{
return
false
}},
getUserName
:
function
(){
if
(
$
(
"
#adminName
"
).
length
===
1
){
return
$
(
"
#adminName
"
).
text
()}
else
{
return
latkeConfig
.
userName
}},
error
:
function
(){
$
(
"
#tipMsg
"
).
text
(
"
Error:
"
+
arguments
[
0
]
+
"
File:
"
+
arguments
[
1
]
+
"
\n
Line:
"
+
arguments
[
2
]
+
"
please report this issue on https://github.com/b3log/solo/issues/new
"
);
$
(
"
#loadMsg
"
).
text
(
""
)},
killIE
:
function
(){
var
addKillPanel
=
function
(){
if
(
Cookie
.
readCookie
(
"
showKill
"
)
===
""
){
var
left
=
(
$
(
window
).
width
()
-
701
)
/
2
,
top1
=
(
$
(
window
).
height
()
-
420
)
/
2
;
$
(
"
body
"
).
append
(
"
<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6; top: 0px;z-index:11'></div><iframe style='left:
"
+
left
+
"
px;z-index:20;top:
"
+
top1
+
"
px; position: fixed; border: 0px none; width: 701px; height: 420px;' src='
"
+
latkeConfig
.
servePath
+
"
/kill-browser'></iframe>
"
)}};
if
(
$
.
browser
.
msie
){
if
(
$
.
browser
.
version
===
"
6.0
"
||
$
.
browser
.
version
===
"
7.0
"
){
addKillPanel
();
return
}
if
(
window
.
external
&&
window
.
external
.
twGetRunPath
){
var
path
=
external
.
twGetRunPath
();
if
(
path
&&
path
.
toLowerCase
().
indexOf
(
"
360se
"
)
>-
1
&&
window
.
location
.
href
.
indexOf
(
"
admin-index
"
)
>-
1
){
addKillPanel
();
return
}}}},
replaceEmString
:
function
(
str
){
var
commentSplited
=
str
.
split
(
"
[em
"
);
if
(
commentSplited
.
length
===
1
){
return
str
}
str
=
commentSplited
[
0
];
for
(
var
j
=
1
;
j
<
commentSplited
.
length
;
j
++
){
var
key
=
commentSplited
[
j
].
substr
(
0
,
2
);
str
+=
"
<img width='20' src='
"
+
latkeConfig
.
staticServePath
+
"
/images/emotions/em
"
+
key
+
"
.png' alt='
"
+
Label
[
"
em
"
+
key
+
"
Label
"
]
+
"
' title='
"
+
Label
[
"
em
"
+
key
+
"
Label
"
]
+
"
'/>
"
+
commentSplited
[
j
].
substr
(
3
)}
return
str
},
proessURL
:
function
(
url
){
if
(
!
/^
\w
+:
\/\/
/
.
test
(
url
)){
url
=
"
http://
"
+
url
}
return
url
},
switchMobile
:
function
(
skin
){
Cookie
.
createCookie
(
"
btouch_switch_toggle
"
,
skin
,
365
);
setTimeout
(
function
(){
location
.
reload
()},
1250
)},
setTopBar
:
function
(){
var
$top
=
$
(
"
#top
"
);
if
(
$top
.
length
===
1
){
var
$showTop
=
$
(
"
#showTop
"
);
$showTop
.
click
(
function
(){
$top
.
slideDown
();
$showTop
.
hide
()});
$
(
"
#hideTop
"
).
click
(
function
(){
$top
.
slideUp
();
$showTop
.
show
()})}},
goTop
:
function
(){
$
(
"
html, body
"
).
animate
({
scrollTop
:
0
},
800
)},
goBottom
:
function
(
bottom
){
if
(
!
bottom
){
bottom
=
0
}
var
wHeight
=
$
(
"
body
"
).
height
()
>
$
(
document
).
height
()?
$
(
"
body
"
).
height
():
$
(
document
).
height
();
window
.
scrollTo
(
0
,
wHeight
-
$
(
window
).
height
()
-
bottom
)},
init
:
function
(){
Util
.
killIE
();
Util
.
setTopBar
();
Util
.
parseMarkdown
()},
replaceSideEm
:
function
(
comments
){
for
(
var
i
=
0
;
i
<
comments
.
length
;
i
++
){
var
$comment
=
$
(
comments
[
i
]);
$comment
.
html
(
Util
.
replaceEmString
(
$comment
.
html
()))}},
buildTags
:
function
(
id
){
id
=
id
||
"
tags
"
;
var
classes
=
[
"
tags1
"
,
"
tags2
"
,
"
tags3
"
,
"
tags4
"
,
"
tags5
"
],
bList
=
$
(
"
#
"
+
id
+
"
b
"
).
get
();
var
max
=
parseInt
(
$
(
"
#
"
+
id
+
"
b
"
).
last
().
text
());
var
distance
=
Math
.
ceil
(
max
/
classes
.
length
);
for
(
var
i
=
0
;
i
<
bList
.
length
;
i
++
){
var
num
=
parseInt
(
bList
[
i
].
innerHTML
);
for
(
var
j
=
0
;
j
<
classes
.
length
;
j
++
){
if
(
num
>
j
*
distance
&&
num
<=
(
j
+
1
)
*
distance
){
bList
[
i
].
parentNode
.
className
=
classes
[
j
];
break
}}}
$
(
"
#
"
+
id
).
html
(
$
(
"
#
"
+
id
+
"
li
"
).
get
().
sort
(
function
(
a
,
b
){
var
valA
=
$
(
a
).
find
(
"
span
"
).
text
().
toLowerCase
();
var
valB
=
$
(
b
).
find
(
"
span
"
).
text
().
toLowerCase
();
return
valA
.
localeCompare
(
valB
)}))},
toDate
:
function
(
time
,
format
){
var
dateTime
=
new
Date
(
time
);
var
o
=
{
"
M+
"
:
dateTime
.
getMonth
()
+
1
,
"
d+
"
:
dateTime
.
getDate
(),
"
H+
"
:
dateTime
.
getHours
(),
"
m+
"
:
dateTime
.
getMinutes
(),
"
s+
"
:
dateTime
.
getSeconds
(),
"
q+
"
:
Math
.
floor
((
dateTime
.
getMonth
()
+
3
)
/
3
),
S
:
dateTime
.
getMilliseconds
()};
if
(
/
(
y+
)
/
.
test
(
format
)){
format
=
format
.
replace
(
RegExp
.
$1
,(
dateTime
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
))}
for
(
var
k
in
o
){
if
(
new
RegExp
(
"
(
"
+
k
+
"
)
"
).
test
(
format
)){
format
=
format
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
==
1
?
o
[
k
]:(
"
00
"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
))}}
return
format
},
getWinHeight
:
function
(){
if
(
window
.
innerHeight
){
return
window
.
innerHeight
}
if
(
document
.
compatMode
===
"
CSS1Compat
"
){
return
window
.
document
.
documentElement
.
clientHeight
}
return
window
.
document
.
body
.
clientHeight
}};
if
(
!
Cookie
){
var
Cookie
=
{
readCookie
:
function
(
name
){
var
nameEQ
=
name
+
"
=
"
;
var
ca
=
document
.
cookie
.
split
(
"
;
"
);
for
(
var
i
=
0
;
i
<
ca
.
length
;
i
++
){
var
c
=
ca
[
i
];
while
(
c
.
charAt
(
0
)
==
"
"
){
c
=
c
.
substring
(
1
,
c
.
length
)}
if
(
c
.
indexOf
(
nameEQ
)
==
0
){
return
decodeURIComponent
(
c
.
substring
(
nameEQ
.
length
,
c
.
length
))}}
return
""
},
eraseCookie
:
function
(
name
){
this
.
createCookie
(
name
,
""
,
-
1
)},
createCookie
:
function
(
name
,
value
,
days
){
var
expires
=
""
;
if
(
days
){
var
date
=
new
Date
();
date
.
setTime
(
date
.
getTime
()
+
(
days
*
24
*
60
*
60
*
1000
));
expires
=
"
; expires=
"
+
date
.
toGMTString
()}
document
.
cookie
=
name
+
"
=
"
+
encodeURIComponent
(
value
)
+
expires
+
"
; path=/
"
}}};
\ No newline at end of file
src/main/webapp/js/page.min.js
View file @
0b51ef74
/*
* Solo - A beautiful, simple, stable, fast Java blogging system.
* Copyright (c) 2010-2018, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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
.
title
+
"
"
,
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
+
key
.
length
);
oR
.
select
()}
else
{
$comment
[
0
].
setSelectionRange
(
endPosition
+
key
.
length
,
endPosition
+
key
.
length
)}})},
_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
.
initHighlighting
.
called
=
false
;
hljs
.
initHighlighting
()}})},
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
:
"
https://rhythm.b3log.org/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
){
$
(
"
#submitCommentButton
"
+
state
).
removeAttr
(
"
disabled
"
);
if
(
!
result
.
sc
){
$
(
"
#commentErrorTip
"
+
state
).
html
(
result
.
msg
);
$
(
"
#commentValidate
"
+
state
).
val
(
""
);
$
(
"
#captcha
"
+
state
).
click
();
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
(
Util
.
replaceEmString
(
result
.
cmtTpl
),
state
)}})}},
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/main/webapp/plugins/kanbanniang/assert/index.js
View file @
0b51ef74
...
...
@@ -67,7 +67,7 @@ var soloKanbanniang = {
});
$
(
'
#soloKanbanniangChange
'
).
click
(
function
()
{
loadlive2d
(
'
soloKanbanniang
'
,
latkeConfig
.
s
taticS
ervePath
+
loadlive2d
(
'
soloKanbanniang
'
,
latkeConfig
.
servePath
+
'
/plugins/kanbanniang/assert/model?t=
'
+
(
new
Date
()).
getTime
(),
soloKanbanniang
.
showMessage
(
'
我的新衣服好看嘛
'
,
3000
,
true
));
});
...
...
@@ -168,6 +168,6 @@ $(document).ready(function() {
soloKanbanniang
.
init
();
loadlive2d
(
'
soloKanbanniang
'
,
latkeConfig
.
s
taticS
ervePath
+
loadlive2d
(
'
soloKanbanniang
'
,
latkeConfig
.
servePath
+
'
/plugins/kanbanniang/assert/model?t=
'
+
(
new
Date
()).
getTime
());
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment