Author: vsiveton
Date: Tue Mar 31 21:34:15 2009
New Revision: 760661
URL: http://svn.apache.org/viewvc?rev=760661&view=rev
Log:
SHINDIG-812: [PATCH] Attach gadgets.window.adjustHeight to the onresize event
Submitted by: Audrey Tang
o patch applied
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js?rev=760661&r1=760660&r2=760661&view=diff
==============================================================================
---
incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js
(original)
+++
incubator/shindig/trunk/features/src/main/javascript/features/dynamic-height/dynamic-height.js
Tue Mar 31 21:34:15 2009
@@ -36,6 +36,7 @@
(function() {
var oldHeight;
+ var oldHeight2;
/**
* Detects the inner dimensions of a frame.
@@ -130,15 +131,31 @@
}
// Only make the IFPC call if height has changed
- if (newHeight !== oldHeight) {
+ if (newHeight != oldHeight && (newHeight != oldHeight2 || newHeight >
oldHeight)) {
+ oldHeight2 = oldHeight;
oldHeight = newHeight;
gadgets.rpc.call(null, "resize_iframe", null, newHeight);
}
+
+ gadgets.window.opt_height = opt_height;
+
+ if (gadgets.window.resizeListenerIsAttached) {
+ return;
+ }
+ gadgets.window.resizeListenerIsAttached = true;
+
+ var resizeAgain = function () {
+ gadgets.window.adjustHeight(gadgets.window.opt_height);
+ };
+
+ if (window.addEventListener) {
+ window.addEventListener("resize", resizeAgain, false);
+ }
+ else if (window.attachEvent) {
+ window.attachEvent("resize", resizeAgain);
+ }
};
}());
// Alias for legacy code
-var _IG_AdjustIFrameHeight = gadgets.window.adjustHeight;
-
-// TODO Attach gadgets.window.adjustHeight to the onresize event
-
+var _IG_AdjustIFrameHeight = gadgets.window.adjustHeight;
\ No newline at end of file