Название вашего журнала (quwiero) wrote in changelog,
Название вашего журнала
quwiero
changelog

[livejournal] r22775: LJSUP-13004: Create a dynamic lj-cut

Committer: sboronchiev
LJSUP-13004: Create a dynamic lj-cut
U   trunk/cgi-bin/cleanhtml.pl
U   trunk/htdocs/stc/lj_base.css
Modified: trunk/cgi-bin/cleanhtml.pl
===================================================================
--- trunk/cgi-bin/cleanhtml.pl	2012-08-29 13:50:37 UTC (rev 22774)
+++ trunk/cgi-bin/cleanhtml.pl	2012-08-29 14:42:18 UTC (rev 22775)
@@ -750,7 +750,17 @@
                     my $etext = $link_text->();
                     my $url = LJ::ehtml($cut);
                     $newdata .= "<div>" if $tag eq "div";
-                    $newdata .= "<b class=\"ljcut-link\">(&nbsp;<a href=\"$url#cutid$cutcount\">$etext</a>&nbsp;)</b>";
+                    my $data_ids = "";
+                    if ($opts->{entry_url}) {
+                        my $entry = LJ::Entry->new_from_url($opts->{entry_url});
+                        my $ditemid = 0;
+                        my $journalid = $entry->journalid;
+                        if ($entry && $entry->valid) {
+                            $ditemid = $entry->ditemid;
+                        }
+                        $data_ids = qq(data-widget='ljcut' data-widget-options='{ "journalid": "$journalid", "ditemid": "$ditemid", "cutid": "$cutcount" }');
+                    }
+                    $newdata .= "<b $data_ids class=\"ljcut-link lj-widget\">(&nbsp;<a href=\"$url#cutid$cutcount\" class=\"ljcut-link-expand\">$etext</a><a href=\"javascript:void(0)\" class=\"ljcut-link-collapse\">".Encode::decode_utf8(LJ::Lang::ml("ljcut.collapse"))."</a>&nbsp;)</b>";
                     $newdata .= "</div>" if $tag eq "div";
                     unless ($opts->{'cutpreview'}) {
                         push @eatuntil, $tag;

Modified: trunk/htdocs/stc/lj_base.css
===================================================================
--- trunk/htdocs/stc/lj_base.css	2012-08-29 13:50:37 UTC (rev 22774)
+++ trunk/htdocs/stc/lj_base.css	2012-08-29 14:42:18 UTC (rev 22775)
@@ -4598,6 +4598,15 @@
     vertical-align: middle;
     font-size: 2em;
     }
+.ljcut-link .ljcut-link-collapse {
+	display: none;
+	}
+.ljcut-expanded .ljcut-link-collapse {
+	display: inline;
+	}
+.ljcut-expanded .ljcut-link-expand {
+	display: none;
+	}
 
 /* Trava object  
 --------------------------------------*/

Tags: css, livejournal, pl, quwiero, sboronchiev
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