changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[ljcom] r9614: LJSUP-6481 Use ExpanderEx.

Committer: dnikolaev
LJSUP-6481 Use ExpanderEx.

U   trunk/cgi-bin/LJ/Hooks/SUP.pm
Modified: trunk/cgi-bin/LJ/Hooks/SUP.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/SUP.pm	2010-10-12 05:29:30 UTC (rev 9613)
+++ trunk/cgi-bin/LJ/Hooks/SUP.pm	2010-10-12 07:44:13 UTC (rev 9614)
@@ -638,12 +638,53 @@
 ## This hook is called from both S2 journals and talkread.bml
 ##
 LJ::register_hook('show_thread_expander', sub {
-    return 0 if $LJ::DISABLED{thread_expander};
-    my $u = LJ::load_userid(LJ::Request->notes("journalid"));
-    return 1 if $u && $u->get_cap('thread_expander');
-    my $remote = LJ::get_remote();
-    return 1 if $remote && $remote->get_cap('thread_expander');
-    return 0;
+    my $args = shift;
+
+    my $thread_expander_old = sub {
+        
+    };
+
+    my $thread_expander_new = sub {
+        my $args = shift;
+
+        if ($args->{thread_loaded}) {
+            if ($args->{has_closed_children}) {
+                return "(<a href='$args->{thread_url}' " . 
+                       qq[onClick="ExpanderEx.make(this,'$args->{thread_url}','$args->{thread_id}',true);return false;"] .
+                       ">" . BML::ml('talk.expandlink') . "</a>)";
+            }
+            elsif ($args->{thread_show_collapse}) {
+                return "(<a href='$args->{thread_url}' " .
+                       qq[onClick="ExpanderEx.collapse(this,'$args->{thread_url}','$args->{thread_id}',true);return false;"] .
+                       ">" . BML::ml('talk.collapselink') . "</a>)";
+            }
+            else {
+                return '';
+            }
+        }
+        else {
+            return "(<a href='$args->{thread_url}' " .
+                   qq[onClick="ExpanderEx.make(this,'$args->{thread_url}','$args->{thread_id}',true);return false;"] .
+                   ">" . BML::ml('talk.expandlink') . "</a>)";
+        }  
+    };
+    
+    if ($args && $args->{is_s1}) {
+        return undef if $LJ::DISABLED{thread_expander};
+        my $u = LJ::load_userid(LJ::Request->notes("journalid"));
+        return $thread_expander_new if $u && $u->get_cap('thread_expander');
+        my $remote = LJ::get_remote();
+        return $thread_expander_new if $remote && $remote->get_cap('thread_expander');
+        return undef;
+    }
+    else {
+        return 0 if $LJ::DISABLED{thread_expander};
+        my $u = LJ::load_userid(LJ::Request->notes("journalid"));
+        return 1 if $u && $u->get_cap('thread_expander');
+        my $remote = LJ::get_remote();
+        return 1 if $remote && $remote->get_cap('thread_expander');
+        return 0;
+    }
 });
 
 LJ::register_hook("subscriptions_manage_my_account_extra", sub {

Tags: changelog_bot, ljcom, pm
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments