X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=a0bbf8aa47441c97bd003ee799785dad5ed0871b;hp=35b53e3c22f07f4dffbc08b846b3db864059dca6;hb=ecf753a31601e558b681daab0598009fe9eec99a;hpb=92e44c7068d88f23a29a4f82da3b91135c3ef2f2 diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 35b53e3..a0bbf8a 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -692,9 +692,17 @@ function ajaxifyReply(replyElement) { * jQuery object representing the notification. */ function ajaxifyNotification(notification) { - notification.find("form.dismiss").submit(function() { + notification.find("form").submit(function() { return false; }); + notification.find("input[name=returnPage]").val($.url.attr("relative")); + if (notification.find(".short-text").length > 0) { + notification.find(".short-text").removeClass("hidden"); + notification.find(".text").addClass("hidden"); + } + notification.find("form.mark-as-read button").click(function() { + $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": $(":input[name=id]", this.form).val()}); + }); notification.find("form.dismiss button").click(function() { $.getJSON("dismissNotification.ajax", { "formPassword" : getFormPassword(), "notification" : notification.attr("id") }, function(data, textStatus) { /* dismiss in case of error, too. */ @@ -936,7 +944,7 @@ function markPostAsKnown(postElements) { postElement = this; if ($(postElement).hasClass("new")) { (function(postElement) { - $.getJSON("markPostAsKnown.ajax", {"formPassword": getFormPassword(), "post": getPostId(postElement)}, function(data, textStatus) { + $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "post", "id": getPostId(postElement)}, function(data, textStatus) { $(postElement).removeClass("new"); $(".click-to-show", postElement).removeClass("new"); }); @@ -951,7 +959,7 @@ function markReplyAsKnown(replyElements) { replyElement = this; if ($(replyElement).hasClass("new")) { (function(replyElement) { - $.getJSON("markReplyAsKnown.ajax", {"formPassword": getFormPassword(), "reply": getReplyId(replyElement)}, function(data, textStatus) { + $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "reply", "id": getReplyId(replyElement)}, function(data, textStatus) { $(replyElement).removeClass("new"); }); })(replyElement);