X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=0d413b90bf0b8c496fe8f258eec04c86732c3d6a;hp=f167d69fd0cabc67c89c9baca5e706dd5f032bc8;hb=fc3a916e86e1697c5df0fac3a83bdee873f47da9;hpb=cd13fe03bf2905915b3043af19480594c88e3f16 diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index f167d69..0d413b9 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -218,7 +218,8 @@ function enhanceDeletePostButton(button, postId, text) { if (data.success) { $("#sone .post#" + postId).slideUp(); } else if (data.error == "invalid-post-id") { - alert("Invalid post ID given!"); + /* pretend the post is already gone. */ + getPost(postId).slideUp(); } else if (data.error == "auth-required") { alert("You need to be logged in."); } else if (data.error == "not-authorized") { @@ -249,7 +250,8 @@ function enhanceDeleteReplyButton(button, replyId, text) { if (data.success) { $("#sone .reply#" + replyId).slideUp(); } else if (data.error == "invalid-reply-id") { - alert("Invalid reply ID given!"); + /* pretend the reply is already gone. */ + getReply(replyId).slideUp(); } else if (data.error == "auth-required") { alert("You need to be logged in."); } else if (data.error == "not-authorized") { @@ -999,6 +1001,10 @@ function getStatus() { } $(this).slideUp("normal", function() { $(this).remove(); + /* remove activity when no notifications are visible. */ + if ($("#sone #notification-area .notification").length == 0) { + resetActivity(); + } }); } }); @@ -1361,6 +1367,7 @@ function resetActivity() { if (title.indexOf('(') == 0) { setTitle(title.substr(title.indexOf(' ') + 1)); } + iconBlinking = false; } function setActivity() { @@ -1399,7 +1406,7 @@ var iconBlinking = false; * showing the activity state, it is returned to normal. */ function toggleIcon() { - if (focus) { + if (focus || !iconBlinking) { if (iconActive) { changeIcon("images/icon.png"); iconActive = false;