Hide all replies but the last two.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 10 Nov 2010 11:24:49 +0000 (12:24 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 10 Nov 2010 11:24:49 +0000 (12:24 +0100)
src/main/resources/i18n/sone.en.properties
src/main/resources/static/css/sone.css
src/main/resources/templates/include/head.html

index a665bb4..bc149d8 100644 (file)
@@ -196,5 +196,6 @@ WebInterface.Confirmation.DeleteReplyButton=Yes, delete!
 WebInterface.SelectBox.Choose=Choose…
 WebInterface.SelectBox.Yes=Yes
 WebInterface.SelectBox.No=No
+WebInterface.ClickToShow.Replies=Click here to show hidden replies.
 
 Warning.PluginNotConnected.Text=The Web of Trust plugin could not be found! This can happen if the Web of Trust plugin is not loaded or if your node is currently still starting up. In the first case, load the Web of Trust plugin using the {link}plugin manager{/link}, in the second case wait until the Web of Trust plugin has been loaded, because in either case Sone will not be working unless the Web of Trust plugin is loaded!
index 9590874..74f9c93 100644 (file)
@@ -204,6 +204,13 @@ textarea {
        padding-top: 0.2ex;
 }
 
+#sone .post .replies .click-to-show {
+       background-color: #f0f0ff;
+       font-size: 85%;
+       padding: 0.5em;
+       cursor: pointer;
+}
+
 #sone .post .reply > .avatar {
        position: absolute;
 }
index c1ea806..f4eddf8 100644 (file)
        </script>
 
        <script language="javascript">
+               /* hides all replies but the latest two. */
+               $(document).ready(function() {
+                       $("#sone .post .replies").each(function() {
+                               allReplies = $(this).find(".reply");
+                               if (allReplies.length > 2) {
+                                       for (replyIndex = 0; replyIndex < (allReplies.length - 2); ++replyIndex) {
+                                               $(allReplies[replyIndex]).addClass("hidden");
+                                       }
+                                       clickToShowElement = $("<div></div>").addClass("click-to-show");
+                                       (function(clickToShowElement, allReplies) {
+                                               getTranslation("WebInterface.ClickToShow.Replies", function(text) {
+                                                       clickToShowElement.text(text);
+                                               });
+                                               clickToShowElement.click(function() {
+                                                       allReplies.removeClass("hidden");
+                                                       clickToShowElement.addClass("hidden");
+                                               });
+                                       })(clickToShowElement, allReplies);
+                                       $(allReplies[0]).before(clickToShowElement);
+                               }
+                       });
+               });
+       </script>
+
+       <script language="javascript">
                /* convert all “follow”, “unfollow”, “block”, and “unblock” links to something nicer. */
                $(document).ready(function() {
                        $("#sone .follow").submit(function() {