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

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

[linterna-magica-commit] [156] Changes for tasks #11216.


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [156] Changes for tasks #11216.
Date: Tue, 26 Jul 2011 07:55:58 +0000

Revision: 156
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=156
Author:   valkov
Date:     2011-07-26 07:55:44 +0000 (Tue, 26 Jul 2011)
Log Message:
-----------
Changes for tasks #11216. Added rule for site specific CSS fixes.

Ticket Links:
------------
    http://savannah.gnu.org/task/?11216

Modified Paths:
--------------
    branches/task-11216/src/lm_about.js
    branches/task-11216/src/lm_create_video_object.js
    branches/task-11216/src/lm_site_mqstocom.js
    branches/task-11216/src/lm_site_reuters.js
    branches/task-11216/src/lm_site_tv7bg.js
    branches/task-11216/src/lm_site_vimeo.js
    branches/task-11216/src/lm_site_youtube.js
    branches/task-11216/src/lm_sites.js

Modified: branches/task-11216/src/lm_about.js
===================================================================
--- branches/task-11216/src/lm_about.js 2011-07-25 14:31:12 UTC (rev 155)
+++ branches/task-11216/src/lm_about.js 2011-07-26 07:55:44 UTC (rev 156)
@@ -131,13 +131,6 @@
     p.appendChild(microblog_link);
     box.appendChild(p);
 
-    // We want this for small objects. Scroll bars will be visible and
-    // license and home page links accessible.
-    if (!/youtube\.com/i.test(window.location.hostname))
-    {
-       box.style.setProperty("overflow", "auto", "important");
-    }
-
     return box;
 }
 

Modified: branches/task-11216/src/lm_create_video_object.js
===================================================================
--- branches/task-11216/src/lm_create_video_object.js   2011-07-25 14:31:12 UTC 
(rev 155)
+++ branches/task-11216/src/lm_create_video_object.js   2011-07-26 07:55:44 UTC 
(rev 156)
@@ -312,14 +312,6 @@
     {
        toggle_plugin = this.create_toggle_plugin_link(this.priority, id);
 
-       // Fix displacement of toggle_plugin link/button in vimeo
-       if (/vimeo\.com/i.test(window.location.hostname))
-       {
-           toggle_plugin.style.setProperty("top", 
-                                           parseInt(object_data.height)+10+
-                                           "px", "important");
-       }
-
        var before = this.get_flash_video_object(id).nextSibling;
 
        if (before)
@@ -383,73 +375,27 @@
        }
     }
 
-    // Various CSS fix-ups
+    // Defaults style fixes applied always.
+    about_box.style.setProperty("overflow", "auto", "important");
+
     container.style.setProperty("height",
                                ((parseInt(object_data.height)+26+
                                  (this.controls ? 24 : 0))+"px"),
                                "important");
 
-    // In channels/user pages in YouTube the web controlls are
-    // overlapped by this element.
-    if (/youtube\.com/i.test(window.location.hostname) &&
-       document.getElementById("playnav-playview"))
-    {
-       var el =        document.getElementById("playnav-playview");
-       el.style.setProperty("margin-top", "50px", "important");
-    }
-
-    // The thumbnail image overlaps the toggle plugin button after our
-    // changes. This way our button is visible.
-    if (/vimeo\.com/i.test(window.location.hostname) && 
-       object_data.parent.firstChild)
-    {
-       // The first child should be a div with thumbnail as
-       // background. Reduce it's size so it will not overlap our
-       // button.
-       object_data.parent.firstChild.style.
-           setProperty("height", parseInt(object_data.height)+"px",
-                       "important");
-    }
-
     if (object_data.parent)
     {
-       var move_down_fb_frame = null;
-       if (/mqsto\.com/i.test(window.location.hostname))
-       {
-           // Move the facebook comment frame in mqsto.com 100px
-           // down. overlaps the player.
-           move_down_fb_frame = 100;
-       }
-
        object_data.parent.style.setProperty("height",
                                             (parseInt(object_data.height)+
-                                             26+(move_down_fb_frame ? 
-                                                 move_down_fb_frame: 0)+
+                                             26+
                                              // borders 1px x 2
                                              2+
                                              (this.controls ? 24 : 0))+"px",
                                             "important");
-
-       // Show HD links list. 
-       if (/vimeo\.com/i.test(window.location.hostname))
-       {
-           object_data.parent.style.
-               setProperty("overflow", "visible", "important");
-
-           object_data.parent.parentNode.style.
-               setProperty("overflow", "visible", "important");
-       }
-       // if (/vimeo\.com/i.test(window.location.hostname))
-       // {
-       //     // object_data.parent.parentNode.style.
-       //     //       setProperty("overflow-y", "visible", "important");
-
-       //     // Hides the HD links menu
-       //     // object_data.parent.parentNode.style.
-       //     //       setProperty("overflow-x", "hidden", "important");
-       // }
     }
 
