X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=f6a91e4b61d67ef79fe41ca8cf05444d0d07ebb6;hb=e2d6419c38cd8258fa08cf15eb68c37b79ac3388;hp=908faf5120e96fa5df34a8d98c9d1c85418e2337;hpb=412752b9c15f164dbabb7e4096eeb381cd00a5f4;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 908faf5..f6a91e4 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -380,6 +380,39 @@ function getReplyAuthor(element) { return getReplyElement(element).find(".reply-author").text(); } +/** + * Returns the notification with the given ID. + * + * @param notificationId + * The ID of the notification + * @returns The notification element + */ +function getNotification(notificationId) { + return $("#sone #notification-area .notification#" + notificationId); +} + +/** + * Returns the notification element closest to the given element. + * + * @param element + * The element to get the closest notification of + * @return The closest notification element + */ +function getNotificationElement(element) { + return $(element).closest(".notification"); +} + +/** + * Returns the ID of the notification element. + * + * @param notificationElement + * The notification element + * @returns The ID of the notification + */ +function getNotificationId(notificationElement) { + return $(notificationElement).attr("id"); +} + function likePost(postId) { $.getJSON("like.ajax", { "type": "post", "post" : postId, "formPassword": getFormPassword() }, function(data, textStatus) { if ((data == null) || !data.success) {