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

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

[linterna-magica-commit] [211] Fixes for bugs #34465.


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [211] Fixes for bugs #34465.
Date: Fri, 25 Nov 2011 10:25:30 +0000

Revision: 211
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=211
Author:   valkov
Date:     2011-11-25 10:25:29 +0000 (Fri, 25 Nov 2011)
Log Message:
-----------
Fixes for bugs #34465. Cleaned up logic. Forced height for the HD list holder. 
Proper width calculations.

Ticket Links:
------------
    http://savannah.gnu.org/bugs/?34465

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

Modified: trunk/src/lm_interface_hd_links.js
===================================================================
--- trunk/src/lm_interface_hd_links.js  2011-11-24 16:05:48 UTC (rev 210)
+++ trunk/src/lm_interface_hd_links.js  2011-11-25 10:25:29 UTC (rev 211)
@@ -119,34 +119,32 @@
 
            if (hd_list.clientHeight > top_offset)
            {
-               // Increase the width ~twice. Higher values than 1.85
-               // leave too much empty space at the right of the div.
-               var w = hd_list.clientWidth * 2.085;
-               var h = 0;
+               // Force every li to 300px width
+               var li_predefined_w = 300;
+               // Force div with the HD list to 120px height
+               var h = 120;
 
                var links = hd_list.getElementsByTagName("li");
-               for (var i=0,l=links.length;i<l;i++)
-               {
-                   var li = links[i];
-                   var li_h  = (li.clientHeight ? 
-                                li.clientHeight: li.offsetHeight);
-                   h += li_h;
-               }
 
-               // Setting "float: left" in the same loop as the
-               // height calculations changes the sum.
-               for (var i=0,l=links.length;i<l;i++)
+               // Calculate the width of the HD list holder div
+               // according to the expected columns.  More than 6 li
+               // elements per column usualy do not fit.
+               var w = Math.ceil(links.length / 6) * li_predefined_w;
+               
+               var is_set = links[0].style.getPropertyValue("width");
+               is_set = parseInt(is_set);
+
+               if (!is_set)
                {
-                   var li = links[i];
-                   li.style.setProperty("float", "left", "important");
-                   li.style.setProperty("width", "270px", "important");
+                   for (var i=0,l=links.length;i<l;i++)
+                   {
+                       var li = links[i];
+                       li.style.setProperty("float", "left", "important");
+                       li.style.setProperty("width", li_predefined_w+"px",
+                                            "important");
+                   }
                }
 
-               // Half the height. The "float:left" renders in two
-               // columns, so we reduce the height. Add two pixels for
-               // Epiphany, otherwise it renders scrollbars. 
-               h = h/2 + 2;
-
                hd_list.style.setProperty("height", h+"px", "important");
                hd_list.style.setProperty("width", w+"px", "important");
 




reply via email to

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