X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=4b60dd91898571ddc4a075b6cd329b9f67ac743e;hb=5db08d4142418ed4e53056bdda108d4de3f879e2;hp=f195d5943a43b466d171baa97ed55bea236a45a1;hpb=46ad26b66e978c531f563a51a4ff6a2908816947;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index f195d59..4b60dd9 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -608,7 +608,9 @@ function loadNewPost(postId) { return false; } }); - newPost = $(data.post.html).addClass("hidden"); + newPost = $(data.post.html).addClass("hidden").click(function() { + markPostAsKnown(this); + }); if (firstOlderPost != null) { newPost.insertBefore(firstOlderPost); } else { @@ -637,7 +639,9 @@ function loadNewReply(replyId) { return false; } }); - newReply = $(data.reply.html).addClass("hidden"); + newReply = $(data.reply.html).addClass("hidden").click(function() { + markPostAsKnown(getPostElement(this)); + }); if (firstNewerReply != null) { newReply.insertBefore(firstNewerReply); } else { @@ -690,9 +694,11 @@ function resetActivity() { } function setActivity() { - title = document.title; - if (title.indexOf('(') != 0) { - document.title = "(!) " + title; + if (!focus) { + title = document.title; + if (title.indexOf('(') != 0) { + document.title = "(!) " + title; + } } } @@ -722,6 +728,8 @@ function createNotification(id, text, dismissable) { // EVERYTHING BELOW HERE IS EXECUTED AFTER LOADING THE PAGE // +var focus = true; + $(document).ready(function() { /* this initializes the status update input field. */ @@ -824,7 +832,10 @@ $(document).ready(function() { /* reset activity counter when the page has focus. */ $(window).focus(function() { + focus = true; resetActivity(); - }); + }).blur(function() { + focus = false; + }) });