登录用户评论获取用户名方式修改

This commit is contained in:
Vanessa 2013-10-26 16:02:25 +08:00
parent 14523d121d
commit a9c4398824
15 changed files with 137 additions and 100 deletions

View File

@ -144,7 +144,7 @@
var commentHTML = '<div id="' + result.oId
+ '" class="comment-body ' + oddEven + '"><div class="comment-panel"><div class="left comment-author">'
+ '<img alt="' + $("#commentName" + state).val() + '" src="' + result.commentThumbnailURL
+ '<img alt="' + result.userName + '" src="' + result.commentThumbnailURL
+ '"/></div><div class="left comment-info">' + result.replyNameHTML;
if (state !== "") {

View File

@ -159,7 +159,7 @@
commentHTML += '<div class="right">' + result.commentDate
+ '&nbsp;<a class="no-underline" href="javascript:replyTo(\'' + result.oId + '\');">${replyLabel}</a>'
+ '</div><div class="clear"></div></div><div class="comment-body">'
+ '<div class="left comment-picture"><img alt="' + $("#commentName" + state).val()
+ '<div class="left comment-picture"><img alt="' + result.userName
+ '" src="' + result.commentThumbnailURL + '"/>'
+ '</div><div class="comment-content">' +
Util.replaceEmString($("#comment" + state).val().replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g,"<br/>"))

View File

