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
9ff689d7
Commit
9ff689d7
authored
Nov 19, 2012
by
Liang Ding
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.5.5' of github.com:b3log/b3log-solo into 0.5.5
parents
e1fc0c84
a9286462
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
642 additions
and
619 deletions
+642
-619
core/src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
...ain/java/org/b3log/solo/api/symphony/ArticleReceiver.java
+6
-2
core/src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
...ain/java/org/b3log/solo/api/symphony/CommentReceiver.java
+8
-4
core/src/main/java/org/b3log/solo/event/rhythm/ArticleSender.java
.../main/java/org/b3log/solo/event/rhythm/ArticleSender.java
+6
-6
core/src/main/java/org/b3log/solo/event/symphony/CommentSender.java
...ain/java/org/b3log/solo/event/symphony/CommentSender.java
+5
-5
core/src/main/java/org/b3log/solo/processor/FeedProcessor.java
...src/main/java/org/b3log/solo/processor/FeedProcessor.java
+20
-9
war/src/main/resources/lang_en_US.properties
war/src/main/resources/lang_en_US.properties
+2
-2
war/src/main/resources/lang_zh_CN.properties
war/src/main/resources/lang_zh_CN.properties
+2
-2
war/src/main/webapp/admin-preference.ftl
war/src/main/webapp/admin-preference.ftl
+3
-3
war/src/main/webapp/js/admin/latkeAdmin.js
war/src/main/webapp/js/admin/latkeAdmin.js
+567
-567
war/src/main/webapp/js/common.js
war/src/main/webapp/js/common.js
+22
-18
war/src/main/webapp/js/common.min.js
war/src/main/webapp/js/common.min.js
+1
-1
No files found.
core/src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
View file @
9ff689d7
...
...
@@ -42,7 +42,7 @@ import org.jsoup.Jsoup;
* Article receiver (from B3log Symphony).
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.
1, Oct 12
, 2012
* @version 1.0.0.
2, Nov 19
, 2012
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -131,8 +131,12 @@ public final class ArticleReceiver {
article
.
put
(
Common
.
POST_TO_COMMUNITY
,
false
);
article
.
put
(
Article
.
ARTICLE_COMMENTABLE
,
true
);
article
.
put
(
Article
.
ARTICLE_VIEW_PWD
,
""
);
String
content
=
article
.
getString
(
Article
.
ARTICLE_CONTENT
);
final
String
articleId
=
article
.
getString
(
Keys
.
OBJECT_ID
);
content
+=
"<br/><p><i>该文章同步自 <a href='http://symphony.b3log.org/article/"
+
articleId
+
"'>B3log 社区</a></i></p>"
;
article
.
put
(
Article
.
ARTICLE_CONTENT
,
content
);
final
String
articleId
=
articleMgmtService
.
addArticle
(
requestJSONObject
);
articleMgmtService
.
addArticle
(
requestJSONObject
);
ret
.
put
(
Keys
.
OBJECT_ID
,
articleId
);
ret
.
put
(
Keys
.
MSG
,
"add article succ"
);
...
...
core/src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
View file @
9ff689d7
...
...
@@ -65,7 +65,7 @@ import org.json.JSONObject;
* Comment receiver (from B3log Symphony).
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.
1, Oct 17
, 2012
* @version 1.0.0.
2, Nov 19
, 2012
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -130,6 +130,7 @@ public final class CommentReceiver {
* "comment": {
* "userB3Key": "",
* "oId": "",
* "commentSymphonyArticleId": "",
* "commentOnArticleId": "",
* "commentAuthorName": "",
* "commentAuthorEmail": "",
...
...
@@ -177,12 +178,15 @@ public final class CommentReceiver {
final
String
commentName
=
symphonyCmt
.
getString
(
"commentAuthorName"
);
final
String
commentEmail
=
symphonyCmt
.
getString
(
"commentAuthorEmail"
).
trim
().
toLowerCase
();
final
String
commentURL
=
"http://"
+
symphonyCmt
.
optString
(
"commentAuthorURL"
);
final
String
commentContent
=
symphonyCmt
.
getString
(
Comment
.
COMMENT_CONTENT
);
final
String
commentId
=
symphonyCmt
.
optString
(
Keys
.
OBJECT_ID
);
String
commentContent
=
symphonyCmt
.
getString
(
Comment
.
COMMENT_CONTENT
);
commentContent
+=
"<br/><p><i>该评论同步自 <a href='http://symphony.b3log.org/article/"
+
symphonyCmt
.
optString
(
"commentSymphonyArticleId"
)
+
"#"
+
commentId
+
"'>B3log 社区</a></i></p>"
;
final
String
originalCommentId
=
symphonyCmt
.
optString
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
);
// Step 1: Add comment
final
JSONObject
comment
=
new
JSONObject
();
JSONObject
originalComment
=
null
;
final
String
commentId
=
symphonyCmt
.
optString
(
Keys
.
OBJECT_ID
);
comment
.
put
(
Keys
.
OBJECT_ID
,
commentId
);
comment
.
put
(
Comment
.
COMMENT_NAME
,
commentName
);
comment
.
put
(
Comment
.
COMMENT_EMAIL
,
commentEmail
);
...
...
@@ -209,7 +213,7 @@ public final class CommentReceiver {
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
,
""
);
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
""
);
}
setCommentThumbnailURL
(
comment
);
ret
.
put
(
Comment
.
COMMENT_THUMBNAIL_URL
,
comment
.
getString
(
Comment
.
COMMENT_THUMBNAIL_URL
));
// Sets comment on article....
...
...
core/src/main/java/org/b3log/solo/event/rhythm/ArticleSender.java
View file @
9ff689d7
...
...
@@ -41,7 +41,7 @@ import org.json.JSONObject;
* This listener is responsible for sending article to B3log Rhythm.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.2.
2, Nov 2
, 2012
* @version 1.0.2.
3, Nov 19
, 2012
* @since 0.3.1
*/
public
final
class
ArticleSender
extends
AbstractEventListener
<
JSONObject
>
{
...
...
@@ -95,11 +95,11 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> {
}
final
String
blogHost
=
preference
.
getString
(
Preference
.
BLOG_HOST
).
toLowerCase
();
//
if (blogHost.contains("localhost")) {
//
LOGGER.log(Level.INFO, "Blog Solo runs on local server, so should not send this article[id={0}, title={1}] to Rhythm",
//
new Object[]{originalArticle.getString(Keys.OBJECT_ID), originalArticle.getString(Article.ARTICLE_TITLE)});
//
return;
//
}
if
(
blogHost
.
contains
(
"localhost"
))
{
LOGGER
.
log
(
Level
.
INFO
,
"Blog Solo runs on local server, so should not send this article[id={0}, title={1}] to Rhythm"
,
new
Object
[]{
originalArticle
.
getString
(
Keys
.
OBJECT_ID
),
originalArticle
.
getString
(
Article
.
ARTICLE_TITLE
)});
return
;
}
final
HTTPRequest
httpRequest
=
new
HTTPRequest
();
httpRequest
.
setURL
(
ADD_ARTICLE_URL
);
...
...
core/src/main/java/org/b3log/solo/event/symphony/CommentSender.java
View file @
9ff689d7
...
...
@@ -89,11 +89,11 @@ public final class CommentSender extends AbstractEventListener<JSONObject> {
}
final
String
blogHost
=
preference
.
getString
(
Preference
.
BLOG_HOST
).
toLowerCase
();
//
if (blogHost.contains("localhost")) {
//
LOGGER.log(Level.INFO, "Blog Solo runs on local server, so should not send this comment[id={0}] to Symphony",
// new Object[]{or
ginalComment.getString(Keys.OBJECT_ID)});
//
return;
//
}
if
(
blogHost
.
contains
(
"localhost"
))
{
LOGGER
.
log
(
Level
.
INFO
,
"Blog Solo runs on local server, so should not send this comment[id={0}] to Symphony"
,
new
Object
[]{
ori
ginalComment
.
getString
(
Keys
.
OBJECT_ID
)});
return
;
}
final
HTTPRequest
httpRequest
=
new
HTTPRequest
();
httpRequest
.
setURL
(
ADD_COMMENT_URL
);
...
...
core/src/main/java/org/b3log/solo/processor/FeedProcessor.java
View file @
9ff689d7
...
...
@@ -26,6 +26,9 @@ import javax.servlet.http.HttpServletResponse;
import
org.apache.commons.lang.StringEscapeUtils
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.CompositeFilter
;
import
org.b3log.latke.repository.CompositeFilterOperator
;
import
org.b3log.latke.repository.Filter
;
import
org.b3log.latke.repository.FilterOperator
;
import
org.b3log.latke.repository.PropertyFilter
;
import
org.b3log.latke.repository.Query
;
...
...
@@ -64,7 +67,7 @@ import org.json.JSONObject;
* Feed (Atom/RSS) processor.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.1.0.
1, Aug 2
, 2012
* @version 1.1.0.
2, Nov 15
, 2012
* @since 0.3.1
*/
@RequestProcessor
...
...
@@ -124,9 +127,12 @@ public final class FeedProcessor {
feed
.
setLink
(
"http://"
+
blogHost
+
"/blog-articles-feed.do"
);
feed
.
setId
(
"http://"
+
blogHost
+
"/"
);
final
List
<
Filter
>
filters
=
new
ArrayList
<
Filter
>();
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
));
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_VIEW_PWD
,
FilterOperator
.
EQUAL
,
""
));
final
Query
query
=
new
Query
().
setCurrentPageNum
(
1
).
setPageSize
(
ENTRY_OUTPUT_CNT
).
setFilter
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
)).
setFilter
(
new
CompositeFilter
(
CompositeFilterOperator
.
AND
,
filters
)).
addSort
(
Article
.
ARTICLE_UPDATE_DATE
,
SortDirection
.
DESCENDING
).
setPageCount
(
1
);
...
...
@@ -149,7 +155,7 @@ public final class FeedProcessor {
final
String
title
=
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_TITLE
));
entry
.
setTitle
(
title
);
final
String
summary
=
isFullContent
?
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_CONTENT
))
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
entry
.
setSummary
(
summary
);
final
Date
updated
=
(
Date
)
article
.
get
(
Article
.
ARTICLE_UPDATE_DATE
);
entry
.
setUpdated
(
updated
);
...
...
@@ -249,7 +255,8 @@ public final class FeedProcessor {
final
JSONObject
tagArticleRelation
=
tagArticleRelations
.
getJSONObject
(
i
);
final
String
articleId
=
tagArticleRelation
.
getString
(
Article
.
ARTICLE
+
"_"
+
Keys
.
OBJECT_ID
);
final
JSONObject
article
=
articleRepository
.
get
(
articleId
);
if
(
article
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
))
{
// Skips the unpublished article
if
(
article
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
)
// Skips the unpublished article
&&
Strings
.
isEmptyOrNull
(
article
.
optString
(
Article
.
ARTICLE_VIEW_PWD
)))
{
// Skips article with password
articles
.
add
(
article
);
}
}
...
...
@@ -270,7 +277,7 @@ public final class FeedProcessor {
final
String
title
=
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_TITLE
));
entry
.
setTitle
(
title
);
final
String
summary
=
isFullContent
?
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_CONTENT
))
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
entry
.
setSummary
(
summary
);
final
Date
updated
=
(
Date
)
article
.
get
(
Article
.
ARTICLE_UPDATE_DATE
);
entry
.
setUpdated
(
updated
);
...
...
@@ -339,9 +346,12 @@ public final class FeedProcessor {
channel
.
setLanguage
(
language
+
'-'
+
country
);
channel
.
setDescription
(
blogSubtitle
);
final
List
<
Filter
>
filters
=
new
ArrayList
<
Filter
>();
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
));
filters
.
add
(
new
PropertyFilter
(
Article
.
ARTICLE_VIEW_PWD
,
FilterOperator
.
EQUAL
,
""
));
final
Query
query
=
new
Query
().
setCurrentPageNum
(
1
).
setPageSize
(
ENTRY_OUTPUT_CNT
).
setFilter
(
new
PropertyFilter
(
Article
.
ARTICLE_IS_PUBLISHED
,
FilterOperator
.
EQUAL
,
true
)).
setFilter
(
new
CompositeFilter
(
CompositeFilterOperator
.
AND
,
filters
)).
addSort
(
Article
.
ARTICLE_UPDATE_DATE
,
SortDirection
.
DESCENDING
).
setPageCount
(
1
);
...
...
@@ -364,7 +374,7 @@ public final class FeedProcessor {
final
String
title
=
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_TITLE
));
item
.
setTitle
(
title
);
final
String
description
=
isFullContent
?
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_CONTENT
))
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
item
.
setDescription
(
description
);
final
Date
pubDate
=
(
Date
)
article
.
get
(
Article
.
ARTICLE_UPDATE_DATE
);
item
.
setPubDate
(
pubDate
);
...
...
@@ -467,7 +477,8 @@ public final class FeedProcessor {
final
JSONObject
tagArticleRelation
=
tagArticleRelations
.
getJSONObject
(
i
);
final
String
articleId
=
tagArticleRelation
.
getString
(
Article
.
ARTICLE
+
"_"
+
Keys
.
OBJECT_ID
);
final
JSONObject
article
=
articleRepository
.
get
(
articleId
);
if
(
article
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
))
{
// Skips the unpublished article
if
(
article
.
getBoolean
(
Article
.
ARTICLE_IS_PUBLISHED
)
// Skips the unpublished article
&&
Strings
.
isEmptyOrNull
(
article
.
optString
(
Article
.
ARTICLE_VIEW_PWD
)))
{
// Skips article with password
articles
.
add
(
article
);
}
}
...
...
@@ -488,7 +499,7 @@ public final class FeedProcessor {
final
String
title
=
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_TITLE
));
item
.
setTitle
(
title
);
final
String
description
=
isFullContent
?
StringEscapeUtils
.
escapeXml
(
article
.
getString
(
Article
.
ARTICLE_CONTENT
))
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
:
StringEscapeUtils
.
escapeXml
(
article
.
optString
(
Article
.
ARTICLE_ABSTRACT
));
item
.
setDescription
(
description
);
final
Date
pubDate
=
(
Date
)
article
.
get
(
Article
.
ARTICLE_UPDATE_DATE
);
item
.
setPubDate
(
pubDate
);
...
...
war/src/main/resources/lang_en_US.properties
View file @
9ff689d7
...
...
@@ -16,7 +16,7 @@
#
# Description: B3log Solo language configurations(en_US).
# Version: 2.1.0.
0, Sep 19
, 2012
# Version: 2.1.0.
1, Nov 14
, 2012
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
...
...
@@ -257,7 +257,7 @@ abstractLabel=Abstract
fullContentLabel
=
Full Content
author1Label
=
Author:
authorLabel
=
Author
keyOfSolo1Label
=
Solo
Key:
keyOfSolo1Label
=
B3log
Key:
articleLabel
=
Article
tagArticlesLabel
=
Tag Articles
dateArticlesLabel
=
Archive Date Articles
...
...
war/src/main/resources/lang_zh_CN.properties
View file @
9ff689d7
...
...
@@ -16,7 +16,7 @@
#
# Description: B3log Solo default language configurations(zh_CN).
# Version: 2.1.0.
6, Sep 7
, 2012
# Version: 2.1.0.
7, Nov 14
, 2012
# Author: Liang Ding
# Author: Liyuan Li
# Author: Dongxu Wang
...
...
@@ -257,7 +257,7 @@ abstractLabel=\u6458\u8981
fullContentLabel=
\u5168\u6587
author1Label=
\u
4f5c
\u8005\u
ff1a
authorLabel
=
\u
4f5c
\u8005
keyOfSolo1Label=
Solo
Key
\u
ff1a
keyOfSolo1Label=
B3log
Key
\u
ff1a
articleLabel
=
\u6587\u
7ae0
tagArticlesLabel
=
\u6807\u
7b7e
\u6587\u
7ae0
\u5217\u8868
dateArticlesLabel=
\u
5b58
\u6863\u6587\u
7ae0
\u5217\u8868
...
...
war/src/main/webapp/admin-preference.ftl
View file @
9ff689d7
...
...
@@ -20,11 +20,11 @@
<a href="#tools/preference/setting">${paramSettingsLabel}</a>
</div>
</li>
<
!--
li>
<li>
<div id="tabPreference_solo">
<a href="#tools/preference/solo">
Solo
</a>
<a href="#tools/preference/solo">
B3log
</a>
</div>
</li
--
>
</li>
</ul>
</div>
<div id="tabPreferencePanel" class="sub-tabs-main">
...
...
war/src/main/webapp/js/admin/latkeAdmin.js
View file @
9ff689d7
This diff is collapsed.
Click to expand it.
war/src/main/webapp/js/common.js
View file @
9ff689d7
...
...
@@ -19,7 +19,7 @@
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.2.
3, Aug 24
, 2012
* @version 1.0.2.
4, Nov 13
, 2012
*/
/**
...
...
@@ -234,23 +234,27 @@ var Util = {
* @returns {String} 格式化后的时间
*/
toDate
:
function
(
time
,
format
)
{
var
dateTime
=
new
Date
(
time
),
formatDate
;
var
year
=
dateTime
.
getFullYear
(),
month
=
dateTime
.
getMonth
()
+
1
,
date
=
dateTime
.
getDate
(),
hour
=
dateTime
.
getHours
()
+
1
,
minute
=
dateTime
.
getMinutes
()
+
1
;
switch
(
format
)
{
case
"
yy-MM-dd HH:mm
"
:
formatDate
=
year
.
toString
().
substr
(
2
)
+
"
-
"
+
month
+
"
-
"
+
date
+
"
"
+
hour
+
"
:
"
+
minute
;
break
;
default
:
break
;
}
return
formatDate
;
var
dateTime
=
new
Date
(
time
);
var
o
=
{
"
M+
"
:
dateTime
.
getMonth
()
+
1
,
//month
"
d+
"
:
dateTime
.
getDate
(),
//day
"
H+
"
:
dateTime
.
getHours
(),
//hour
"
m+
"
:
dateTime
.
getMinutes
(),
//minute
"
s+
"
:
dateTime
.
getSeconds
(),
//second
"
q+
"
:
Math
.
floor
((
dateTime
.
getMonth
()
+
3
)
/
3
),
//quarter
"
S
"
:
dateTime
.
getMilliseconds
()
//millisecond
}
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
;
}
};
...
...
war/src/main/webapp/js/common.min.js
View file @
9ff689d7
...
...
@@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
Util
=
{
error
:
function
(){
$
(
"
#tipMsg
"
).
text
(
"
Error:
"
+
arguments
[
0
]
+
"
File:
"
+
arguments
[
1
]
+
"
\n
Line:
"
+
arguments
[
2
]
+
"
please report this issue on https://github.com/b3log/b3log-solo/issues/new
"
);
$
(
"
#loadMsg
"
).
text
(
""
)},
killIE
:
function
(){
if
(
$
.
browser
.
msie
){
if
(
$
.
browser
.
version
===
"
6.0
"
||
$
.
browser
.
version
===
"
7.0
"
){
window
.
location
=
latkeConfig
.
servePath
+
"
/kill-browser.html
"
;
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
){
window
.
location
=
latkeConfig
.
servePath
+
"
/kill-browser.html
"
;
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 src='
"
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
Label
.
skinDirName
+
"
/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
(){
var
acceleration
=
acceleration
||
0.1
;
var
y
=
$
(
window
).
scrollTop
();
var
speed
=
1
+
acceleration
;
window
.
scrollTo
(
0
,
Math
.
floor
(
y
/
speed
));
if
(
y
>
0
){
var
invokeFunction
=
"
Util.goTop(
"
+
acceleration
+
"
)
"
;
window
.
setTimeout
(
invokeFunction
,
16
)}},
goBottom
:
function
(
bottom
){
if
(
!
bottom
){
bottom
=
0
}
window
.
scrollTo
(
0
,
$
(
"
body
"
).
height
()
-
$
(
window
).
height
()
-
bottom
)},
init
:
function
(){
Util
.
killIE
();
Util
.
setTopBar
()},
clearCache
:
function
(
all
){
var
data
=
""
;
if
(
all
===
"
all
"
){
data
=
'
{"all": "all", "URI": ""}
'
}
else
{
data
=
'
{"all": "all", "URI": "
'
+
window
.
location
.
pathname
+
'
"}
'
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
latkeConfig
.
servePath
+
"
/clear-cache.do
"
,
cache
:
false
,
contentType
:
"
application/json
"
,
data
:
data
,
success
:
function
(
result
){
window
.
location
.
reload
()}})},
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
),
formatDate
;
var
year
=
dateTime
.
getFullYear
(),
month
=
dateTime
.
getMonth
()
+
1
,
date
=
dateTime
.
getDate
(),
hour
=
dateTime
.
getHours
()
+
1
,
minute
=
dateTime
.
getMinutes
()
+
1
;
switch
(
format
){
case
"
yy-MM-dd HH:mm
"
:
formatDate
=
year
.
toString
().
substr
(
2
)
+
"
-
"
+
month
+
"
-
"
+
date
+
"
"
+
hour
+
"
:
"
+
minute
;
break
;
default
:
break
}
return
formatDate
}};
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
=
{
error
:
function
(){
$
(
"
#tipMsg
"
).
text
(
"
Error:
"
+
arguments
[
0
]
+
"
File:
"
+
arguments
[
1
]
+
"
\n
Line:
"
+
arguments
[
2
]
+
"
please report this issue on https://github.com/b3log/b3log-solo/issues/new
"
);
$
(
"
#loadMsg
"
).
text
(
""
)},
killIE
:
function
(){
if
(
$
.
browser
.
msie
){
if
(
$
.
browser
.
version
===
"
6.0
"
||
$
.
browser
.
version
===
"
7.0
"
){
window
.
location
=
latkeConfig
.
servePath
+
"
/kill-browser.html
"
;
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
){
window
.
location
=
latkeConfig
.
servePath
+
"
/kill-browser.html
"
;
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 src='
"
+
latkeConfig
.
staticServePath
+
"
/skins/
"
+
Label
.
skinDirName
+
"
/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
(){
var
acceleration
=
acceleration
||
0.1
;
var
y
=
$
(
window
).
scrollTop
();
var
speed
=
1
+
acceleration
;
window
.
scrollTo
(
0
,
Math
.
floor
(
y
/
speed
));
if
(
y
>
0
){
var
invokeFunction
=
"
Util.goTop(
"
+
acceleration
+
"
)
"
;
window
.
setTimeout
(
invokeFunction
,
16
)}},
goBottom
:
function
(
bottom
){
if
(
!
bottom
){
bottom
=
0
}
window
.
scrollTo
(
0
,
$
(
"
body
"
).
height
()
-
$
(
window
).
height
()
-
bottom
)},
init
:
function
(){
Util
.
killIE
();
Util
.
setTopBar
()},
clearCache
:
function
(
all
){
var
data
=
""
;
if
(
all
===
"
all
"
){
data
=
'
{"all": "all", "URI": ""}
'
}
else
{
data
=
'
{"all": "all", "URI": "
'
+
window
.
location
.
pathname
+
'
"}
'
}
$
.
ajax
({
type
:
"
POST
"
,
url
:
latkeConfig
.
servePath
+
"
/clear-cache.do
"
,
cache
:
false
,
contentType
:
"
application/json
"
,
data
:
data
,
success
:
function
(
result
){
window
.
location
.
reload
()}})},
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
}};
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
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