Author: rgardler
Date: Mon Oct 31 00:15:41 2011
New Revision: 1195286
URL: http://svn.apache.org/viewvc?rev=1195286&view=rev
Log:
add a method for getting the viewport size
Modified:
incubator/wookie/trunk/widgets/templates/base/scripts/controller.js
Modified: incubator/wookie/trunk/widgets/templates/base/scripts/controller.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/base/scripts/controller.js?rev=1195286&r1=1195285&r2=1195286&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/templates/base/scripts/controller.js
(original)
+++ incubator/wookie/trunk/widgets/templates/base/scripts/controller.js Mon Oct
31 00:15:41 2011
@@ -35,6 +35,21 @@ var ${widget.shortname}_controller = {
*/
getTitle:function() {
return "${widget.name}";
+ },
+
+ /**
+ * Get the viewport width and height.
+ * returns an object with width and height properties.
+ */
+ getViewport:function() {
+ var e = window
+ , a = 'inner';
+ if ( !( 'innerWidth' in window ) )
+ {
+ a = 'client';
+ e = document.documentElement || document.body;
+ }
+ return { width : e[ a+'Width' ] , height : e[ a+'Height' ] }
}
};