Author: hsaputra
Date: Mon Mar 26 17:44:24 2012
New Revision: 1305473

URL: http://svn.apache.org/viewvc?rev=1305473&view=rev
Log:
Remove carriage return char in gadget_site.js

Modified:
    
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js

Modified: 
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
URL: 
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js?rev=1305473&r1=1305472&r2=1305473&view=diff
==============================================================================
--- 
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
 (original)
+++ 
shindig/trunk/features/src/main/javascript/features/container.site.gadget/gadget_site.js
 Mon Mar 26 17:44:24 2012
@@ -16,14 +16,12 @@
  * specific language governing permissions and limitations under the License.
  */
 
-
 /**
  * @fileoverview This manages rendering of gadgets in a place holder, within an
  * HTML element in the container. The API for this is low-level. Use the
  * container APIs to work with gadget sites.
  */
 
-
 /**
  * @param {osapi.container.Container} container The container that hosts this 
gadget site.
  * @param {osapi.container.Service} service The container's service.
@@ -55,19 +53,19 @@ osapi.container.GadgetSite = function(co
   this.loadingGadgetEl_ = args['bufferEl'];
 
   /**
-   * @type {string}
-   * @private
-   */
-  this.gadgetOnLoad_ = args['gadgetOnLoad'];
+   * @type {string}
+   * @private
+   */
+  this.gadgetOnLoad_ = args['gadgetOnLoad'];
 
   /**
-   * Unique numeric module ID for this gadget instance.  A module id is used to
-   * identify persisted instances of gadgets.
-   *
-   * @type {number}
-   * @private
-   */
-  this.moduleId_ = 0;
+   * Unique numeric module ID for this gadget instance.  A module id is used to
+   * identify persisted instances of gadgets.
+   *
+   * @type {number}
+   * @private
+   */
+  this.moduleId_ = 0;
 
   /**
    * Information about the currently visible gadget.
@@ -81,58 +79,59 @@ osapi.container.GadgetSite = function(co
    * @type {osapi.container.GadgetHolder?}
    * @private
    */
-  this.loadingGadgetHolder_ = undef;
-
+  this.loadingGadgetHolder_ = undef;
+
   this.onConstructed();
 };
+
 osapi.container.GadgetSite.prototype = new osapi.container.Site;
 
