X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=accfabca8b86a30d59cad23a98ea9ff7b65feed3;hp=2063576c3b371ce5f8c26a13c49299f6e849a05d;hb=275ef92e9690ed28eaf97200493b1e4c04719f52;hpb=d64c7c75d5246b08af3b2b5aa3e6fd0190b2fdf1 diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 2063576..accfabc 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -872,7 +872,7 @@ function ajaxifyPost(postElement) { }).fadeIn(); }, 1000); }).mouseleave(function() { - if (currentSoneMenuId = getPostId(this)) { + if (currentSoneMenuId == getPostId(this)) { clearTimeout(currentSoneMenuTimeoutHandler); } }); @@ -1011,7 +1011,7 @@ function ajaxifyReply(replyElement) { }).fadeIn(); }, 1000); }).mouseleave(function() { - if (currentSoneMenuId = getPostId(this) + "-" + getReplyId(this)) { + if (currentSoneMenuId == getPostId(this) + "-" + getReplyId(this)) { clearTimeout(currentSoneMenuTimeoutHandler); } }); @@ -1193,7 +1193,7 @@ function checkForRemovedReplies(oldNotification, newNotification) { } function getStatus() { - ajaxGet("getStatus.ajax", isViewSonePage() ? {"soneIds": getShownSoneId() } : {"loadAllSones": isKnownSonesPage()}, function(data, textStatus) { + ajaxGet("getStatus.ajax", isViewSonePage() ? {"soneIds": getShownSoneId() } : isKnownSonesPage() ? {"soneIds": getShownSoneIds() } : {}, function(data, textStatus) { if ((data != null) && data.success) { /* process Sone information. */ $.each(data.sones, function(index, value) { @@ -1359,6 +1359,20 @@ function getShownSoneId() { } /** + * Returns the ID of all currently visible Sones. This is mainly used on the + * “Known Sones” page. + * + * @returns The ID of the currently shown Sones + */ +function getShownSoneIds() { + var soneIds = new Array(); + $("#sone #known-sones .sone .id").each(function() { + soneIds.push($(this).text()); + }); + return soneIds.join(","); +} + +/** * Returns whether the current page is a “view post” page. * * @returns {Boolean} true if the current page is a “view post” @@ -1515,7 +1529,7 @@ function loadNewReply(replyId, soneId, postId, postSoneId) { * request */ function markSoneAsKnown(soneElement, skipRequest) { - if ($(soneElement).is(".new")) { + if ($(soneElement).hasClass("new")) { $(soneElement).removeClass("new"); if ((typeof skipRequest == "undefined") || !skipRequest) { ajaxGet("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "sone", "id": getSoneId(soneElement)});