ssafronova (ssafronova) wrote in changelog,
ssafronova
ssafronova
changelog

[livejournal] r16307: LJSUP-5497: Add ShareThis! button to LJC...

Committer: ssafronova
LJSUP-5497: Add ShareThis! button to LJCOM - fixed bug
U   trunk/bin/upgrading/s2layers/core1.s2
U   trunk/cgi-bin/LJ/S2.pm
Modified: trunk/bin/upgrading/s2layers/core1.s2
===================================================================
--- trunk/bin/upgrading/s2layers/core1.s2	2010-03-03 08:05:38 UTC (rev 16306)
+++ trunk/bin/upgrading/s2layers/core1.s2	2010-03-03 08:16:31 UTC (rev 16307)
@@ -192,13 +192,15 @@
     var Image icon
     "A suggestion from the server as to which icon to use. layouts/users can override this of course.
     alt text works similarly to [member[Link.caption]].";
-    var readonly string raw "Raw html code instead of link parameters";
 
     function print_button
     "Output this Link as a clickable button using [member[Link.icon]]";
 
     function as_string() : string
     "Return the button HTML link.";
+
+    function builtin print_raw() 
+    "Output additional link HTML code.";   
 }
 
 class ItemRange
@@ -2307,6 +2309,7 @@
     foreach var string k ($.link_keyseq) {
         $link = $this->get_link($k);
         " $link ";
+        $link->print_raw();
     }
     if ($show_interentry) {
         $this->print_link_next();
@@ -2629,13 +2632,7 @@
 
 function Link::as_string() [fixed] : string {
 
-    if ($.url == "") { 
-        if ($.raw) {
-            return $.raw;
-        } else {
-            return "";
-        }
-    }
+    if ($.url == "") { return ""; }
     var string ealt = ehtml($.caption);
     var string{} extra = $.icon.extra;
     var string extraParams = "";
@@ -2644,7 +2641,7 @@
         $extraParams = $extraParams + """$extraKey="$extra{$extraKey}" """;
     }
 
-    return """<a href="$.url"><img border='0' width="$.icon.width" height="$.icon.height" alt="$ealt" title="$ealt" src="$.icon.url" $extraParams /></a>$.raw""";
+    return """<a href="$.url"><img border='0' width="$.icon.width" height="$.icon.height" alt="$ealt" title="$ealt" src="$.icon.url" $extraParams /></a>""";
 }
 
 # Redirector

Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2010-03-03 08:05:38 UTC (rev 16306)
+++ trunk/cgi-bin/LJ/S2.pm	2010-03-03 08:16:31 UTC (rev 16307)
@@ -2047,7 +2047,7 @@
         'caption' => $caption,
         'url'     => $url,
         'icon'    => $icon,
-        'raw'     => '',
+        '_raw'     => '',
     };
 
     return $lnk;
@@ -2965,6 +2965,11 @@
     return $new;
 }
 
+sub Link__print_raw {
+    my ($ctx, $this) = @_;
+    $S2::pout->($this->{_raw}) if $this->{_raw};
+}
+
 sub _Comment__get_link
 {
     my ($ctx, $this, $key) = @_;
@@ -3611,7 +3616,7 @@
         my $entry_url = $entry->url;
         my $entry_title = LJ::ejs($entry->subject_html);
         my $link = LJ::S2::Link("#", $ctx->[S2::PROPS]->{"text_share_this"}, LJ::S2::Image("$LJ::IMGPREFIX/btn_sharethis.gif", 24, 24));
-        $link->{raw} = qq|<script type="text/javascript">
+        $link->{_raw} = qq|<script type="text/javascript">
             SHARETHIS.addEntry({url:'$entry_url', title: '$entry_title'}, {button: false})
                 .attachButton(jQuery('a:last')[0]);
             </script>|;

Tags: livejournal, pm, s2, ssafronova
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