Author: nbelaevski
Date: 2008-08-14 18:53:26 -0400 (Thu, 14 Aug 2008)
New Revision: 10105
Modified:
trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
Blinking suggestion box fixed
Modified:
trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
===================================================================
---
trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2008-08-14
17:12:06 UTC (rev 10104)
+++
trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2008-08-14
22:53:26 UTC (rev 10105)
@@ -87,7 +87,7 @@
*/
private final InternetResource[] additionalScripts = {
new org.ajax4jsf.javascript.PrototypeScript(),
- getResource("/org/richfaces/renderkit/html/scripts/jquery/jquery.js"),
+ getResource("/org/richfaces/renderkit/html/scripts/jquery/jquery.js"),
getResource("/org/richfaces/renderkit/html/scripts/available.js"),
new org.ajax4jsf.javascript.SmartPositionScript(),
getResource("/org/richfaces/renderkit/html/scripts/browser_info.js"),
Modified:
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
---
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-08-14
17:12:06 UTC (rev 10104)
+++
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-08-14
22:53:26 UTC (rev 10105)
@@ -286,7 +286,7 @@
}
document.body.insertBefore(this.update, document.body.firstChild);
- this.initialized = true;
+ this.initialized = true;
}
this.wasBlur = false;
if (this.active) {
@@ -1013,17 +1013,31 @@
this.clonePosition(this.target, this.source, this.source.offsetHeight);
- if (options.iframeId) {
+ if (options.iframeId) {
var iframe = $(options.iframeId);
+
+ if (jQuery.browser.msie) {
+ var op = iframe.offsetParent;
+ if (op && op.nodeType == Node.ELEMENT_NODE) {
+ //hack copied from propotype.js viewportOffset()
+ //needed for positioning to work properly
+ var jop = jQuery(op);
+ if (jop.css('position') == 'static') {
+ jop.css('position',
'relative').css('position', 'static');
+ }
+ }
+ }
+
+ //iframe.style.position = "absolute";
+ iframe.style.left = this.target.style.left;
+ iframe.style.top = this.target.style.top;
+ iframe.style.width = this.target.style.width;
+ iframe.style.height = this.target.style.height;
+
var zindexVar = options.zindex ? options.zindex : 200 ;
Element.setStyle(this.target, {zIndex: zindexVar + 1});
Element.setStyle(iframe, {zIndex: zindexVar});
- iframe.style.position = "absolute";
- iframe.style.top = this.target.style.top;
- iframe.style.left = this.target.style.left;
- iframe.style.width = this.target.style.width;
- iframe.style.height = this.target.style.height;
}
},
@@ -1031,30 +1045,53 @@
parseToPx: function(value) {
var v = value.strip();
- if (v == 'auto') {
- return 0;
- } else {
- return parseFloat(v.replace(this.PX_REGEX, ""));
+ if (this.PX_REGEX.test(v)) {
+ try {
+ return parseFloat(v.replace(this.PX_REGEX, ""));
+ } catch (e) {
+
+ }
}
+
+ return NaN;
},
-
+
clonePosition: function(target, source, vOffset) {
var jqt = jQuery(target);
+ var jqs = jQuery(source);
+ var so = jqs.offset();
- var visibility = jqt.css('visibility');
- var display = jqt.css('display');
+ var hidden = (jqt.css('display') == 'none');
+ var oldVisibility;
- var so = jQuery(source).offset();
- var to = jqt.css({left: '0px', top: '0px', visibility:
'hidden', display: ''}).offset();
+ if (hidden) {
+ oldVisibility = jqt.css('visibility');
+ jqt.css('visibility', 'hidden').css('display',
'');
+ }
+
+ var left = this.parseToPx(jqt.css('left'));
+ if (isNaN(left)) {
+ left = 0;
+ jqt.css('left', '0px');
+ }
- var l = so.left - to.left;
- var p = so.top - to.top + vOffset;
+ var top = this.parseToPx(jqt.css('top'));
+ if (isNaN(top)) {
+ top = 0;
+ jqt.css('top', '0px');
+ }
+ var to = jqt.offset();
+
+ if (hidden) {
+ jqt.css('display', 'none').css('visibility',
oldVisibility);
+ }
+
// set position
- target.style.left = l + 'px';
- target.style.top = p + 'px';
-
- jqt.css({visibility: visibility, display: display});
+ jqt.css({
+ left: (so.left - to.left + left) + 'px',
+ top: (so.top - to.top + top + vOffset) + 'px'
+ });
},
getBody: function() {
Show replies by date