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

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

[linterna-magica-commit] [43] Show which is the selected link in the HD


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [43] Show which is the selected link in the HD list.
Date: Sat, 09 Apr 2011 14:07:54 +0000

Revision: 43
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=43
Author:   valkov
Date:     2011-04-09 14:07:53 +0000 (Sat, 09 Apr 2011)
Log Message:
-----------
Show which is the selected link in the HD list. Closes tasks #11063.

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

Modified Paths:
--------------
    trunk/src/lm_create_video_object.js
    trunk/src/lm_interface_hd_links.js

Modified: trunk/src/lm_create_video_object.js
===================================================================
--- trunk/src/lm_create_video_object.js 2011-04-09 11:01:22 UTC (rev 42)
+++ trunk/src/lm_create_video_object.js 2011-04-09 14:07:53 UTC (rev 43)
@@ -167,6 +167,12 @@
                                            apply(self, [ev, el]);
                                    }, false);
 
+           // Selected link. Default it is the lowest quality.
+           if (link == (object_data.hd_links.length-1))
+           {
+               this.select_hd_link_in_list(button,id);
+           }
+
            li.appendChild(button);
            ul.appendChild(li);
        }

Modified: trunk/src/lm_interface_hd_links.js
===================================================================
--- trunk/src/lm_interface_hd_links.js  2011-04-09 11:01:22 UTC (rev 42)
+++ trunk/src/lm_interface_hd_links.js  2011-04-09 14:07:53 UTC (rev 43)
@@ -47,6 +47,9 @@
     var video_object = document.getElementById(
        "linterna-magica-video-object-"+id);
 
+    var selected_link = document.getElementById(
+       "linterna-magica-selected-hd-link-"+id);
+
     if (dw_link && video_object)
     {
        dw_link.setAttribute("href",
@@ -72,6 +75,14 @@
            parent.appendChild(new_video);
        }
 
+       // Set the new selected link in the list and clear the old one
+       if (selected_link)
+       {
+           this.unselect_hd_link_in_list(selected_link);
+       }
+
+       this.select_hd_link_in_list(element,id);
+
        // hide the list
        div.style.setProperty("display", "none", "important");
     }
@@ -98,3 +109,50 @@
     }
     return true;
 }
+
+// Set style and id of the selected link in the HD list. This way it
+// is distinguished.
+LinternaMagica.prototype.select_hd_link_in_list = function(element,id)
+{
+    if (typeof(element) != "object" || !id)
+    {
+       return element;
+    }
+
+    element.style.setProperty("border-style", "solid", "important");
+    element.style.setProperty("border-width", "1px", "important");
+    element.style.setProperty("border-color", "#bbbbbb", "important");
+    element.style.setProperty("background-color", "#151515", "important");
+    element.style.setProperty("color", "#ffffff", "important");
+    element.setAttribute("id", "linterna-magica-selected-hd-link-"+id);
+
+    return element;
+}
+
+// Remove the style and the id of previous selected link in the HD
+// list. Called before select_hd_link_in_list() is called for newly
+// selected link.
+LinternaMagica.prototype.unselect_hd_link_in_list = function(element)
+{
+    if (typeof(element) != "object")
+    {
+       return element;
+    }
+
+    element.removeAttribute("id");
+    element.style.removeProperty("border-width");
+    element.style.removeProperty("border-color");
+    element.style.removeProperty("border-style");
+    element.style.removeProperty("background-color");
+    element.style.removeProperty("color");
+
+    // 09.04.2011 WebKit /Epiphany keeps showing border even if it is
+    // removed and border-style, border-color and border-width are
+    // null.
+    if (element.style.getPropertyValue("border"))
+    {
+       element.style.setProperty("border-width", "0px", "important");
+    }
+
+    return element;
+}




reply via email to

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