X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=3fcf90769a05e3f5ae9321c5ba00f8816b1aae37;hp=44eee87d50ac1176511dc022cf00503f7dc4477b;hb=e5b1a360879963dca1cd468353776c340d23e0b6;hpb=d3c04921c21036e8e3d381cb75777079e11e18fd diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 44eee87..3fcf907 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -901,6 +901,45 @@ function ajaxifyReply(replyElement) { untrustSone(getReplyAuthor(this)); return false; }); + + /* show Sone menu when hovering over the avatar. */ + $(replyElement).find(".reply-avatar").mouseover(function() { + $(".sone-reply-menu", replyElement).mouseleave(function() { + $(this).fadeOut(); + }).fadeIn(); + return false; + }); + (function(replyElement) { + var soneId = $(".sone-id", replyElement).text(); + $(".sone-menu .follow", replyElement).click(function() { + var followElement = this; + ajaxGet("followSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() { + $(followElement).addClass("hidden"); + $(followElement).parent().find(".unfollow").removeClass("hidden"); + $("#sone .sone-menu").each(function() { + if (getMenuSone(this) == soneId) { + $(".follow", this).toggleClass("hidden", true); + $(".unfollow", this).toggleClass("hidden", false); + } + }); + }); + return false; + }); + $(".sone-menu .unfollow", replyElement).click(function() { + var unfollowElement = this; + ajaxGet("unfollowSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() { + $(unfollowElement).addClass("hidden"); + $(unfollowElement).parent().find(".follow").removeClass("hidden"); + $("#sone .sone-menu").each(function() { + if (getMenuSone(this) == soneId) { + $(".follow", this).toggleClass("hidden", false); + $(".unfollow", this).toggleClass("hidden", true); + } + }); + }); + return false; + }); + })(replyElement); } /**