X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=e07a08b982ebd4e30b0b396a72dc9eeaaa085319;hb=13871054ecbb38722714d7e0c88c4024103c3f86;hp=f872daeaa916bcb0151c3d815f0217fb9d55ff18;hpb=bd04c3d0948baacb29153d52bcb9f0a0b8b040dc;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index f872dae..e07a08b 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -17,23 +17,6 @@ function ajaxGet(url, data, successCallback, errorCallback) { })(url, data, successCallback, errorCallback); } -function ajaxPost(url, data, successCallback, errorCallback) { - (function(url, data, successCallback, errorCallback) { - $.ajax({"type": "POST", "url": url, "data": data, "dataType": "json", "success": function(data, textStatus, xmlHttpRequest) { - ajaxSuccess(); - if (typeof successCallback != "undefined") { - successCallback(data, textStatus); - } - }, "error": function(xmlHttpRequest, textStatus, errorThrown) { - if (typeof errorCallback != "undefined") { - errorCallback(); - } else { - ajaxError(); - } - }}); - })(url, data, successCallback, errorCallback); -} - function registerInputTextareaSwap(inputElement, defaultText, inputFieldName, optional, dontUseTextarea) { $(inputElement).each(function() { textarea = $(dontUseTextarea ? "" : "").blur(function() { @@ -880,7 +863,7 @@ function ajaxifyNotification(notification) { notification.find(".text").addClass("hidden"); } notification.find("form.mark-as-read button").click(function() { - ajaxPost("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": $(":input[name=id]", this.form).val()}); + ajaxGet("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": $(":input[name=id]", this.form).val()}); }); notification.find("a[class^='link-']").each(function() { linkElement = $(this); @@ -1319,12 +1302,12 @@ function markPostAsKnown(postElements, skipRequest) { if ($(postElement).hasClass("new")) { (function(postElement) { $(postElement).removeClass("new"); - $(".click-to-show", postElement).removeClass("new"); if ((typeof skipRequest == "undefined") || !skipRequest) { ajaxGet("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": "post", "id": getPostId(postElement)}); } })(postElement); } + $(".click-to-show", postElement).removeClass("new"); }); markReplyAsKnown($(postElements).find(".reply")); } @@ -1726,7 +1709,7 @@ $(document).ready(function() { allReplies = $(this).find(".reply"); if (allReplies.length > 2) { newHidden = false; - for (replyIndex = 0; replyIndex < (allReplies.length - 2); ++replyIndex) { + for (replyIndex = 0; !newHidden && (replyIndex < (allReplies.length - 2)); ++replyIndex) { $(allReplies[replyIndex]).addClass("hidden"); newHidden |= $(allReplies[replyIndex]).hasClass("new"); }