From: David ‘Bombe’ Roden Date: Mon, 3 Jan 2011 06:25:20 +0000 (+0100) Subject: Add methods to return the authoring Sone ID for a post or reply. X-Git-Tag: 0.4^2~8^2~17 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=9372287c4fe90cf72e9c5003b4277e934dbf2e27;p=Sone.git Add methods to return the authoring Sone ID for a post or reply. --- 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) {