2heoh (2heoh) wrote in changelog,
2heoh
2heoh
changelog

[livejournal] r18284: added video ID attribute to lj-embed for...

Committer: slobin
added video ID attribute to lj-embed for youtube embed objects

M EmbedModule.pm
U   trunk/cgi-bin/LJ/EmbedModule.pm
Modified: trunk/cgi-bin/LJ/EmbedModule.pm
===================================================================
--- trunk/cgi-bin/LJ/EmbedModule.pm	2011-02-11 10:46:07 UTC (rev 18283)
+++ trunk/cgi-bin/LJ/EmbedModule.pm	2011-02-12 06:53:42 UTC (rev 18284)
@@ -125,6 +125,19 @@
                 (" target=\"" . $opts{expand_to_link}->{target} . "\"") : ''
             ) .
             ">" . $opts{expand_to_link}->{caption} . "</a>";
+    } elsif ($opts{get_youtube_id}) {
+        my $code = $class->module_content(moduleid  => $attrs{id}, journalid => $journal->id);        
+
+        my $out=  '<lj-embed id="'. $attrs{id} .'" ';
+
+        if($code =~ m!src="http://www\.youtube\.com/embed/([\w\d\_\-]+)"!) {
+            $out .= 'vid="'.$1.'" ';
+        }
+
+        $out .= ' />';
+
+        return $out;
+        
     } else {
         @opts{qw /width height/} = @attrs{qw/width height/};
         return $class->module_iframe_tag($journal, $attrs{id}, %opts)

Tags: 2heoh, livejournal, 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