+    
+
     var dom_object = this.get_flash_video_object(id);
     // Objects extracted from script usually does not have cloned object
     // For example youtube
@@ -458,26 +404,18 @@
        // Prevent the object to fill the container at 100% (if set)
        // This way the toggle plugin link after the object is not
        // overlaping elements.
-       dom_object.style.setProperty("height",
-                                                object_data.height+"px",
-                                                "important");
+       dom_object.style.setProperty("height", object_data.height+"px",
+                                    "important");
     }
+
     // Prevent the video object to fill the area at 100% and overlap
     // other elements. This happends if the site CSS sets this
-    object_tag.style.setProperty("height",
-                                object_data.height+"px",
+    object_tag.style.setProperty("height", object_data.height+"px",
                                 "important");
 
-    object_tag.style.setProperty("width",
-                                object_data.width+"px",
+    object_tag.style.setProperty("width", object_data.width+"px",
                                 "important");
 
-    // No idea what this fixes.
-    if (/vimeo\.com/i.test(window.location.href))
-    {
-       object_tag.style.setProperty("position","relative","important");
-    }
-
     if (this.plugin_is_installed)
     {
        // Remove backrounds so the toggle plugin link is visible
@@ -500,66 +438,6 @@
     // parent.parentNode is not an object
     if (object_data.parent && object_data.parent.parentNode)
     {
-
-       // The CSS hides parts of our elements
-       if (/tv7\.bg/i.test(window.location.hostname) ||
-           /vimeo\.com/i.test(window.location.hostname))
-       {
-           object_data.parent.parentNode.style.
-               setProperty("height",
-                           (parseInt(object_data.height)+26+
-                            // borders 1px x 2
-                            2+
-                            (this.controls ? 24 : 0)  )+"px",
-                           "important");
-
-           object_data.parent.parentNode.style.
-               setProperty("width",
-                           (parseInt(object_data.width+2))+"px",
-                           "important");
-       }
-
-       if (/tv7\.bg/i.test(window.location.hostname) ||
-           /vimeo\.com/i.test(window.location.hostname))
-       {
-           var third_parent = object_data.parent.parentNode.parentNode;
-           if (third_parent)
-           {
-               third_parent.style.setProperty("overflow", "visible", 
"important");
-               third_parent.style.
-                   setProperty("height", 
-                               (parseInt(object_data.height)+26+
-                                // borders 1px x 2
-                                2+
-                                (this.controls ? 24 : 0)  )+"px",
-                               "important");
-           }
-       }
-
-       if (/vimeo\.com/i.test(window.location.hostname) ||
-           /reuters\.com/i.test(window.location.hostname))
-       {
-           // Extra height for reuters.com. Otherwise the controlls
-           // are hidden.
-           var reuters = 
-               /reuters\.com/i.test(window.location.hostname) ? 100 : 0;
-
-           var fourth_parent = 
object_data.parent.parentNode.parentNode.parentNode;
-           if (fourth_parent)
-           {
-               fourth_parent.style.setProperty("overflow", "visible", 
"important");
-               fourth_parent.style.
-                   setProperty("height", 
-                               (parseInt(object_data.height)+26+
-                                reuters+
-                                // borders 1px x 2
-                                2+
-                                (this.controls ? 24 : 0)  )+"px",
-                               "important");
-           }
-       }
-
-
        // dailymotion.com && metacafe.com && btn.bg
        // These have single div inside another one
        // which (through height) overlaps elemenst
@@ -587,16 +465,6 @@
        }
     }
 
-    // Bug #33504 https://savannah.nongnu.org/bugs/?33504
-    if (/youtube\.com/i.test(window.location.hostname))
-    {
-       object_data.parent.style.setProperty("overflow", 
-                                            "visible", "important");
-    }
-
-    // Temporary
-    // parent.style.setProperty("border", "1px solid red", "important");
-
     // Init the web controls functions
     // only if Linterna Mágica has priority
     if (this.controls &&
@@ -608,5 +476,11 @@
     // Examine the option for updates and check if necessary.
     this.check_for_updates();
 
+    // Various CSS fixes
+    var self = this;
+    var val = this.call_site_function_at_position.apply(self,[
+       "css_fixes",
+       window.location.hostname, object_data]);
+
     return null;
 }

Modified: branches/task-11216/src/lm_site_mqstocom.js
===================================================================
--- branches/task-11216/src/lm_site_mqstocom.js 2011-07-25 14:31:12 UTC (rev 
155)
+++ branches/task-11216/src/lm_site_mqstocom.js 2011-07-26 07:55:44 UTC (rev 
156)
@@ -43,3 +43,21 @@
 
     return link;
 }
+
+LinternaMagica.prototype.sites["mqsto.com"].css_fixes =
+function(object_data)
+{
+    // Move the facebook comment frame in mqsto.com 100px
+    // down. overlaps the player.
+    var move_down_fb_frame = 100;
+
+    object_data.parent.style.setProperty("height",
+                                        (parseInt(object_data.height)+
+                                         26+move_down_fb_frame+
+                                        // borders 1px x 2
+                                        2+
+                                        (this.controls ? 24 : 0))+"px",
+                                        "important");
+
+    return false;
+}

Modified: branches/task-11216/src/lm_site_reuters.js
===================================================================
--- branches/task-11216/src/lm_site_reuters.js  2011-07-25 14:31:12 UTC (rev 
155)
+++ branches/task-11216/src/lm_site_reuters.js  2011-07-26 07:55:44 UTC (rev 
156)
@@ -44,3 +44,28 @@
 
     return result;
 }
