From a02811cd7b38393e0d59f8a90a8a617fd8ca160a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 1 Mar 2012 08:28:14 +0100 Subject: [PATCH] =?utf8?q?Make=20=E2=80=9CComment=E2=80=9D=20button=20tran?= =?utf8?q?slatable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/resources/i18n/sone.en.properties | 1 + src/main/resources/i18n/sone.fr.properties | 1 + src/main/resources/i18n/sone.ru.properties | 1 + src/main/resources/static/javascript/sone.js | 51 +++++++++++++++------------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index b8fb463..ac15636 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -413,6 +413,7 @@ WebInterface.DefaultText.Option.PostCutOffLength=Number of characters for the sn WebInterface.DefaultText.Option.PositiveTrust=The positive trust to assign WebInterface.DefaultText.Option.NegativeTrust=The negative trust to assign WebInterface.DefaultText.Option.TrustComment=The comment to set in the web of trust +WebInterface.Button.Comment=Comment WebInterface.Confirmation.DeletePostButton=Yes, delete! WebInterface.Confirmation.DeleteReplyButton=Yes, delete! WebInterface.SelectBox.Choose=Choose… diff --git a/src/main/resources/i18n/sone.fr.properties b/src/main/resources/i18n/sone.fr.properties index c4b468f..7572ec9 100644 --- a/src/main/resources/i18n/sone.fr.properties +++ b/src/main/resources/i18n/sone.fr.properties @@ -413,6 +413,7 @@ WebInterface.DefaultText.Option.PostCutOffLength=Number of characters for the sn WebInterface.DefaultText.Option.PositiveTrust=La note de confiance positive à assigner WebInterface.DefaultText.Option.NegativeTrust=Une note de confiance négative à assigner WebInterface.DefaultText.Option.TrustComment=Le commentaire à mettre dans le "Web of Trust" +WebInterface.Button.Comment=Commenter WebInterface.Confirmation.DeletePostButton=Oui, effacer! WebInterface.Confirmation.DeleteReplyButton=Oui, effacer! WebInterface.SelectBox.Choose=Choisir... diff --git a/src/main/resources/i18n/sone.ru.properties b/src/main/resources/i18n/sone.ru.properties index b525070..ad75d11 100644 --- a/src/main/resources/i18n/sone.ru.properties +++ b/src/main/resources/i18n/sone.ru.properties @@ -413,6 +413,7 @@ WebInterface.DefaultText.Option.PostCutOffLength=Количество симво WebInterface.DefaultText.Option.PositiveTrust=Положительное доверие для назначения WebInterface.DefaultText.Option.NegativeTrust=Отрицательное доверие для назначения WebInterface.DefaultText.Option.TrustComment=Комментарий для установки в web of trust +WebInterface.Button.Comment=Comment WebInterface.Confirmation.DeletePostButton=Да, удалить! WebInterface.Confirmation.DeleteReplyButton=Да, удалить! WebInterface.SelectBox.Choose=Выбрать… diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 6afb232..100e9db 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -67,30 +67,31 @@ function addCommentLink(postId, author, element, insertAfterThisElement) { if (($(element).find(".show-reply-form").length > 0) || (getPostElement(element).find(".create-reply").length == 0)) { return; } - commentElement = (function(postId, author) { + (function(postId, author, insertAfterThisElement) { separator = $(" · ").addClass("separator"); - var commentElement = $("
Comment
").addClass("show-reply-form").click(function() { - replyElement = $("#sone .post#post-" + postId + " .create-reply"); - replyElement.removeClass("hidden"); - replyElement.removeClass("light"); - (function(replyElement) { - replyElement.find("input.reply-input").blur(function() { - if ($(this).hasClass("default")) { - replyElement.addClass("light"); - } - }).focus(function() { - replyElement.removeClass("light"); - }); - })(replyElement); - textArea = replyElement.find("input.reply-input").focus().data("textarea"); - if (author != getCurrentSoneId()) { - textArea.val(textArea.val() + "@sone://" + author + " "); - } + getTranslation("WebInterface.Button.Comment", function(text) { + commentElement = $("
" + text + "
").addClass("show-reply-form").click(function() { + replyElement = $("#sone .post#post-" + postId + " .create-reply"); + replyElement.removeClass("hidden"); + replyElement.removeClass("light"); + (function(replyElement) { + replyElement.find("input.reply-input").blur(function() { + if ($(this).hasClass("default")) { + replyElement.addClass("light"); + } + }).focus(function() { + replyElement.removeClass("light"); + }); + })(replyElement); + textArea = replyElement.find("input.reply-input").focus().data("textarea"); + if (author != getCurrentSoneId()) { + textArea.val(textArea.val() + "@sone://" + author + " "); + } + }); + $(insertAfterThisElement).after(commentElement.clone(true)); + $(insertAfterThisElement).after(separator); }); - return commentElement; - })(postId, author); - $(insertAfterThisElement).after(commentElement.clone(true)); - $(insertAfterThisElement).after(separator); + })(postId, author, insertAfterThisElement); } var translations = {}; @@ -1923,8 +1924,10 @@ $(document).ready(function() { getTranslation("WebInterface.Confirmation.DeletePostButton", function(text) { getTranslation("WebInterface.Confirmation.DeleteReplyButton", function(text) { getTranslation("WebInterface.DefaultText.Reply", function(text) { - $("#sone .post").each(function() { - ajaxifyPost(this); + getTranslation("WebInterface.Button.Comment", function(text) { + $("#sone .post").each(function() { + ajaxifyPost(this); + }); }); }); }); -- 2.7.4