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
d44d2f5b
Commit
d44d2f5b
authored
Oct 26, 2013
by
Vanessa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
评论获取用户名修改
parent
7aa15afe
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
102 deletions
+113
-102
war/src/main/webapp/js/page.js
war/src/main/webapp/js/page.js
+16
-12
war/src/main/webapp/js/page.min.js
war/src/main/webapp/js/page.min.js
+1
-1
war/src/main/webapp/skins/ease/macro-comments.ftl
war/src/main/webapp/skins/ease/macro-comments.ftl
+10
-6
war/src/main/webapp/skins/mobile/header.ftl
war/src/main/webapp/skins/mobile/header.ftl
+1
-1
war/src/main/webapp/skins/mobile/macro-comments.ftl
war/src/main/webapp/skins/mobile/macro-comments.ftl
+85
-82
No files found.
war/src/main/webapp/js/page.js
View file @
d44d2f5b
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
*
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.3.
4, Sep 12
, 2013
* @version 1.0.3.
5, Oct 26
, 2013
*/
*/
var
Page
=
function
(
tips
)
{
var
Page
=
function
(
tips
)
{
this
.
currentCommentId
=
""
;
this
.
currentCommentId
=
""
;
...
@@ -265,7 +265,7 @@ $.extend(Page.prototype, {
...
@@ -265,7 +265,7 @@ $.extend(Page.prototype, {
}
}
}
}
// code high lighter
// code high lighter
SyntaxHighlighter
.
autoloader
.
apply
(
null
,
languages
);
SyntaxHighlighter
.
autoloader
.
apply
(
null
,
languages
);
SyntaxHighlighter
.
config
.
stripBrs
=
true
;
SyntaxHighlighter
.
config
.
stripBrs
=
true
;
SyntaxHighlighter
.
all
();
SyntaxHighlighter
.
all
();
...
@@ -285,13 +285,13 @@ $.extend(Page.prototype, {
...
@@ -285,13 +285,13 @@ $.extend(Page.prototype, {
+
cssName
+
"
.css' type='text/css' charset='utf-8' />
"
));
+
cssName
+
"
.css' type='text/css' charset='utf-8' />
"
));
}
}
// load js
// load js
$
.
ajax
({
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shCore.js
"
,
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/SyntaxHighlighter/scripts/shCore.js
"
,
dataType
:
"
script
"
,
dataType
:
"
script
"
,
cache
:
true
,
cache
:
true
,
success
:
function
()
{
success
:
function
()
{
// get brush settings
// get brush settings
var
languages
=
[],
var
languages
=
[],
isScrip
=
false
;
isScrip
=
false
;
$
(
"
.article-body pre
"
).
each
(
function
()
{
$
(
"
.article-body pre
"
).
each
(
function
()
{
...
@@ -343,14 +343,14 @@ $.extend(Page.prototype, {
...
@@ -343,14 +343,14 @@ $.extend(Page.prototype, {
}
}
if
(
isPrettify
)
{
if
(
isPrettify
)
{
// load css
// load css
if
(
document
.
createStyleSheet
)
{
if
(
document
.
createStyleSheet
)
{
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.css
"
);
document
.
createStyleSheet
(
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.css
"
);
}
else
{
}
else
{
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.css'>
"
));
$
(
"
head
"
).
append
(
$
(
"
<link rel='stylesheet' href='
"
+
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.css'>
"
));
}
}
// load js
// load js
$
.
ajax
({
$
.
ajax
({
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.js
"
,
url
:
latkeConfig
.
staticServePath
+
"
/js/lib/google-code-prettify/prettify.js
"
,
dataType
:
"
script
"
,
dataType
:
"
script
"
,
...
@@ -510,7 +510,7 @@ $.extend(Page.prototype, {
...
@@ -510,7 +510,7 @@ $.extend(Page.prototype, {
}
}
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
// 忽略相关文章加载异常:load script error
// 忽略相关文章加载异常:load script error
}
}
},
},
/*
/*
...
@@ -536,10 +536,7 @@ $.extend(Page.prototype, {
...
@@ -536,10 +536,7 @@ $.extend(Page.prototype, {
"
oId
"
:
tips
.
oId
,
"
oId
"
:
tips
.
oId
,
"
commentContent
"
:
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
)
"
commentContent
"
:
$
(
"
#comment
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
)
};
};
if
(
state
===
"
Reply
"
)
{
requestJSONObject
.
commentOriginalCommentId
=
commentId
;
}
if
(
!
$
(
"
#admin
"
).
data
(
"
login
"
))
{
if
(
!
$
(
"
#admin
"
).
data
(
"
login
"
))
{
requestJSONObject
=
{
requestJSONObject
=
{
"
oId
"
:
tips
.
oId
,
"
oId
"
:
tips
.
oId
,
...
@@ -553,6 +550,11 @@ $.extend(Page.prototype, {
...
@@ -553,6 +550,11 @@ $.extend(Page.prototype, {
Cookie
.
createCookie
(
"
commentEmail
"
,
requestJSONObject
.
commentEmail
,
365
);
Cookie
.
createCookie
(
"
commentEmail
"
,
requestJSONObject
.
commentEmail
,
365
);
Cookie
.
createCookie
(
"
commentURL
"
,
$
(
"
#commentURL
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
365
);
Cookie
.
createCookie
(
"
commentURL
"
,
$
(
"
#commentURL
"
+
state
).
val
().
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
""
),
365
);
}
}
if
(
state
===
"
Reply
"
)
{
requestJSONObject
.
commentOriginalCommentId
=
commentId
;
}
$
.
ajax
({
$
.
ajax
({
type
:
"
POST
"
,
type
:
"
POST
"
,
url
:
latkeConfig
.
servePath
+
"
/add-
"
+
type
+
"
-comment.do
"
,
url
:
latkeConfig
.
servePath
+
"
/add-
"
+
type
+
"
-comment.do
"
,
...
@@ -579,9 +581,11 @@ $.extend(Page.prototype, {
...
@@ -579,9 +581,11 @@ $.extend(Page.prototype, {
result
.
replyNameHTML
=
'
<a href="
'
+
Util
.
proessURL
(
$
(
"
#commentURL
"
+
state
).
val
())
+
result
.
replyNameHTML
=
'
<a href="
'
+
Util
.
proessURL
(
$
(
"
#commentURL
"
+
state
).
val
())
+
'
" target="_blank">
'
+
$
(
"
#commentName
"
+
state
).
val
()
+
'
</a>
'
;
'
" target="_blank">
'
+
$
(
"
#commentName
"
+
state
).
val
()
+
'
</a>
'
;
}
}
result
.
userName
=
$
(
"
#commentName
"
+
state
).
val
();
}
else
{
}
else
{
result
.
replyNameHTML
=
'
<a href="
'
+
window
.
location
.
host
+
result
.
replyNameHTML
=
'
<a href="
'
+
window
.
location
.
host
+
'
" target="_blank">
'
+
$
(
"
#adminName
"
).
val
()
+
'
</a>
'
;
'
" target="_blank">
'
+
$
(
"
#adminName
"
).
text
()
+
'
</a>
'
;
result
.
userName
=
$
(
"
#adminName
"
).
text
();
}
}
that
.
addCommentAjax
(
addComment
(
result
,
state
),
state
);
that
.
addCommentAjax
(
addComment
(
result
,
state
),
state
);
...
...
war/src/main/webapp/js/page.min.js
View file @
d44d2f5b
This diff is collapsed.
Click to expand it.
war/src/main/webapp/skins/ease/macro-comments.ftl
View file @
d44d2f5b
...
@@ -124,14 +124,18 @@
...
@@ -124,14 +124,18 @@
var addComment = function(result, state) {
var addComment = function(result, state) {
var commentHTML = '<div id="' + result.oId + '"><img class="comment-header" \
var commentHTML = '<div id="' + result.oId + '"><img class="comment-header" \
title="' + $("#commentName" + state).val() + '" alt="' + $("#commentName" + state).val() +
title="' + result.userName + '" alt="' + result.userName +
'" src="' + result.commentThumbnailURL + '"/><div class="comment-panel"><div class="left">' + result.replyNameHTML;
'" src="' + result.commentThumbnailURL
+ '"/><div class="comment-panel"><div class="left">' + result.replyNameHTML;
if (state !== "") {
if (state !== "") {
var commentOriginalCommentName = $("#" + page.currentCommentId + " .comment-panel>.left a").first().text();
var commentOriginalCommentName = $("#" + page.currentCommentId
commentHTML += ' @ <a href="${servePath}' + result.commentSharpURL.split("#")[0] + '#' + page.currentCommentId + '"'
+ " .comment-panel>.left a").first().text();
commentHTML += ' @ <a href="${servePath}'
+ result.commentSharpURL.split("#")[0] + '#' + page.currentCommentId + '"'
+ 'onmouseover="page.showComment(this, \'' + page.currentCommentId + '\', 20);"'
+ 'onmouseover="page.showComment(this, \'' + page.currentCommentId + '\', 20);"'
+ 'onmouseout="page.hideComment(\'' + page.currentCommentId + '\')">' + commentOriginalCommentName + '</a>';
+ 'onmouseout="page.hideComment(\'' + page.currentCommentId + '\')">'
+ commentOriginalCommentName + '</a>';
}
}
commentHTML += '</div><div class="right ft-gray">' + result.commentDate.substring(2, 16)
commentHTML += '</div><div class="right ft-gray">' + result.commentDate.substring(2, 16)
...
@@ -141,7 +145,7 @@
...
@@ -141,7 +145,7 @@
+ '</div></div><span class="clear"></span></div>';
+ '</div></div><span class="clear"></span></div>';
return commentHTML;
return commentHTML;
}
}
;
var replyTo = function(id) {
var replyTo = function(id) {
var commentFormHTML = "<table class='form' id='replyForm'>";
var commentFormHTML = "<table class='form' id='replyForm'>";
...
...
war/src/main/webapp/skins/mobile/header.ftl
View file @
d44d2f5b
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
</div>
</div>
<ul id="head-pages">
<ul id="head-pages">
<li><a href="${servePath}/admin-index.do#main"><img src="${staticServePath}/skins/${skinDirName}/images/icon-pool/Home.png" alt=""/>Admin</a></li>
<li
id="admin" data-login="${isLoggedIn?string}"
><a href="${servePath}/admin-index.do#main"><img src="${staticServePath}/skins/${skinDirName}/images/icon-pool/Home.png" alt=""/>Admin</a></li>
<#list pageNavigations as page>
<#list pageNavigations as page>
<li><a href="${page.pagePermalink}" target="${page.pageOpenTarget}"><img src="${staticServePath}/skins/${skinDirName}/images/icon-pool/Apps.png" alt=""/>${page.pageTitle}</a></li>
<li><a href="${page.pagePermalink}" target="${page.pageOpenTarget}"><img src="${staticServePath}/skins/${skinDirName}/images/icon-pool/Apps.png" alt=""/>${page.pageTitle}</a></li>
</#list>
</#list>
...
...
war/src/main/webapp/skins/mobile/macro-comments.ftl
View file @
d44d2f5b
...
@@ -90,94 +90,97 @@
...
@@ -90,94 +90,97 @@
<#macro comment_script oId>
<#macro comment_script oId>
<script type="text/javascript" src="${staticServePath}/js/page${miniPostfix}.js?${staticResourceVersion}" charset="utf-8"></script>
<script type="text/javascript" src="${staticServePath}/js/page${miniPostfix}.js?${staticResourceVersion}" charset="utf-8"></script>
<script type="text/javascript">
<script type="text/javascript">
Page.prototype.submitComment = function (commentId, state) {
Page.prototype.submitComment = function(commentId, state) {
if (!state) {
if (!state) {
state = '';
state = '';
}
var tips = this.tips,
type = "article";
if (tips.externalRelevantArticlesDisplayCount === undefined) {
type = "page";
}
if (this.validateComment(state)) {
$("#submitCommentButton" + state).attr("disabled", "disabled");
$("#commentErrorTip" + state).html(this.tips.loadingLabel);
var 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()
};
if (state === "Reply") {
requestJSONObject.commentOriginalCommentId = commentId;
}
}
var 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 (!$("#admin").data("login")) {
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);
}
$wpt("#loading").fadeIn(400);
if (state === "Reply") {
requestJSONObject.commentOriginalCommentId = commentId;
$.ajax({
}
type: "POST",
$.ajax({
url: "/add-" + type + "-comment.do",
type: "POST",
contentType: "application/json",
url: latkeConfig.servePath + "/add-" + type + "-comment.do",
data: JSON.stringify(requestJSONObject),
cache: false,
success: function(result){
contentType: "application/json",
$("#submitCommentButton" + state).removeAttr("disabled");
data: JSON.stringify(requestJSONObject),
success: function(result) {
$("#submitCommentButton" + state).removeAttr("disabled");
if (!result.sc) {
if (!result.sc) {
$("#commentValidate" + state).val("").focus();
$("#commentValidate" + state).val("").focus();
$("#commentErrorTip" + state).html(result.msg);
$("#commentErrorTip" + state).html(result.msg);
$("#captcha" + state).attr("src", "/captcha.do?code=" + Math.random());
$("#captcha" + state).attr("src", "/captcha.do?code=" + Math.random());
$wpt('#commentErrorTip' + state).show();
$wpt('#commentErrorTip' + state).show();
$wpt("#loading").fadeOut(400);
return;
}
$wpt("#commentForm").hide();
$wpt("#loading").fadeOut(400);
$wpt("#loading").fadeOut(400);
return;
$wpt("#refresher").fadeIn(400);
}
$("#comment" + state).val("");
$("#commentValidate" + state).val("");
$wpt("#commentForm").hide();
$("#replyForm").remove();
$wpt("#loading").fadeOut(400);
$wpt("#refresher").fadeIn(400);
}, // end success
$("#comment" + state).val("");
error: function() {
$("#commentValidate" + state).val("");
} //end error
$("#replyForm").remove();
});
}
}, // end success
error: function() {
};
} //end error
var replyTo = function(id) {
});
var commentFormHTML = "<div id='replyForm'>";
page.addReplyForm(id, commentFormHTML, "</div>");
};
Cookie.createCookie("commentName", requestJSONObject.commentName, 365);
var page = new Page({
Cookie.createCookie("commentEmail", requestJSONObject.commentEmail, 365);
"nameTooLongLabel": "${nameTooLongLabel}",
Cookie.createCookie("commentURL", $("#commentURL" + state).val().replace(/(^\s*)|(\s*$)/g, ""), 365);
"mailCannotEmptyLabel": "${mailCannotEmptyLabel}",
}
"mailInvalidLabel": "${mailInvalidLabel}",
};
"commentContentCannotEmptyLabel": "${commentContentCannotEmptyLabel}",
"captchaCannotEmptyLabel": "${captchaCannotEmptyLabel}",
var replyTo = function (id) {
"loadingLabel": "${loadingLabel}",
var commentFormHTML = "<div id='replyForm'>";
"oId": "${oId}",
page.addReplyForm(id, commentFormHTML, "</div>");
"skinDirName": "${skinDirName}",
};
"blogHost": "${blogHost}",
"randomArticles1Label": "${randomArticles1Label}",
var page = new Page({
"externalRelevantArticles1Label": "${externalRelevantArticles1Label}"
"nameTooLongLabel": "${nameTooLongLabel}",
});
"mailCannotEmptyLabel": "${mailCannotEmptyLabel}",
"mailInvalidLabel": "${mailInvalidLabel}",
"commentContentCannotEmptyLabel": "${commentContentCannotEmptyLabel}",
"captchaCannotEmptyLabel": "${captchaCannotEmptyLabel}",
"loadingLabel": "${loadingLabel}",
"oId": "${oId}",
"skinDirName": "${skinDirName}",
"blogHost": "${blogHost}",
"randomArticles1Label": "${randomArticles1Label}",
"externalRelevantArticles1Label": "${externalRelevantArticles1Label}"
});
(function
() {
(function
() {
page.load();
page.load();
// emotions
// emotions
page.replaceCommentsEm("#commentlist .combody");
page.replaceCommentsEm("#commentlist .combody");
<#nested>
<#nested>
})();
})();
</script>
</script>
...
...
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