+
+LinternaMagica.prototype.sites["reuters.com"].css_fixes =
+function(object_data)
+{
+    // Extra height for reuters.com. Otherwise the controlls are
+    // hidden.
+    var extra_height = 100;
+
+    var fourth_parent = object_data.parent.parentNode.parentNode.parentNode;
+    if (fourth_parent)
+    {
+       fourth_parent.style.setProperty("overflow", "visible", "important");
+       fourth_parent.style.
+           setProperty("height", 
+                       (parseInt(object_data.height)+26+
+                        extra_height+
+                        // borders 1px x 2
+                        2+
+                        (this.controls ? 24 : 0)  )+"px",
+                       "important");
+    }
+
+    return false;
+}
+

Modified: branches/task-11216/src/lm_site_tv7bg.js
===================================================================
--- branches/task-11216/src/lm_site_tv7bg.js    2011-07-25 14:31:12 UTC (rev 
155)
+++ branches/task-11216/src/lm_site_tv7bg.js    2011-07-26 07:55:44 UTC (rev 
156)
@@ -43,3 +43,39 @@
 
     return link;
 }
+
+LinternaMagica.prototype.sites["tv7.bg"].css_fixes =
+function(object_data)
+{
+    // The CSS rules hide parts of our elements
+    object_data.parent.parentNode.style.
+       setProperty("height",
+                   (parseInt(object_data.height)+26+
+                    // borders 1px x 2
+                    2+
+                    (this.controls ? 24 : 0)  )+"px",
+                   "important");
+
+    object_data.parent.parentNode.style.
+       setProperty("width",
+                   (parseInt(object_data.width+2))+"px",
+                   "important");
+
+    // Fixes height and overflow of the third parent, so the
+    // replacement object is visible.
+    var third_parent = object_data.parent.parentNode.parentNode;
+    if (third_parent)
+    {
+       third_parent.style.setProperty("overflow", "visible", "important");
+       third_parent.style.
+           setProperty("height", 
+                       (parseInt(object_data.height)+26+
+                        // borders 1px x 2
+                        2+
+                        (this.controls ? 24 : 0)  )+"px",
+                       "important");
+    }
+
+
+    return false;
+}

