[limb-svn] r5818 - 3.x/trunk/limb/js/shared/js/limb

svn at limb-project.com svn at limb-project.com
Mon May 7 12:22:58 MSD 2007


Author: tony
Date: 2007-05-07 12:22:58 +0400 (Mon, 07 May 2007)
New Revision: 5818
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5818

Modified:
   3.x/trunk/limb/js/shared/js/limb/window.js
Log:
-- Limb.Window improvements
   * createParams merged with defaults on window creation instead it of replacement
   * added parameter noautoresize which disables auto size changing
   * another minor fixes

Modified: 3.x/trunk/limb/js/shared/js/limb/window.js
===================================================================
--- 3.x/trunk/limb/js/shared/js/limb/window.js	2007-05-06 09:38:17 UTC (rev 5817)
+++ 3.x/trunk/limb/js/shared/js/limb/window.js	2007-05-07 08:22:58 UTC (rev 5818)
@@ -19,6 +19,7 @@
     this.windowName = this._generateName();
     this.onLoadEvents = [];
     this.onUnloadEvents = [];
+    this.params = {};
 
     if(arguments.length == 0)
       this.window = window;
@@ -90,10 +91,12 @@
     if(windowName)
       this.windowName = windowName;
 
-    if(!Limb.isset(createParams))
-      createParams = this._getDefaultParams();
+    this.params = this._getDefaultParams();
 
-    var win = window.open(href, this.windowName, createParams.asString());
+    if(Limb.isset(createParams))
+       this.params.merge(createParams);
+
+    var win = window.open(href, this.windowName, this.params.asString());
     return win;
   },
 
@@ -126,17 +129,20 @@
   {
     Limb.Window.register(this.windowName, this);
 
-    if(!this.window.limbWindowWidth)
-      this.window.limbWindowWidth = this.parentWindow.getRect().getWidth() * 0.85;
+    if(this.params &&!this.params.getParameter('noautoresize'))
+      this.autoResize();
 
-    if(!this.window.limbWindowHeight)
-      this.window.limbWindowHeight = this.parentWindow.getRect().getHeight() * 0.9;
+    this.centreWindow(this.params.getParameter('width'), this.params.getParameter('height'));
 
-    this.centreWindow(this.window.limbWindowWidth, this.window.limbWindowHeight);
-
     this.openHandler();
   },
 
+  autoResize: function()
+  {
+    this.params.setParameter('width', this.parentWindow.getRect().getWidth() * 0.85);
+    this.params.setParameter('height', this.parentWindow.getRect().getHeight() * 0.9);
+  },
+
   onClose: function()
   {
     Limb.Window.remove(this.windowName);
@@ -203,9 +209,15 @@
 
   getParameter: function(name)
   {
-     return params[name];
+     return this.params[name];
   },
 
+  merge: function(params)
+  {
+    for(var name in params)
+      this.params[name] = params[name];
+  },
+
   asString: function()
   {
     var result = '';



More information about the limb-svn mailing list