From 7979105c629050e744b9e889a95b6984cf912b03 Mon Sep 17 00:00:00 2001 From: defacer Date: Thu, 12 May 2005 14:45:16 +0000 Subject: [PATCH] If Javascript is enabled, make IE fix the block sizes after the page loads so that it's not a mess to look at. --- lib/javascript-static.js | 39 +++++++++++++++++++++++++++++++++++++++ lib/javascript.php | 4 +++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/lib/javascript-static.js b/lib/javascript-static.js index fb258557d78..ccc5b05446f 100644 --- a/lib/javascript-static.js +++ b/lib/javascript-static.js @@ -172,6 +172,45 @@ function filterByParent(elCollection, parentFinder) { return filteredCollection; } +/* + All this is here just so that IE gets to handle oversized blocks + in a visually pleasing manner. It does a browser detect. So sue me. +*/ + +function fix_column_widths() { + var agt = navigator.userAgent.toLowerCase(); + if ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) { + fix_column_width('left-column'); + fix_column_width('right-column'); + } +} + +function fix_column_width(colName) { + if(column = document.getElementById(colName)) { + if(!column.offsetWidth) { + setTimeout("fix_column_width('" + colName + "')", 20); + return; + } + + var width = 0; + var nodes = column.childNodes; + + for(i = 0; i < nodes.length; ++i) { + if(nodes[i].className.indexOf("sideblock") != -1 ) { + if(width < nodes[i].offsetWidth) { + width = nodes[i].offsetWidth; + } + } + } + + for(i = 0; i < nodes.length; ++i) { + if(nodes[i].className.indexOf("sideblock") != -1 ) { + nodes[i].style.width = width + 'px'; + } + } + } +} + /* Is there some specific reason for this function? I think pretty diff --git a/lib/javascript.php b/lib/javascript.php index 1c49e3a366c..0a24407e8b4 100644 --- a/lib/javascript.php +++ b/lib/javascript.php @@ -14,10 +14,12 @@ -