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

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 var commentHTML = '<div id="' + result.oId
+ '" class="comment-body ' + oddEven + '"><div class="comment-panel"><div class="left comment-author">' + '" 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; + '"/></div><div class="left comment-info">' + result.replyNameHTML;
if (state !== "") { if (state !== "") {

View File

@ -159,7 +159,7 @@
commentHTML += '<div class="right">' + result.commentDate commentHTML += '<div class="right">' + result.commentDate
+ '&nbsp;<a class="no-underline" href="javascript:replyTo(\'' + result.oId + '\');">${replyLabel}</a>' + '&nbsp;<a class="no-underline" href="javascript:replyTo(\'' + result.oId + '\');">${replyLabel}</a>'
+ '</div><div class="clear"></div></div><div class="comment-body">' + '</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 + '"/>' + '" src="' + result.commentThumbnailURL + '"/>'
+ '</div><div class="comment-content">' + + '</div><div class="comment-content">' +
Util.replaceEmString($("#comment" + state).val().replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g,"<br/>")) 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 addComment = function (result, state) {
var commentHTML = '<div id="' + result.oId + '">' 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; + '"/><div class="comment-panel left"><div class="comment-top">' + result.replyNameHTML;
if (state !== "") { 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} html,body,div,ul,li{margin:0;padding:0}
body{font-family:Verdana,arial,'\5fae\8f6f\96c5\9ed1';font-size:12px;background-color:#fcfcfc} body{font-family:Verdana,arial,'\5fae\8f6f\96c5\9ed1';font-size:12px;background-color:#fcfcfc}
::selection{background-color:#d5d5d5;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 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 += '&nbsp;@&nbsp;<a href="${servePath}' + result.commentSharpURL.split("#")[0] + '#' + 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);"' + '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 @@
+ '</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'>";

View File

@ -135,7 +135,7 @@
var addComment = function (result, state) { var addComment = function (result, state) {
var commentHTML = '<div id="' + result.oId var commentHTML = '<div id="' + result.oId
+ '" class="comment-body"><div class="comment-panel"><div class="left comment-author">' + '" 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; '" src="' + result.commentThumbnailURL + '"/></div>' + result.replyNameHTML;
commentHTML += '</div><div class="left comment-info"><div class="left">' + result.commentDate; commentHTML += '</div><div class="left comment-info"><div class="left">' + result.commentDate;

View File

@ -133,7 +133,7 @@
var addComment = function (result, state) { var addComment = function (result, state) {
var commentHTML = '<div id="' + result.oId var commentHTML = '<div id="' + result.oId
+ '" class="comment-body"><div class="comment-panel"><div class="left comment-author">' + '" 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; result.commentThumbnailURL + '"/></div>' + result.replyNameHTML;
commentHTML += '</div><div class="left comment-info"><div class="left">' + result.commentDate; commentHTML += '</div><div class="left comment-info"><div class="left">' + result.commentDate;

View File

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

View File

@ -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>

View File

@ -90,7 +90,7 @@
<#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 = '';
} }
@ -102,9 +102,14 @@
if (this.validateComment(state)) { if (this.validateComment(state)) {
$("#submitCommentButton" + state).attr("disabled", "disabled"); $("#submitCommentButton" + state).attr("disabled", "disabled");
$("#commentErrorTip" + state).html(this.tips.loadingLabel); $("#commentErrorTip" + state).show().html(this.tips.loadingLabel);
var requestJSONObject = { var requestJSONObject = {
"oId": tips.oId,
"commentContent": $("#comment" + state).val().replace(/(^\s*)|(\s*$)/g, "")
};
if (!$("#admin").data("login")) {
requestJSONObject = {
"oId": tips.oId, "oId": tips.oId,
"commentContent": $("#comment" + state).val().replace(/(^\s*)|(\s*$)/g, ""), "commentContent": $("#comment" + state).val().replace(/(^\s*)|(\s*$)/g, ""),
"commentEmail": $("#commentEmail" + state).val(), "commentEmail": $("#commentEmail" + state).val(),
@ -112,19 +117,21 @@
"commentName": $("#commentName" + state).val().replace(/(^\s*)|(\s*$)/g, ""), "commentName": $("#commentName" + state).val().replace(/(^\s*)|(\s*$)/g, ""),
"captcha": $("#commentValidate" + state).val() "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") { if (state === "Reply") {
requestJSONObject.commentOriginalCommentId = commentId; requestJSONObject.commentOriginalCommentId = commentId;
} }
$wpt("#loading").fadeIn(400);
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/add-" + type + "-comment.do", url: latkeConfig.servePath + "/add-" + type + "-comment.do",
cache: false,
contentType: "application/json", contentType: "application/json",
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
success: function(result){ success: function(result) {
$("#submitCommentButton" + state).removeAttr("disabled"); $("#submitCommentButton" + state).removeAttr("disabled");
if (!result.sc) { if (!result.sc) {
@ -145,17 +152,13 @@
}, // end success }, // end success
error: function() { error: function() {
} //end error } //end error
}); });
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 replyTo = function(id) {
var commentFormHTML = "<div id='replyForm'>"; var commentFormHTML = "<div id='replyForm'>";
page.addReplyForm(id, commentFormHTML, "</div>"); page.addReplyForm(id, commentFormHTML, "</div>");
}; };
@ -174,7 +177,7 @@
"externalRelevantArticles1Label": "${externalRelevantArticles1Label}" "externalRelevantArticles1Label": "${externalRelevantArticles1Label}"
}); });
(function () { (function() {
page.load(); page.load();
// emotions // emotions
page.replaceCommentsEm("#commentlist .combody"); page.replaceCommentsEm("#commentlist .combody");

View File

@ -132,7 +132,7 @@
oddEven = "comment-even"; oddEven = "comment-even";
} }
var commentHTML = '<div id="' + result.oId + '" class="oddEven"><img class="comment-header" \ 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; '" src="' + result.commentThumbnailURL + '"/><div class="comment-panel"><div class="left">' + result.replyNameHTML;
if (state !== "") { if (state !== "") {

View File

@ -136,7 +136,7 @@
var addComment = function (result, state) { var addComment = function (result, state) {
var commentHTML = '<div id="' + result.oId var commentHTML = '<div id="' + result.oId
+ '" class="comment-body"><div class="comment-panel"><div class="left comment-author">' + '" 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; '" src="' + result.commentThumbnailURL + '"/></div>' + result.replyNameHTML;
commentHTML += '</div><div class="left comment-info"><div class="left">' + result.commentDate; commentHTML += '</div><div class="left comment-info"><div class="left">' + result.commentDate;

View File

@ -118,7 +118,7 @@
var addComment = function(result, state) { var addComment = function(result, state) {
var commentHTML = '<li id="' + result.oId + '"><img \ 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; '" src="' + result.commentThumbnailURL + '"/><div><span class="author">' + result.replyNameHTML;
if (state !== "") { if (state !== "") {

View File

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