X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=d58f17f6c700b1d2bed3cf597aa6695117ec5960;hb=547961e6345f8f6792b8ec9a95120a10c606be0b;hp=d60ee230157664d7d2b1711e233983362c518985;hpb=e17523ae9c800ddf6a8e31bfa4a56f4aa0278aec;p=Sone.git
diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js
index d60ee23..d58f17f 100644
--- a/src/main/resources/static/javascript/sone.js
+++ b/src/main/resources/static/javascript/sone.js
@@ -33,7 +33,7 @@ function registerInputTextareaSwap(inputElement, defaultText, inputFieldName, op
inputField.val(defaultText);
}
}).hide().data("inputField", $(this)).val($(this).val());
- $(this).after(textarea);
+ $(this).data("textarea", textarea).after(textarea);
(function(inputField, textarea) {
inputField.focus(function() {
$(this).hide().attr("disabled", "disabled");
@@ -66,11 +66,11 @@ function registerInputTextareaSwap(inputElement, defaultText, inputFieldName, op
* @param element
* The element to add a âcommentâ link to
*/
-function addCommentLink(postId, element, insertAfterThisElement) {
+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) {
+ commentElement = (function(postId, author) {
separator = $(" · ").addClass("separator");
var commentElement = $("
Comment
").addClass("show-reply-form").click(function() {
replyElement = $("#sone .post#" + postId + " .create-reply");
@@ -85,10 +85,11 @@ function addCommentLink(postId, element, insertAfterThisElement) {
replyElement.removeClass("light");
});
})(replyElement);
- replyElement.find("input.reply-input").focus();
+ textArea = replyElement.find("input.reply-input").focus().data("textarea");
+ textArea.val(textArea.val() + "@sone://" + author + " ");
});
return commentElement;
- })(postId);
+ })(postId, author);
$(insertAfterThisElement).after(commentElement.clone(true));
$(insertAfterThisElement).after(separator);
}
@@ -666,7 +667,7 @@ function ajaxifySone(soneElement) {
/* mark Sone as known when clicking it. */
$(soneElement).click(function() {
- markSoneAsKnown(soneElement);
+ markSoneAsKnown(this);
});
}
@@ -757,7 +758,7 @@ function ajaxifyPost(postElement) {
});
/* add âcommentâ link. */
- addCommentLink(getPostId(postElement), postElement, $(postElement).find(".post-status-line .time"));
+ addCommentLink(getPostId(postElement), getPostAuthor(postElement), postElement, $(postElement).find(".post-status-line .time"));
/* process all replies. */
replyIds = [];
@@ -817,7 +818,7 @@ function ajaxifyReply(replyElement) {
});
});
})(replyElement);
- addCommentLink(getPostId(replyElement), replyElement, $(replyElement).find(".reply-status-line .time"));
+ addCommentLink(getPostId(replyElement), getReplyAuthor(replyElement), replyElement, $(replyElement).find(".reply-status-line .time"));
/* convert âshow sourceâ link into javascript function. */
$(replyElement).find(".show-reply-source").each(function() {