-/**
- * @return {undefined|null|number} The numerical moduleId of this gadget, if
- *   set.  May return null or undefined if not set.
- */
-osapi.container.GadgetSite.prototype.getModuleId = function() {
-  return this.moduleId_;
-};
-
-/**
- * If you want to change the moduleId after a gadget has rendered, re-navigate 
the site.
- *
- * @param {string} url This gadget's url (may not yet be accessible in all 
cases from the holder).
- * @param {number} mid The numerical moduleId for this gadget to use.
- * @param {function} opt_callback Optional callback to run when the moduleId 
is set.
- * @private
- */
-osapi.container.GadgetSite.prototype.setModuleId_ = function(url, mid, 
opt_callback) {
-  if (mid && this.moduleId_ != mid) {
-    var self = this,
-        url = osapi.container.util.buildTokenRequestUrl(url, mid);
-
-    if (!self.service_.getCachedGadgetToken(url)) {
-      // We need to request a security token for this gadget instance.
-      var request = osapi.container.util.newTokenRequest([url]);
-      self.service_.getGadgetToken(request, function(response) {
-        var ttl, mid;
-        if (response && response[url]) {
-          if (ttl = response[url][osapi.container.TokenResponse.TOKEN_TTL]) {
-            self.container_.scheduleRefreshTokens_(ttl);
-          }
-          var mid = response[url][osapi.container.TokenResponse.MODULE_ID];
-          if (mid || mid == 0) {
-            self.moduleId_ = mid;
-          }
-        }
-        if (opt_callback) {
-          opt_callback();
-        }
-      });
-      return;
-    }
-  }
-  if (opt_callback) {
-    opt_callback();
-  }
-};
+/**
+ * @return {undefined|null|number} The numerical moduleId of this gadget, if
+ *   set.  May return null or undefined if not set.
+ */
+osapi.container.GadgetSite.prototype.getModuleId = function() {
+  return this.moduleId_;
+};
+
+/**
+ * If you want to change the moduleId after a gadget has rendered, re-navigate 
the site.
+ *
+ * @param {string} url This gadget's url (may not yet be accessible in all 
cases from the holder).
+ * @param {number} mid The numerical moduleId for this gadget to use.
+ * @param {function} opt_callback Optional callback to run when the moduleId 
is set.
+ * @private
+ */
+osapi.container.GadgetSite.prototype.setModuleId_ = function(url, mid, 
opt_callback) {
+  if (mid && this.moduleId_ != mid) {
+    var self = this,
+        url = osapi.container.util.buildTokenRequestUrl(url, mid);
+
+    if (!self.service_.getCachedGadgetToken(url)) {
+      // We need to request a security token for this gadget instance.
+      var request = osapi.container.util.newTokenRequest([url]);
+      self.service_.getGadgetToken(request, function(response) {
+        var ttl, mid;
+        if (response && response[url]) {
+          if (ttl = response[url][osapi.container.TokenResponse.TOKEN_TTL]) {
+            self.container_.scheduleRefreshTokens_(ttl);
+          }
+          var mid = response[url][osapi.container.TokenResponse.MODULE_ID];
+          if (mid || mid == 0) {
+            self.moduleId_ = mid;
+          }
+        }
+        if (opt_callback) {
+          opt_callback();
+        }
+      });
+      return;
+    }
+  }
+  if (opt_callback) {
+    opt_callback();
+  }
+};
 
 /**
  * @inheritDoc
@@ -169,7 +168,7 @@ osapi.container.GadgetSite.prototype.nav
   var callback = opt_callback || function() {};
   var request = osapi.container.util.newMetadataRequest([gadgetUrl]);
   var self = this;
-
+
   this.service_.getGadgetMetadata(request, function(response) {
     var xrt = (!cached) ? (osapi.container.util.getCurrentTimeMs() - start) : 
0;
     var gadgetInfo = response[gadgetUrl];
@@ -177,12 +176,12 @@ osapi.container.GadgetSite.prototype.nav
       var message = ['Failed to navigate for gadget ', gadgetUrl, 
'.'].join('');
       gadgets.warn(message);
     } else {
-      var moduleId = renderParams[osapi.container.RenderParam.MODULE_ID] || 0;
-      self.setModuleId_(gadgetUrl, moduleId, function() {
-        
self.container_.applyLifecycleCallbacks_(osapi.container.CallbackType.ON_BEFORE_RENDER,
-                gadgetInfo);
-        self.render(gadgetInfo, viewParams, renderParams);
-      });
+      var moduleId = renderParams[osapi.container.RenderParam.MODULE_ID] || 0;
+      self.setModuleId_(gadgetUrl, moduleId, function() {
+        
self.container_.applyLifecycleCallbacks_(osapi.container.CallbackType.ON_BEFORE_RENDER,
+                gadgetInfo);
+        self.render(gadgetInfo, viewParams, renderParams);
+      });
     }
 
     // Return metadata server response time.
@@ -215,10 +214,10 @@ osapi.container.GadgetSite.prototype.onN
 
 /**
  * Render a gadget in this site, using a JSON gadget description.
- *
- * Note: A view provided in either renderParams or viewParams is subject to 
aliasing if the gadget
- * does not support the view specified.
- *
+ *
+ * Note: A view provided in either renderParams or viewParams is subject to 
aliasing if the gadget
+ * does not support the view specified.
+ *
  * @param {Object} gadgetInfo the JSON gadget description.
  * @param {Object} viewParams Look at osapi.container.ViewParam.
  * @param {Object} renderParams Look at osapi.container.RenderParam.
@@ -233,46 +232,46 @@ osapi.container.GadgetSite.prototype.ren
     previousView = this.currentGadgetHolder_.getView();
   }
 
-  // Simple function to find a suitable alias
-  var findAliasInfo = function(viewConf) {
-    if (typeof viewConf !== 'undefined' && viewConf != null) {
-      var aliases = viewConf['aliases'] || [];
-      for (var i = 0; i < aliases.length; i++) {
-        if (gadgetInfo[osapi.container.MetadataResponse.VIEWS][aliases[i]]) {
-          return {'view':aliases[i],
-                  
'viewInfo':gadgetInfo[osapi.container.MetadataResponse.VIEWS][aliases[i]]};
-        }
-      }
-    }
-    return null;
-  };
-
+  // Simple function to find a suitable alias
+  var findAliasInfo = function(viewConf) {
+    if (typeof viewConf !== 'undefined' && viewConf != null) {
+      var aliases = viewConf['aliases'] || [];
+      for (var i = 0; i < aliases.length; i++) {
+        if (gadgetInfo[osapi.container.MetadataResponse.VIEWS][aliases[i]]) {
+          return {'view':aliases[i],
+                  
'viewInfo':gadgetInfo[osapi.container.MetadataResponse.VIEWS][aliases[i]]};
+        }
+      }
+    }
+    return null;
+  };
+
   // Find requested view.
   var view = renderParams[osapi.container.RenderParam.VIEW] ||
       viewParams[osapi.container.ViewParam.VIEW] ||
       previousView;
   var viewInfo = gadgetInfo[osapi.container.MetadataResponse.VIEWS][view];
-  if (view && !viewInfo) {
-    var aliasInfo = findAliasInfo(gadgets.config.get('views')[view]);
-    if (aliasInfo) {
-      view = aliasInfo['view'];
-      viewInfo = aliasInfo['viewInfo'];
-    }
-  }
-
-  // Allow default view if requested view is not found.  No sense doing this 
if the view is already "default".
-  if (!viewInfo &&
-          renderParams[osapi.container.RenderParam.ALLOW_DEFAULT_VIEW]  &&
-          view != osapi.container.GadgetSite.DEFAULT_VIEW_) {
+  if (view && !viewInfo) {
+    var aliasInfo = findAliasInfo(gadgets.config.get('views')[view]);
+    if (aliasInfo) {
+      view = aliasInfo['view'];
+      viewInfo = aliasInfo['viewInfo'];
+    }
+  }
+
+  // Allow default view if requested view is not found.  No sense doing this 
if the view is already "default".
+  if (!viewInfo &&
+          renderParams[osapi.container.RenderParam.ALLOW_DEFAULT_VIEW]  &&
+          view != osapi.container.GadgetSite.DEFAULT_VIEW_) {
     view = osapi.container.GadgetSite.DEFAULT_VIEW_;
     viewInfo = gadgetInfo[osapi.container.MetadataResponse.VIEWS][view];
-    if (!viewInfo) {
-      var aliasInfo = findAliasInfo(gadgets.config.get('views')[view]);
-      if (aliasInfo) {
-        view = aliasInfo['view'];
-        viewInfo = aliasInfo['viewInfo'];
-      }
-    }
+    if (!viewInfo) {
+      var aliasInfo = findAliasInfo(gadgets.config.get('views')[view]);
+      if (aliasInfo) {
+        view = aliasInfo['view'];
+        viewInfo = aliasInfo['viewInfo'];
+      }
+    }
   }
 
   // Check if view exists.
@@ -283,8 +282,8 @@ osapi.container.GadgetSite.prototype.ren
 
   // Load into the double-buffer if there is one.
   var el = this.loadingGadgetEl_ || this.el_;
-  this.loadingGadgetHolder_ = new osapi.container.GadgetHolder(this, el,
-          this.gadgetOnLoad_);
+  this.loadingGadgetHolder_ = new osapi.container.GadgetHolder(this, el,
+          this.gadgetOnLoad_);
 
   var localRenderParams = {};
   for (var key in renderParams) {
@@ -353,10 +352,10 @@ osapi.container.GadgetSite.prototype.rpc
  * @private
  */
 osapi.container.GadgetSite.prototype.updateSecurityToken_ =
-    function(gadgetInfo, renderParams) {
-  var url = osapi.container.util.buildTokenRequestUrl(gadgetInfo['url'], 
this.moduleId_),
-      tokenInfo = this.service_.getCachedGadgetToken(url);
-
+    function(gadgetInfo, renderParams) {
+  var url = osapi.container.util.buildTokenRequestUrl(gadgetInfo['url'], 
this.moduleId_),
+      tokenInfo = this.service_.getCachedGadgetToken(url);
+
   if (tokenInfo) {
     var token = tokenInfo[osapi.container.TokenResponse.TOKEN];
     this.loadingGadgetHolder_.setSecurityToken(token);


Reply via email to