Marks posts as known when clicking a new post or reply.
[Sone.git] / src / main / resources / static / javascript / sone.js
index 472df5a..4b60dd9 100644 (file)
@@ -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;
+               }
        }
 }