Merge commit '0.3.1-RC3' into message-recipient
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 26 Nov 2010 22:02:14 +0000 (23:02 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 26 Nov 2010 22:02:14 +0000 (23:02 +0100)
pom.xml
src/main/java/net/pterodactylus/sone/main/SonePlugin.java
src/main/resources/static/javascript/sone.js
src/main/resources/templates/include/viewPost.html
src/main/resources/templates/include/viewReply.html

diff --git a/pom.xml b/pom.xml
index 2ac12a2..421e0bb 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
        <modelVersion>4.0.0</modelVersion>
        <groupId>net.pterodactylus</groupId>
        <artifactId>sone</artifactId>
-       <version>0.3.1-RC1</version>
+       <version>0.3.1-RC3</version>
        <dependencies>
                <dependency>
                        <groupId>net.pterodactylus</groupId>
index 527099c..ff14193 100644 (file)
@@ -79,7 +79,7 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
        }
 
        /** The version. */
-       public static final Version VERSION = new Version("RC1", 0, 3, 1);
+       public static final Version VERSION = new Version("RC3", 0, 3, 1);
 
        /** The logger. */
        private static final Logger logger = Logging.getLogger(SonePlugin.class);
index 7f09089..75facb3 100644 (file)
@@ -63,7 +63,7 @@ function registerInputTextareaSwap(inputElement, defaultText, inputFieldName, op
  * @param element
  *            The element to add a “comment” link to
  */
-function addCommentLink(postId, element) {
+function addCommentLink(postId, element, insertAfterThisElement) {
        if ($(element).find(".show-reply-form").length > 0) {
                return;
        }
@@ -86,9 +86,7 @@ function addCommentLink(postId, element) {
                });
                return commentElement;
        })(postId);
-       $(element).find(".status-line .time").each(function() {
-               $(this).after(commentElement.clone(true));
-       });
+       $(insertAfterThisElement).after(commentElement.clone(true));
 }
 
 var translations = {};
@@ -484,6 +482,9 @@ function ajaxifyPost(postElement) {
                return false;
        });
 
+       /* add “comment” link. */
+       addCommentLink(getPostId(postElement), postElement, $(postElement).find(".post-status-line .time"));
+
        /* process all replies. */
        $(postElement).find(".reply").each(function() {
                ajaxifyReply(this);
@@ -493,12 +494,13 @@ function ajaxifyPost(postElement) {
        getTranslation("WebInterface.DefaultText.Reply", function(text) {
                $(postElement).find("input.reply-input").each(function() {
                        registerInputTextareaSwap(this, text, "text", false, false);
-                       addCommentLink(getPostId(postElement), postElement);
                });
        });
 
-       /* add “comment” link. */
-       addCommentLink(getPostId(postElement), postElement);
+       /* mark everything as known on click. */
+       $(postElement).click(function() {
+               markPostAsKnown(this);
+       });
 
        /* hide reply input field. */
        $(postElement).find(".create-reply").addClass("hidden");
@@ -528,7 +530,12 @@ function ajaxifyReply(replyElement) {
                        });
                });
        })(replyElement);
-       addCommentLink(getPostId(replyElement), replyElement);
+       addCommentLink(getPostId(replyElement), replyElement, $(replyElement).find(".reply-status-line .time"));
+
+       /* mark post and all replies as known on click. */
+       $(replyElement).click(function() {
+               markPostAsKnown(getPostElement(replyElement));
+       });
 }
 
 /**
@@ -693,9 +700,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;
+               }
        }
 }
 
@@ -725,6 +734,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. */
@@ -842,7 +853,10 @@ $(document).ready(function() {
 
        /* reset activity counter when the page has focus. */
        $(window).focus(function() {
+               focus = true;
                resetActivity();
-       });
+       }).blur(function() {
+               focus = false;
+       })
 
 });
index 4b23b1f..ffc7608 100644 (file)
@@ -17,7 +17,7 @@
                        <%/if>
                        <div class="text"><% post.text|html></div>
                </div>
-               <div class="status-line">
+               <div class="post-status-line status-line">
                        <div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
                        <div class="likes<%if post.likes.size|match value=0> hidden<%/if>"><span title="<% post.likes.soneNames|html>">⬆<span class="like-count"><% post.likes.size></span></span></div>
                        <%ifnull ! currentSone>
index d0a7842..d77625b 100644 (file)
@@ -9,7 +9,7 @@
                        <div class="author profile-link"><a href="viewSone.html?sone=<% reply.sone.id|html>"><% reply.sone.niceName|html></a></div>
                        <div class="text"><% reply.text|html></div>
                </div>
-               <div class="status-line">
+               <div class="reply-status-line status-line">
                        <div class="time"><% reply.time|date format="MMM d, yyyy, HH:mm:ss"></div>
                        <div class="likes<%if reply.likes.size|match value=0> hidden<%/if>"><span title="<% reply.likes.soneNames|html>">⬆<span class="like-count"><% reply.likes.size></span></span></div>
                        <%ifnull ! currentSone>