From 343fa78a3d02d4522c70e1ee7fe32c77f7e2c0c2 Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 1 Mar 2010 14:51:08 +0000 Subject: [PATCH] Updated script git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15805 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/html/include/gosa.js | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/gosa-core/html/include/gosa.js b/gosa-core/html/include/gosa.js index fd7780f41..57176727b 100644 --- a/gosa-core/html/include/gosa.js +++ b/gosa-core/html/include/gosa.js @@ -349,7 +349,7 @@ function focus_field() var tmp = document.getElementsByName(focus_field.arguments[i]); for(e = 0 ; e < tmp.length ; e ++ ){ - if(tmp[e].disabled != true && tmp[e].type != "none" && tmp[e].type != "hidden" && tmp[e].style.display != ""){ + if(isVisible(tmp[e])){ found = true; element = tmp[e]; break; @@ -539,6 +539,36 @@ function move_div_by_cursor(e) } +function isVisible(obj) +{ + if (obj == document) return true + + if (!obj) return false + if (!obj.parentNode) return false + if (obj.style) { + if (obj.style.display == 'none') return false + if (obj.style.visibility == 'hidden') return false + } + + //Try the computed style in a standard way + if (window.getComputedStyle) { + var style = window.getComputedStyle(obj, "") + if (style.display == 'none') return false + if (style.visibility == 'hidden') return false + } + + //Or get the computed style using IE's silly proprietary way + var style = obj.currentStyle + if (style) { + if (style['display'] == 'none') return false + if (style['visibility'] == 'hidden') return false + } + + return isVisible(obj.parentNode) +} + + + // Global storage for baseSelector timer var rtimer; -- 2.30.2