@ -155,7 +155,7 @@
var addComment = function (result, state) {
var commentHTML = '<div id="' + result.oId + '">'
+ '<img class="left" alt="' + $("#commentName" + state).val() + '" src="' + result.commentThumbnailURL
+ '<img class="left" alt="' + result.userName + '" src="' + result.commentThumbnailURL
+ '"/><div class="comment-panel left"><div class="comment-top">' + result.replyNameHTML;
if (state !== "") {

15
ease/css/ease.min.css vendored
View File

@ -1,3 +1,18 @@
/**
* Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
html,body,div,ul,li{margin:0;padding:0}
body{font-family:Verdana,arial,'\5fae\8f6f\96c5\9ed1';font-size:12px;background-color:#fcfcfc}
::selection{background-color:#d5d5d5;color:#fcfcfc}

15
ease/js/ease.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -124,14 +124,18 @@
var addComment = function(result, state) {
var commentHTML = '<div id="' + result.oId + '"><img class="comment-header" \
title="' + $("#commentName" + state).val() + '" alt="' + $("#commentName" + state).val() +
'" src="' + result.commentThumbnailURL + '"/><div class="comment-panel"><div class="left">' + result.replyNameHTML;
title="' + result.userName + '" alt="' + result.userName +
'" src="' + result.commentThumbnailURL
+ '"/><div class="comment-panel"><div class="left">' + result.replyNameHTML;
if (state !== "") {
var commentOriginalCommentName = $("#" + page.currentCommentId + " .comment-panel>.left a").first().text();
commentHTML += '&nbsp;@&nbsp;<a href="${servePath}' + result.commentSharpURL.split("#")[0] + '#' + page.currentCommentId + '"'
var commentOriginalCommentName = $("#" + page.currentCommentId
+ " .comment-panel>.left a").first().text();
commentHTML += '&nbsp;@&nbsp;<a href="${servePath}'
+ result.commentSharpURL.split("#")[0] + '#' + page.currentCommentId + '"'
+ '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)
@ -141,7 +145,7 @@
+ '</div></div><span class="clear"></span></div>';
return commentHTML;
}
};
var replyTo = function(id) {
var commentFormHTML = "<table class='form' id='replyForm'>";

View File

@ -135,7 +135,7 @@
var addComment = function (result, state) {
var commentHTML = '<div id="' + result.oId
+ '" class="comment-body"><div class="comment-panel"><div class="left comment-author">'
+ '<div><img alt="' + $("#commentName" + state).val() +
+ '<div><img alt="' + result.userName +
'" src="' + result.commentThumbnailURL + '"/></div>' + result.replyNameHTML;
commentHTML += '</div><div class="left comment-info"><div class="left">' + result.commentDate;

View File

@ -133,7 +133,7 @@
var addComment = function (result, state) {
var commentHTML = '<div id="' + result.oId
+ '" class="comment-body"><div class="comment-panel"><div class="left comment-author">'
+ '<div><img alt="' + $("#commentName" + state).val() + '" src="' +
+ '<div><img alt="' + result.userName + '" src="' +
result.commentThumbnailURL + '"/></div>' + result.replyNameHTML;
commentHTML += '</div><div class="left comment-info"><div class="left">' + result.commentDate;

View File

@ -143,7 +143,7 @@
var addComment = function(result, state) {
$("#comments").prev().html("<h3>${commentLabel}</h3>");
var commentHTML = '<div id="' + result.oId + '" class="fn-clear"><img ' +
'title="' + $("#commentName" + state).val() + '" alt="' + $("#commentName" + state).val() +
'alt="' + result.userName +
'" src="' + result.commentThumbnailURL + '"/>' +
'<div class="comment-main"><div class="fn-clear">' + result.replyNameHTML;

View File

@ -34,7 +34,7 @@
</div>
<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>
<li><a href="${page.pagePermalink}" target="${page.pageOpenTarget}"><img src="${staticServePath}/skins/${skinDirName}/images/icon-pool/Apps.png" alt=""/>${page.pageTitle}</a></li>
</#list>

View File

@ -90,94 +90,97 @@
<#macro comment_script oId>
<script type="text/javascript" src="${staticServePath}/js/page${miniPostfix}.js?${staticResourceVersion}" charset="utf-8"></script>
<script type="text/javascript">
Page.prototype.submitComment = function (commentId, state) {
if (!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;
Page.prototype.submitComment = function(commentId, state) {
if (!state) {
state = '';
}
var tips = this.tips,
type = "article";
if (tips.externalRelevantArticlesDisplayCount === undefined) {
type = "page";
}
$wpt("#loading").fadeIn(400);
$.ajax({
type: "POST",
url: "/add-" + type + "-comment.do",
contentType: "application/json",
data: JSON.stringify(requestJSONObject),
success: function(result){
$("#submitCommentButton" + state).removeAttr("disabled");
if (!result.sc) {
$("#commentValidate" + state).val("").focus();
$("#commentErrorTip" + state).html(result.msg);
$("#captcha" + state).attr("src", "/captcha.do?code=" + Math.random());
$wpt('#commentErrorTip' + state).show();
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);
}
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) {
$("#commentValidate" + state).val("").focus();
$("#commentErrorTip" + state).html(result.msg);
$("#captcha" + state).attr("src", "/captcha.do?code=" + Math.random());
$wpt('#commentErrorTip' + state).show();
$wpt("#loading").fadeOut(400);
return;
}
$wpt("#commentForm").hide();
$wpt("#loading").fadeOut(400);
return;
}
$wpt("#commentForm").hide();
$wpt("#loading").fadeOut(400);
$wpt("#refresher").fadeIn(400);
$("#comment" + state).val("");
$("#commentValidate" + state).val("");
$("#replyForm").remove();
}, // end success
error: function() {
} //end error
});
$wpt("#refresher").fadeIn(400);
$("#comment" + state).val("");
$("#commentValidate" + state).val("");
$("#replyForm").remove();
Cookie.createCookie("commentName", requestJSONObject.commentName, 365);
Cookie.createCookie("commentEmail", requestJSONObject.commentEmail, 365);
Cookie.createCookie("commentURL", $("#commentURL" + state).val().replace(/(^\s*)|(\s*$)/g, ""), 365);
}
};
var replyTo = function (id) {
var commentFormHTML = "<div id='replyForm'>";
page.addReplyForm(id, commentFormHTML, "</div>");
};
var page = new Page({
"nameTooLongLabel": "${nameTooLongLabel}",
"mailCannotEmptyLabel": "${mailCannotEmptyLabel}",
"mailInvalidLabel": "${mailInvalidLabel}",
"commentContentCannotEmptyLabel": "${commentContentCannotEmptyLabel}",
"captchaCannotEmptyLabel": "${captchaCannotEmptyLabel}",
"loadingLabel": "${loadingLabel}",
"oId": "${oId}",
"skinDirName": "${skinDirName}",
"blogHost": "${blogHost}",
"randomArticles1Label": "${randomArticles1Label}",
"externalRelevantArticles1Label": "${externalRelevantArticles1Label}"
});
}, // end success
error: function() {
} //end error
});
}
(function () {
page.load();
// emotions
page.replaceCommentsEm("#commentlist .combody");
};
var replyTo = function(id) {
var commentFormHTML = "<div id='replyForm'>";
page.addReplyForm(id, commentFormHTML, "</div>");
};
var page = new Page({
"nameTooLongLabel": "${nameTooLongLabel}",
"mailCannotEmptyLabel": "${mailCannotEmptyLabel}",
"mailInvalidLabel": "${mailInvalidLabel}",
"commentContentCannotEmptyLabel": "${commentContentCannotEmptyLabel}",
"captchaCannotEmptyLabel": "${captchaCannotEmptyLabel}",
"loadingLabel": "${loadingLabel}",
"oId": "${oId}",
"skinDirName": "${skinDirName}",
"blogHost": "${blogHost}",
"randomArticles1Label": "${randomArticles1Label}",
"externalRelevantArticles1Label": "${externalRelevantArticles1Label}"
});
(function() {
page.load();
// emotions
page.replaceCommentsEm("#commentlist .combody");
<#nested>
})();
</script>

View File

@ -132,7 +132,7 @@
oddEven = "comment-even";
}
var commentHTML = '<div id="' + result.oId + '" class="oddEven"><img class="comment-header" \
title="' + $("#commentName" + state).val() + '" alt="' + $("#commentName" + state).val() +
alt="' + result.userName +
'" src="' + result.commentThumbnailURL + '"/><div class="comment-panel"><div class="left">' + result.replyNameHTML;
if (state !== "") {

View File

@ -136,7 +136,7 @@
var addComment = function (result, state) {
var commentHTML = '<div id="' + result.oId
+ '" class="comment-body"><div class="comment-panel"><div class="left comment-author">'
+ '<div><img alt="' + $("#commentName" + state).val() +
+ '<div><img alt="' + result.userName +
'" src="' + result.commentThumbnailURL + '"/></div>' + result.replyNameHTML;
commentHTML += '</div><div class="left comment-info"><div class="left">' + result.commentDate;

View File

@ -118,7 +118,7 @@
var addComment = function(result, state) {
var commentHTML = '<li id="' + result.oId + '"><img \
title="' + $("#commentName" + state).val() + '" alt="' + $("#commentName" + state).val() +
alt="' + result.userName +
'" src="' + result.commentThumbnailURL + '"/><div><span class="author">' + result.replyNameHTML;
if (state !== "") {

View File

@ -159,7 +159,7 @@
commentHTML += '<div class="right">' + result.commentDate
+ '&nbsp;<a rel="nofollow" class="no-underline" href="javascript:replyTo(\'' + result.oId + '\');">${replyLabel}</a>'
+ '</div><div class="clear"></div></div><div><img alt="' + $("#commentName" + state).val()
+ '</div><div class="clear"></div></div><div><img alt="' + result.userName
+ '" src="' + result.commentThumbnailURL + '" class="comment-picture left"/>'
+ '<div class="comment-content">'
+ Util.replaceEmString($("#comment" + state).val().replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g,"<br/>"))