X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=8798aae1c8d1f2d3a2851b8f767dbeb017e2f596;hb=3335cbf7681220fcf95cff4895e025251211bf8e;hp=8e599ae1a881bbd311f42a2c7e4a2847a8146e9c;hpb=d0088e8e7dc1c3ca3feb29ad2f3e73f550d35a16;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 8e599ae..8798aae 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -685,34 +685,38 @@ function ajaxifySone(soneElement) { }); } -const followSone = function(soneId) { - const followElement = this; - ajaxGet("followSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() { - $(followElement).addClass("hidden"); - $(followElement).parent().find(".unfollow").removeClass("hidden"); - sone.find(".sone-menu").each(function() { - if (getMenuSone(this) === soneId) { - $(".follow", this).toggleClass("hidden", true); - $(".unfollow", this).toggleClass("hidden", false); - } +function followSone(soneId) { + return function() { + const followElement = this; + ajaxGet("followSone.ajax", {"sone": soneId, "formPassword": getFormPassword()}, function () { + $(followElement).addClass("hidden"); + $(followElement).parent().find(".unfollow").removeClass("hidden"); + sone.find(".sone-menu").each(function () { + if (getMenuSone(this) === soneId) { + $(".follow", this).toggleClass("hidden", true); + $(".unfollow", this).toggleClass("hidden", false); + } + }); }); - }); - return false; -}; + return false; + } +} -const unfollowSone = function (soneId) { - const unfollowElement = this; - ajaxGet("unfollowSone.ajax", {"sone": soneId, "formPassword": getFormPassword()}, function () { - $(unfollowElement).addClass("hidden"); - $(unfollowElement).parent().find(".follow").removeClass("hidden"); - sone.find(".sone-menu").each(function () { - if (getMenuSone(this) === soneId) { - $(".follow", this).toggleClass("hidden", false); - $(".unfollow", this).toggleClass("hidden", true); - } +function unfollowSone(soneId) { + return function() { + const unfollowElement = this; + ajaxGet("unfollowSone.ajax", {"sone": soneId, "formPassword": getFormPassword()}, function () { + $(unfollowElement).addClass("hidden"); + $(unfollowElement).parent().find(".follow").removeClass("hidden"); + sone.find(".sone-menu").each(function () { + if (getMenuSone(this) === soneId) { + $(".follow", this).toggleClass("hidden", false); + $(".unfollow", this).toggleClass("hidden", true); + } + }); }); - }); - return false; + return false; + } }; /** @@ -1273,7 +1277,7 @@ function getCurrentSoneId() { /** * Returns the content of the page-id attribute. * - * @returns The page ID + * @returns String The page ID */ function getPageId() { return sone.find(".page-id").text(); @@ -1617,7 +1621,7 @@ function updatePostTimes(postIds) { /** * Updates the time of the reply with the given ID. * - * @param postId + * @param replyId * The ID of the reply to update * @param timeText * The text of the time to show @@ -1638,7 +1642,7 @@ function updateReplyTime(replyId, timeText, refreshTime, tooltip) { /** * Requests new rendered times for the posts with the given IDs. * - * @param postIds + * @param replyIds * Comma-separated post IDs */ function updateReplyTimes(replyIds) {