summaryrefslogtreecommitdiff
path: root/js/expand.js
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2014-08-10 20:55:37 +0200
committerczaks <marcin@6irc.net>2014-08-10 20:55:37 +0200
commit4d25ca85ce670e59806ea392855c6b3878519ee8 (patch)
tree6a8084c06b1a9f41ebb89bb75405940c15765848 /js/expand.js
parent5cd435f1765fca5453188084cafad65c41a1dcb2 (diff)
live-index.js: initial commit
Diffstat (limited to 'js/expand.js')
-rw-r--r--js/expand.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/js/expand.js b/js/expand.js
index 0256aebe..0fa8de05 100644
--- a/js/expand.js
+++ b/js/expand.js
@@ -20,8 +20,8 @@ $(document).ready(function(){
var do_expand = function() {
$(this)
.html($(this).text().replace(_("Click reply to view."), '<a href="javascript:void(0)">'+_("Click to expand")+'</a>.'))
- .find('a').click(function() {
- var thread = $(this).parent().parent().parent();
+ .find('a').click(window.expand_fun = function() {
+ var thread = $(this).parents('[id^="thread_"]');
var id = thread.attr('id').replace(/^thread_/, '');
$.ajax({
url: thread.find('p.intro a.post_no:first').attr('href'),
@@ -43,12 +43,16 @@ $(document).ready(function(){
last_expanded = post_in_doc;
}
});
- $('<span class="omitted"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>')
- .insertAfter(thread.find('span.omitted').css('display', 'none'))
+
+
+ thread.find("span.omitted").css('display', 'none');
+
+ $('<span class="omitted hide-expanded"><a href="javascript:void(0)">' + _('Hide expanded replies') + '</a>.</span>')
+ .insertAfter(thread.find('.op div.body, .op span.omitted').last())
.click(function() {
thread.find('.expanded').remove();
- $(this).prev().css('display', '');
- $(this).remove();
+ $(this).parent().find(".omitted:not(.hide-expanded)").css('display', '');
+ $(this).parent().find(".hide-expanded").remove();
});
}
});