Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r19519: LJSUP-9331: Add param 'wmode=opaque' to ...

Committer: gariev
LJSUP-9331: Add param 'wmode=opaque' to youtube iframe URL

U   trunk/htdocs/tools/embedcontent.bml
Modified: trunk/htdocs/tools/embedcontent.bml
===================================================================
--- trunk/htdocs/tools/embedcontent.bml	2011-07-25 06:57:13 UTC (rev 19518)
+++ trunk/htdocs/tools/embedcontent.bml	2011-07-25 07:01:44 UTC (rev 19519)
@@ -32,6 +32,18 @@
         );
         LJ::run_hooks('modify_embed_content', \$content, \%GET);
 
+        my $transform_youtube_url = sub {
+            my $url = shift;
+            if ($url =~ /\?/) {
+                $url =~ s/\?/?wmode=opaque&/;
+            } else {
+                $url .= "?wmode=opaque";
+            }
+            return $url;
+        };
+
+        $content =~ s!src=(["'])(https?://www\.youtube\.com/embed/.*?)\1! 'src=' . $transform_youtube_url->($2) . '"' !ige;
+
         return qq {<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>iframe</title><style type="text/css">HTML, BODY { background:transparent; padding:0; margin:0; border:0; overflow:hidden; }</style></head><body>$content</body></html>};
     }
 } 

Tags: bml, gariev, livejournal
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