]> git.wh0rd.org Git - tt-rss.git/commitdiff
rework appearance of audio/video tags patch
authorAndrew Dolgov <fox@bah.org.ru>
Mon, 22 Jun 2009 12:50:17 +0000 (16:50 +0400)
committerAndrew Dolgov <fox@bah.org.ru>
Mon, 22 Jun 2009 12:50:17 +0000 (16:50 +0400)
functions.js
functions.php
tt-rss.css

index 5c1b26a5951ebc41cb73317a91f53be6b7ab44da..81cadfe0834582294ff2e4e6b59449dd1f076a7f 100644 (file)
@@ -2134,25 +2134,29 @@ function truncate_string(s, length) {
        return tmp;
 }
 function switchToFlash(e) {
-        var targ = e;
-        if (!e) var e = window.event;
-        if (e.target) targ = e.target;
-        else if (e.srcElement) targ = e.srcElement;
-        if (targ.nodeType == 3) // defeat Safari bug
-                targ = targ.parentNode;
-
-        //targ is the link that was clicked
-        var audioTag=targ;
-        do {
-                audioTag=audioTag.previousSibling;
-        } while(audioTag && audioTag.nodeType != 1)
-
-        var flashPlayer = audioTag.getElementsByTagName('div')[0];
-        targ.parentNode.insertBefore(flashPlayer,targ);
-        targ.parentNode.removeChild(targ);
-        audioTag.parentNode.removeChild(audioTag);
-
-        return false;
+       try {
+               var targ = e;
+               if (!e) var e = window.event;
+               if (e.target) targ = e.target;
+               else if (e.srcElement) targ = e.srcElement;
+               if (targ.nodeType == 3) // defeat Safari bug
+                       targ = targ.parentNode;
+               
+               //targ is the link that was clicked
+               var audioTag=targ;
+               do {
+                       audioTag=audioTag.previousSibling;
+               } while(audioTag && audioTag.nodeType != 1)
+               
+               var flashPlayer = audioTag.getElementsByTagName('span')[0];
+               targ.parentNode.insertBefore(flashPlayer,targ);
+               targ.parentNode.removeChild(targ);
+               audioTag.parentNode.removeChild(audioTag);
+
+               return false;
+       } catch (e) {
+               exception_error("switchToFlash", e);
+       }
 }
 function html5AudioOrFlash(type) {
        var audioTag = document.createElement('audio');
index da1326be2e8d6d385ccb2e5eefbd6afc4cc2e09b..aeca923620bff7045d4d843a01c65bce6f4008a8 100644 (file)
                                                $entry .= "<audio controls=\"controls\"><source src=\"$url\" type=\"$ctype\" />";
                                                if (($ctype == __("audio/mpeg")) && 
                                                        (get_pref($link, "ENABLE_FLASH_PLAYER")) ) { 
-                                                       $entry .= "<div><object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object></div>";
+                                                       $entry .= "<span><object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object></span>";
                                                }
-                                               $entry .= "</audio>";
+                                               $entry .= "</audio> ";
                                                if (($ctype == __("audio/mpeg")) && 
                                                        (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
-                                                       $entry .= "<a id='switchToFlashLink' href='#' onclick='return switchToFlash(this)'>".__('Switch to Flash Player')."</a><br />"; 
+                                                       $entry .= "<a id='switchToFlashLink' href='#' onclick='return switchToFlash(this)'>".__('Switch to Flash Player')."</a>";       
                                                        $entry .= "<script type='text/javascript'>html5AudioOrFlash('$ctype');</script>"; 
                                                }
                                        } elseif (substr($ctype,0,6)=="video/") {
                                                $entry .= "<audio controls=\"controls\"><source src=\"$url\" type=\"$ctype\" />";
                                                if (($ctype == __("audio/mpeg")) && 
                                                        (get_pref($link, "ENABLE_FLASH_PLAYER")) ) { 
-                                                       $entry .= "<div><object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object></div>";
+                                                       $entry .= "<span><object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object></span>";
                                                }
-                                               $entry .= "</audio>";
+                                               $entry .= "</audio> ";
                                                if (($ctype == __("audio/mpeg")) && 
                                                        (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
-                                                       $entry .= "<a id='switchToFlashLink' href='#' onclick='return switchToFlash(this)'>".__('Switch to Flash Player')."</a><br />"; 
+                                                       $entry .= "<a id='switchToFlashLink' href='#' onclick='return switchToFlash(this)'>".__('Switch to Flash Player')."</a>";       
                                                        $entry .= "<script type='text/javascript'>html5AudioOrFlash('$ctype');</script>"; 
                                                }
                                        } elseif (substr($ctype,0,6)=="video/") {
index 3946d6fcbd00c87df0b3d47d31f0ed246612288a..d12e286a2ab3e567510eee91ab6961c07bfce8ff 100644 (file)
@@ -2193,3 +2193,4 @@ optgroup {
 option {
        color : black;
 }
+