X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=1df8d42d867c36e0ff597fb04a4438e200d283ec;hp=0e3df51f5fd4565cf6bb04d8d196a7ccdc7cec82;hb=acad4aaa7ddf0104d57654e5b272353d8799adeb;hpb=6b4739bb0813debb9fb08d061f384349cbc8f8a2 diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 0e3df51..1df8d42 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -804,12 +804,30 @@ function ajaxifyPost(postElement) { $(postElement).find(".create-reply").addClass("hidden"); /* show Sone menu when hovering over the avatar. */ - $(postElement).find(".avatar").mouseover(function() { + $(postElement).find(".post-avatar").mouseover(function() { $(".sone-post-menu", postElement).mouseleave(function() { $(this).fadeOut(); }).fadeIn(); return false; }); + (function(postElement) { + $(".sone-post-menu .follow", postElement).click(function() { + var followElement = this; + ajaxGet("followSone.ajax", { "sone": $(".sone-id", postElement).text(), "formPassword": getFormPassword() }, function() { + $(followElement).addClass("hidden"); + $(followElement).parent().find(".unfollow").removeClass("hidden"); + }); + return false; + }); + $(".sone-post-menu .unfollow", postElement).click(function() { + var unfollowElement = this; + ajaxGet("unfollowSone.ajax", { "sone": $(".sone-id", postElement).text(), "formPassword": getFormPassword() }, function() { + $(unfollowElement).addClass("hidden"); + $(unfollowElement).parent().find(".follow").removeClass("hidden"); + }); + return false; + }); + })(postElement); } /**