vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r21562: LJSUP-11456: Add link Collapse to Video ...

Committer: vad
LJSUP-11456: Add link Collapse to Video block on cyr home page
U   trunk/cgi-bin/LJ/Widget.pm
Modified: trunk/cgi-bin/LJ/Widget.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget.pm	2012-03-27 14:05:06 UTC (rev 21561)
+++ trunk/cgi-bin/LJ/Widget.pm	2012-03-27 14:17:15 UTC (rev 21562)
@@ -132,9 +132,20 @@
     } elsif (ref $class && $class->{'no_container_div'}) {
         return $rv;
     } else {
+        ## allow user to collapse some widgets
+        my $is_collapsed = eval {
+            return '' unless LJ::is_web_context();
+            my $clpsd = LJ::Request->cookie('clpsd');
+            return 0 unless $clpsd;
+            my ($block_id) = $widget_ele_id =~ /(\d+)$/;
+            return 1 if $clpsd =~ /(^|,)\Q$block_id\E(,|$)/; ## collapsed
+            return 0;
+        };
+
         my $collapsable_class = $class->collapsable ? 'appwidget-prop-collapsable' : '';
+        my $collapsed_class   = ($class->collapsable and $is_collapsed) ? ' appwidget-prop-collapsed' : ''; 
         return 
-            "<div class='appwidget appwidget-$css_subclass $collapsable_class' id='$widget_ele_id'>\n" .
+            "<div class='appwidget appwidget-$css_subclass $collapsable_class $collapsed_class' id='$widget_ele_id'>\n" .
             $rv .
             "</div><!-- end .appwidget-$css_subclass -->\n";
     }

Tags: livejournal, pm, vad, vadvs
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