X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=ef34c6697bdadef0a547e33559007141557feb73;hb=02de134dcf3d4500ae02320aab2dae827d499fa1;hp=58fbf958692ace8a0fffc0d7f7e1897696b32bdd;hpb=d31b2f503415cb9085facf68db4fc429d3564962;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 58fbf95..ef34c66 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -460,6 +460,13 @@ function updateTrustControls(soneId, trustValue) { getPostElement(this).find(".post-untrust").toggleClass("hidden", trustValue == null); } }); + $("#sone .reply").each(function() { + if (getReplyAuthor(this) == soneId) { + getReplyElement(this).find(".reply-trust").toggleClass("hidden", trustValue != null); + getReplyElement(this).find(".reply-distrust").toggleClass("hidden", (trustValue != null) && (trustValue < 0)); + getReplyElement(this).find(".reply-untrust").toggleClass("hidden", trustValue == null); + } + }); } function updateReplyLikes(replyId) { @@ -569,6 +576,20 @@ function ajaxifyPost(postElement) { return false; }); + /* convert trust control buttons to javascript functions. */ + $(postElement).find(".post-trust").submit(function() { + trustSone(getPostAuthor(this)); + return false; + }); + $(postElement).find(".post-distrust").submit(function() { + distrustSone(getPostAuthor(this)); + return false; + }); + $(postElement).find(".post-untrust").submit(function() { + untrustSone(getPostAuthor(this)); + return false; + }); + /* add “comment” link. */ addCommentLink(getPostId(postElement), postElement, $(postElement).find(".post-status-line .time")); @@ -619,6 +640,20 @@ function ajaxifyReply(replyElement) { })(replyElement); addCommentLink(getPostId(replyElement), replyElement, $(replyElement).find(".reply-status-line .time")); + /* convert trust control buttons to javascript functions. */ + $(replyElement).find(".reply-trust").submit(function() { + trustSone(getReplyAuthor(this)); + return false; + }); + $(replyElement).find(".reply-distrust").submit(function() { + distrustSone(getReplyAuthor(this)); + return false; + }); + $(replyElement).find(".reply-untrust").submit(function() { + untrustSone(getReplyAuthor(this)); + return false; + }); + /* mark post and all replies as known on click. */ $(replyElement).click(function() { markPostAsKnown(getPostElement(this));