From 9372287c4fe90cf72e9c5003b4277e934dbf2e27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 3 Jan 2011 07:25:20 +0100 Subject: [PATCH] Add methods to return the authoring Sone ID for a post or reply. --- src/main/resources/static/javascript/sone.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index d6e0964..f465438 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -303,6 +303,17 @@ function getPostTime(element) { return getPostElement(element).find(".post-time").text(); } +/** + * Returns the author of the post the given element belongs to. + * + * @param element + * The element whose post to get the author for + * @returns The ID of the authoring Sone + */ +function getPostAuthor(element) { + return getPostElement(element).find(".post-author").text(); +} + function getReplyElement(element) { return $(element).closest(".reply"); } @@ -315,6 +326,17 @@ function getReplyTime(element) { return getReplyElement(element).find(".reply-time").text(); } +/** + * Returns the author of the reply the given element belongs to. + * + * @param element + * The element whose reply to get the author for + * @returns The ID of the authoring Sone + */ +function getReplyAuthor(element) { + return getReplyElement(element).find(".reply-author").text(); +} + function likePost(postId) { $.getJSON("like.ajax", { "type": "post", "post" : postId, "formPassword": getFormPassword() }, function(data, textStatus) { if ((data == null) || !data.success) { -- 2.7.4