linterna-magica-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linterna-magica-commit] [266] YouTube optimisations and fixes.


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [266] YouTube optimisations and fixes.
Date: Mon, 02 Apr 2012 08:21:46 +0000

Revision: 266
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=266
Author:   valkov
Date:     2012-04-02 08:21:46 +0000 (Mon, 02 Apr 2012)
Log Message:
-----------
YouTube optimisations and fixes. Bugs #35992. Support #108009. Faster 
replacement when flash upgrade alerts are detected. Logic waiths longer for 
flash upgrade alerts. Fixed overlapping of Linterna Ma?\204?\129gica and HTML5 
player. Code tested and works in all browsers and versions.

Ticket Links:
------------
    http://savannah.gnu.org/bugs/?35992
    http://savannah.gnu.org/support/?108009

Modified Paths:
--------------
    trunk/src/lm_site_youtube.js

Modified: trunk/src/lm_site_youtube.js
===================================================================
--- trunk/src/lm_site_youtube.js        2012-03-06 08:22:25 UTC (rev 265)
+++ trunk/src/lm_site_youtube.js        2012-04-02 08:21:46 UTC (rev 266)
@@ -193,10 +193,30 @@
 {
     this.youtube_flash_upgrade_counter++;
 
-    // With default timeout 500mS this will be 3 sec. Stop checking and 
insert.    
+    // Fancy flash upgrade message. The element with id flash-upgrade
+    // might be obsolete now.
+    var watch_player = document.getElementById("watch-player");
+    var fancy_alert = null;
+
+    if(watch_player && watch_player.hasAttribute("class") &&
+       /flash-player/i.test(watch_player.getAttribute("class")))
+    {
+       var alert = watch_player.querySelector(".yt-alert-message");
+
+       if (alert && /flash player/i.test(alert.textContent))
+       {
+           fancy_alert = true;
+       }
+       
+    }
+    
+
+    // With default timeout 500mS this will be 6 sec. Stop checking and 
insert.    
     // Might be flashblock
     if (document.getElementById("flash-upgrade") ||
-       this.youtube_flash_upgrade_counter >= 6 )
+       document.getElementById("movie_player-html5") ||
+       fancy_alert ||
+       this.youtube_flash_upgrade_counter >= 12 )
     {
        clearInterval(this.youtube_flash_upgrade_timeout);
 
@@ -543,12 +563,39 @@
     {
        var html5_warning = html5_wrapper.querySelector(".video-fallback");
 
+       // The clips that are displayed as unavailable have different
+       // class. Sometimes?
+       //
+       // Fixes bug #35992 https://savannah.nongnu.org/bugs/?35992
+       if (!html5_warning)
+       {
+           html5_warning =
+               html5_wrapper.querySelector(".html5-video-fallback");
+       }
+
        if (html5_warning &&
            !/none/i.test(html5_warning.style.getPropertyValue('display')))
        {
            // Must hide the entire HTML5 wrapper, so Linterna Magica
            // will not be displaced.
            html5_wrapper.style.setProperty('display', "none", "important");
+
+           // Hide site controls and video container. Should not
+           // overlap with Linterna Magica now. Fixes the overlapping
+           // of HTML5 player and LM.
+           var controls = html5_wrapper.querySelector(".html5-video-controls");
+           var container = 
html5_wrapper.querySelector(".html5-video-container");
+
+           if (controls)
+           {
+               controls.style.setProperty("display", "none", "important");
+           }
+
+           if (container)
+           {
+               container.style.setProperty("display", "none", "important");
+           }
+
        }
     }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]