Modified: branches/task-11216/src/lm_site_vimeo.js
===================================================================
--- branches/task-11216/src/lm_site_vimeo.js    2011-07-25 14:31:12 UTC (rev 
155)
+++ branches/task-11216/src/lm_site_vimeo.js    2011-07-26 07:55:44 UTC (rev 
156)
@@ -250,3 +250,90 @@
 
     return false;
 }
+
+LinternaMagica.prototype.sites["vimeo.com"].css_fixes = function(object_data)
+{
+    // The thumbnail image overlaps the toggle plugin button after our
+    // changes. This way our button is visible.
+    if (object_data.parent.firstChild)
+    {
+       // The first child should be a div with thumbnail as
+       // background. Reduce it's size so it will not overlap our
+       // button.
+       object_data.parent.firstChild.style.
+           setProperty("height", parseInt(object_data.height)+"px",
+                       "important");
+    }
+
+    // Show HD links list. 
+    object_data.parent.style.
+       setProperty("overflow", "visible", "important");
+
+    object_data.parent.parentNode.style.
+       setProperty("overflow", "visible", "important");
+       
+    // No idea what this fixes.
+    var object_tag = 
+       document.getElementById("linterna-magica-video-object-"+
+                               object_data.linterna_magica_id);
+
+    object_tag.style.setProperty("position","relative","important");
+
+    // Fixes the height of the third parent element.  Fixes
+    // replacement object visibility.
+    var third_parent = object_data.parent.parentNode.parentNode;
+
+    if (third_parent)
+    {
+       third_parent.style.setProperty("overflow", "visible",
+                                      "important");
+       third_parent.style.setProperty("height", 
+                                      (parseInt(object_data.height)+26+
+                                       // borders 1px x 2
+                                       2+
+                                       (this.controls ? 24 : 0)  )+"px",
+                                      "important");
+    }
+
+    // Fixes the height of the fourth parent. Fixes replacement object
+    // visibility.
+    var fourth_parent = object_data.parent.parentNode.
+       parentNode.parentNode;
+
+    if (fourth_parent)
+    {
+       fourth_parent.style.setProperty("overflow", "visible",
+                                       "important");
+       fourth_parent.style.setProperty("height", 
+                                       (parseInt(object_data.height)+26+
+                                        // borders 1px x 2
+                                        2+
+                                        (this.controls ? 24 : 0)  )+"px",
+                                       "important");
+    }
+
+    // Fix displacement of toggle_plugin link/button in vimeo
+    var toggle_plugin = 
+       document.getElementById("linterna-magica-toggle-plugin-"+
+                               object_data.linterna_magica_id);
+
+    if (toggle_plugin)
+    {
+       toggle_plugin.style.setProperty("top",
+                                       parseInt(object_data.height)+10+
+                                       "px", "important");
+    }
+
+    // The CSS rules hide parts of our elements
+    object_data.parent.parentNode.style.
+       setProperty("height", (parseInt(object_data.height)+26+
+                    // borders 1px x 2
+                    2+
+                    (this.controls ? 24 : 0)  )+"px", "important");
+
+    object_data.parent.parentNode.style.
+       setProperty("width", (parseInt(object_data.width+2))+"px",
+                   "important");
+
+    return false;
+}

