From 014bfcdda490bdeca57f4c5f5cd9b42b90f7f2c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 28 Nov 2019 18:58:41 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=94=A5=20Remove=20javascript=20code=20for?= =?utf8?q?=20trust=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/javascript/sone.js | 96 ---------------------------- 1 file changed, 96 deletions(-) diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 8798aae..333d9d1 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -495,74 +495,6 @@ function unlikeReply(replyId) { } /** - * Trusts the Sone with the given ID. - * - * @param soneId - * The ID of the Sone to trust - */ -function trustSone(soneId) { - ajaxGet("trustSone.ajax", { "formPassword" : getFormPassword(), "sone" : soneId }, function(data) { - if ((data != null) && data.success) { - updateTrustControls(soneId, data.trustValue); - } - }); -} - -/** - * Distrusts the Sone with the given ID, i.e. assigns a negative trust value. - * - * @param soneId - * The ID of the Sone to distrust - */ -function distrustSone(soneId) { - ajaxGet("distrustSone.ajax", { "formPassword" : getFormPassword(), "sone" : soneId }, function(data) { - if ((data != null) && data.success) { - updateTrustControls(soneId, data.trustValue); - } - }); -} - -/** - * Untrusts the Sone with the given ID, i.e. removes any trust assignment. - * - * @param soneId - * The ID of the Sone to untrust - */ -function untrustSone(soneId) { - ajaxGet("untrustSone.ajax", { "formPassword" : getFormPassword(), "sone" : soneId }, function(data) { - if ((data != null) && data.success) { - updateTrustControls(soneId, data.trustValue); - } - }); -} - -/** - * Updates the trust controls for all posts and replies of the given Sone, - * according to the given trust value. - * - * @param soneId - * The ID of the Sone to update all trust controls for - * @param trustValue - * The trust value for the Sone - */ -function updateTrustControls(soneId, trustValue) { - sone.find(".post").each(function() { - if (getPostAuthor(this) === soneId) { - getPostElement(this).find(".post-trust").toggleClass("hidden", trustValue != null); - getPostElement(this).find(".post-distrust").toggleClass("hidden", trustValue != null); - getPostElement(this).find(".post-untrust").toggleClass("hidden", trustValue == null); - } - }); - sone.find(".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); - getReplyElement(this).find(".reply-untrust").toggleClass("hidden", trustValue == null); - } - }); -} - -/** * Bookmarks the post with the given ID. * * @param postId @@ -773,20 +705,6 @@ 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; - }); - /* convert bookmark/unbookmark buttons to javascript functions. */ $(postElement).find(".bookmark").submit(function() { bookmarkPost(getPostId(this)); @@ -972,20 +890,6 @@ function ajaxifyReply(replyElement) { $(replyElement).find(".expand-reply-text").each(toggleShowMore); $(replyElement).find(".shrink-reply-text").each(toggleShowMore); - /* 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; - }); - /* show Sone menu when hovering over the avatar. */ $(replyElement).find(".reply-avatar").mouseover(function() { if (typeof currentSoneMenuTimeoutHandler !== undefined) { -- 2.7.4