From: David ‘Bombe’ Roden Date: Fri, 26 Nov 2010 22:02:14 +0000 (+0100) Subject: Merge commit '0.3.1-RC3' into message-recipient X-Git-Tag: 0.3.2-RC1~15^2~2 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=a57e3b33c5837a40aa08c11fb92f600d928be1ab;hp=dab7b61577baa725e3b9343f69787153b6375196 Merge commit '0.3.1-RC3' into message-recipient --- diff --git a/pom.xml b/pom.xml index 2ac12a2..421e0bb 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 net.pterodactylus sone - 0.3.1-RC1 + 0.3.1-RC3 net.pterodactylus diff --git a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java index 527099c..ff14193 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -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); diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 7f09089..75facb3 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -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; + }) }); diff --git a/src/main/resources/templates/include/viewPost.html b/src/main/resources/templates/include/viewPost.html index 4b23b1f..ffc7608 100644 --- a/src/main/resources/templates/include/viewPost.html +++ b/src/main/resources/templates/include/viewPost.html @@ -17,7 +17,7 @@ <%/if>
<% post.text|html>
-
+
⬆
<%ifnull ! currentSone> diff --git a/src/main/resources/templates/include/viewReply.html b/src/main/resources/templates/include/viewReply.html index d0a7842..d77625b 100644 --- a/src/main/resources/templates/include/viewReply.html +++ b/src/main/resources/templates/include/viewReply.html @@ -9,7 +9,7 @@
<% reply.text|html>
-
+
<% reply.time|date format="MMM d, yyyy, HH:mm:ss">
⬆
<%ifnull ! currentSone>