From 32c303db51d7f3398839f0ae91c6c12e1e9a9e87 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 7 Apr 2011 11:25:10 +0200 Subject: [PATCH] =?utf8?q?Add=20=E2=80=9CskipRequest=E2=80=9D=20parameter?= =?utf8?q?=20to=20all=20mark*AsKnown()=20methods.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/javascript/sone.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index f6a91e4..f49778b 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1129,36 +1129,45 @@ function loadNewReply(replyId, soneId, postId, postSoneId) { * * @param soneElement * The Sone to mark as known + * @param skipRequest + * true to skip the JSON request, false or omit to perform the JSON + * request */ -function markSoneAsKnown(soneElement) { +function markSoneAsKnown(soneElement, skipRequest) { if ($(".new", soneElement).length > 0) { - $.getJSON("maskAsKnown.ajax", {"formPassword": getFormPassword(), "type": "sone", "id": getSoneId(soneElement)}, function(data, textStatus) { - $(soneElement).removeClass("new"); - }); + if ((typeof skipRequest != "undefined") && !skipRequest) { + $.getJSON("maskAsKnown.ajax", {"formPassword": getFormPassword(), "type": "sone", "id": getSoneId(soneElement)}, function(data, textStatus) { + $(soneElement).removeClass("new"); + }); + } } } -function markPostAsKnown(postElements) { +function markPostAsKnown(postElements, skipRequest) { $(postElements).each(function() { postElement = this; if ($(postElement).hasClass("new")) { (function(postElement) { $(postElement).removeClass("new"); $(".click-to-show", postElement).removeClass("new"); - $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "post", "id": getPostId(postElement)}); + if ((typeof skipRequest == "undefined") || !skipRequest) { + $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "post", "id": getPostId(postElement)}); + } })(postElement); } }); markReplyAsKnown($(postElements).find(".reply")); } -function markReplyAsKnown(replyElements) { +function markReplyAsKnown(replyElements, skipRequest) { $(replyElements).each(function() { replyElement = this; if ($(replyElement).hasClass("new")) { (function(replyElement) { $(replyElement).removeClass("new"); - $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "reply", "id": getReplyId(replyElement)}); + if ((typeof skipRequest == "undefined") || !skipRequest) { + $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "reply", "id": getReplyId(replyElement)}); + } })(replyElement); } }); -- 2.7.4