Modified: branches/task-11216/src/lm_site_youtube.js
===================================================================
--- branches/task-11216/src/lm_site_youtube.js  2011-07-25 14:31:12 UTC (rev 
155)
+++ branches/task-11216/src/lm_site_youtube.js  2011-07-26 07:55:44 UTC (rev 
156)
@@ -439,3 +439,66 @@
     
     return false;
 }
+
+LinternaMagica.prototype.sites["youtube.com"].css_fixes = function(object_data)
+{
+    if (document.getElementById("playnav-playview"))
+    {
+       // In channels/user pages in YouTube the web controlls are
+       // overlapped by few elements.
+
+       var el =        document.getElementById("playnav-playview");
+       el.style.setProperty("margin-top", "50px", "important");
+
+       var user_nav = document.getElementById("user_playlist_navigator");
+
+       if (user_nav)
+       {
+           user_nav.style.setProperty("overflow", "visible", "important");
+           var height = document.defaultView.getComputedStyle(user_nav).
+               getPropertyValue("height");
+
+           user_nav.style.setProperty("height",
+                                      (parseInt(height)+50)+"px",
+                                      "important");
+       }
+
+       var playnav_body = document.getElementById("playnav-body");
+
+       if (playnav_body)
+       {
+           playnav_body.style.setProperty("overflow",
+                                          "visible", "important");
+
+           // A top border of 1px fixes the top displacement. Why?!
+           var color = document.defaultView.getComputedStyle(user_nav).
+               getPropertyValue("background-color");
+
+           color = color ? color : "#999999";
+
+           playnav_body.style.setProperty("border-top",
+                                          "1px solid "+color,  "important");
+       }
+
+       var playnav_play_content =
+           document.getElementById("playnav-play-content");
+
+       if (playnav_play_content)
+       {
+           var height = document.defaultView.
+               getComputedStyle(playnav_play_content).
+               getPropertyValue("height");
+
+           playnav_play_content.style.
+               setProperty("height",
+                           (parseInt(height)+50)+"px",
+                           "important");
+       }
+    }
+
+     // Bug #33504 https://savannah.nongnu.org/bugs/?33504
+    object_data.parent.style.setProperty("overflow", "visible", "important");
+
+
+    return false;
+}

Modified: branches/task-11216/src/lm_sites.js
===================================================================
--- branches/task-11216/src/lm_sites.js 2011-07-25 14:31:12 UTC (rev 155)
+++ branches/task-11216/src/lm_sites.js 2011-07-26 07:55:44 UTC (rev 156)
@@ -78,8 +78,6 @@
     return true;
 }
 
-// LinternaMagica.prototype.sites.__css_style_fix
-
 // Used to skip detection (as swf) of iframes. Not used in most
 // sites. See lm_site_dailymotion.js:do_not_force_iframe_detection.
 LinternaMagica.prototype.sites.__do_not_force_iframe_detection =
@@ -271,6 +269,15 @@
     return true;
 }
 
+// Add syle and classes to DOM elements for various fixes.The return
+// value does not really matter. The caller function returns null
+// after executing this code. Executed after the replacement object is
+// inserted. CSS classes and DOM ids are accessible.
+LinternaMagica.prototype.sites.__css_fixes = function(object_data)
+{
+    return true;
+}
+
 // Check if site specific config and function exists and call it. If
 // it doesn't, call the general/default function.  A function returns
 // false/null, if the calling function should exit/return after this




reply via email to

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