X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=c5296caebd7e50f233755d01e76d0ff2f0ceeffe;hb=d3d8c053c8635e90452e620d98fd2e8c0f3ad89a;hp=60861b5e7344660331c18fc1b0d11182723fa2cf;hpb=43f0b7c9feffceff7aabed2d24c1131e24fb8262;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 60861b5..c5296ca 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -486,6 +486,38 @@ function updateTrustControls(soneId, trustValue) { }); } +/** + * Bookmarks the post with the given ID. + * + * @param postId + * The ID of the post to bookmark + */ +function bookmarkPost(postId) { + (function(postId) { + $.getJSON("bookmark.ajax", {"formPassword": getFormPassword(), "type": "post", "post": postId}, function(data, textStatus) { + if ((data != null) && data.success) { + getPost(postId).find(".bookmark").toggleClass("hidden", true); + getPost(postId).find(".unbookmark").toggleClass("hidden", false); + } + }); + })(postId); +} + +/** + * Unbookmarks the post with the given ID. + * + * @param postId + * The ID of the post to unbookmark + */ +function unbookmarkPost(postId) { + $.getJSON("unbookmark.ajax", {"formPassword": getFormPassword(), "type": "post", "post": postId}, function(data, textStatus) { + if ((data != null) && data.success) { + getPost(postId).find(".bookmark").toggleClass("hidden", false); + getPost(postId).find(".unbookmark").toggleClass("hidden", true); + } + }); +} + function updateReplyLikes(replyId) { $.getJSON("getLikes.ajax", { "type": "reply", "reply": replyId }, function(data, textStatus) { if ((data != null) && data.success) {