You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by do...@apache.org on 2008/02/25 17:44:23 UTC

svn commit: r630930 - in /incubator/shindig/trunk: features/core/ features/flash/ features/ifpc/ features/opensocial-reference/ features/opensocial-samplecontainer/ java/gadgets/ javascript/container/

Author: doll
Date: Mon Feb 25 08:44:21 2008
New Revision: 630930

URL: http://svn.apache.org/viewvc?rev=630930&view=rev
Log:
Reduced our js warnings down to about 5.
This involved some stupid changes, like renaming vars that shouldn't need to be renamed but it also actually found 1 bug and got rid of some unused code. 

I also put us back to version 0.6 of the compressor because of the duplicate var error. That error is extremely noisy and pretty meaningless. Hopefully we will simply find a better js compiler.

I will shoot to fix some of the remaining warnings in a bit.


Modified:
    incubator/shindig/trunk/features/core/legacy.js
    incubator/shindig/trunk/features/flash/flash.js
    incubator/shindig/trunk/features/ifpc/ifpc.js
    incubator/shindig/trunk/features/opensocial-reference/datarequest.js
    incubator/shindig/trunk/features/opensocial-samplecontainer/samplecontainer.js
    incubator/shindig/trunk/features/opensocial-samplecontainer/statefileparser.js
    incubator/shindig/trunk/java/gadgets/pom.xml
    incubator/shindig/trunk/javascript/container/cookies.js
    incubator/shindig/trunk/javascript/container/ifpc.js

Modified: incubator/shindig/trunk/features/core/legacy.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/core/legacy.js?rev=630930&r1=630929&r2=630930&view=diff
==============================================================================
--- incubator/shindig/trunk/features/core/legacy.js (original)
+++ incubator/shindig/trunk/features/core/legacy.js Mon Feb 25 08:44:21 2008
@@ -148,7 +148,7 @@
  * @return The stripped string.
  */
 function _striptags(str) {
-  return s.replace(/<\/?[^>]+>/g, "");
+  return str.replace(/<\/?[^>]+>/g, "");
 }
 
 /**
@@ -213,14 +213,15 @@
  */
 function _exportSymbols(name, sym) {
   var obj = {};
+
   for (var i = 0, j = sym.length; i < j; i += 2) {
     obj[sym[i]] = sym[i + 1];
   }
   var parts = name.split(".");
   var attach = window;
-  for (var i = 0, j = parts.length - 1; i < j; ++i) {
+  for (var k = 0, l = parts.length - 1; k < l; ++k) {
     var tmp = {};
-    attach[parts[i]] = tmp;
+    attach[parts[k]] = tmp;
     attach = tmp;
   }
   attach[parts[parts.length - 1]] = obj;

Modified: incubator/shindig/trunk/features/flash/flash.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/flash/flash.js?rev=630930&r1=630929&r2=630930&view=diff
==============================================================================
--- incubator/shindig/trunk/features/flash/flash.js (original)
+++ incubator/shindig/trunk/features/flash/flash.js Mon Feb 25 08:44:21 2008
@@ -49,10 +49,10 @@
     // Flash detection for IE
     // This is done by trying to create an ActiveX object with the name
     // "ShockwaveFlash.ShockwaveFlash.{majorVersion}".
-    for (var i = 9; i > 0; i--) {
+    for (var version = 9; version > 0; version--) {
       try {
-        new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
-        return i;
+        new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + version);
+        return version;
       } catch (e) {
       }
     }
@@ -147,14 +147,14 @@
         }
 
         html = '<object';
-        for (var prop in attr) {
-          html += ' ' + prop + '="' + attr[prop] + '"';
+        for (var attrProp in attr) {
+          html += ' ' + attrProp + '="' + attr[attrProp] + '"';
         }
         html += '>';
-        for (var prop in opt_params) {
-          if (!/^swf_/.test(prop) && !attr[prop]) {
-            html += '<param name="' + prop +
-              '" value="' + opt_params[prop] + '" />';
+        for (var paramsProp in opt_params) {
+          if (!/^swf_/.test(paramsProp) && !attr[paramsProp]) {
+            html += '<param name="' + paramsProp +
+              '" value="' + opt_params[paramsProp] + '" />';
           }
         }
         html += '</object>';

Modified: incubator/shindig/trunk/features/ifpc/ifpc.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/ifpc/ifpc.js?rev=630930&r1=630929&r2=630930&view=diff
==============================================================================
--- incubator/shindig/trunk/features/ifpc/ifpc.js (original)
+++ incubator/shindig/trunk/features/ifpc/ifpc.js Mon Feb 25 08:44:21 2008
@@ -273,7 +273,7 @@
    * @param {String} packet encoded parameters
    */
   function handleRequest(packet) {
-    var packet = decodeArgs_(packet);
+    packet = decodeArgs_(packet);
 
     var iframeId = packet.shift();
     var callId = packet.shift();
@@ -312,7 +312,7 @@
 
       var args = decodeArgs_(data);
 
-      var iframeId = args.shift();
+      iframeId = args.shift();
       var serviceName = args.shift();
       var remote_relay_url = args.shift();
       var callbackId = args.shift();

Modified: incubator/shindig/trunk/features/opensocial-reference/datarequest.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/datarequest.js?rev=630930&r1=630929&r2=630930&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/datarequest.js (original)
+++ incubator/shindig/trunk/features/opensocial-reference/datarequest.js Mon Feb 25 08:44:21 2008
@@ -333,8 +333,6 @@
 opensocial.DataRequest.prototype.newFetchPersonRequest = function(id,
     opt_params) {
   opt_params = opt_params || {};
-  var fields = opensocial.DataRequest.PeopleRequestFields;
-
   this.addDefaultProfileFields(opt_params);
 
   return opensocial.Container.get().newFetchPersonRequest(id, opt_params);

Modified: incubator/shindig/trunk/features/opensocial-samplecontainer/samplecontainer.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-samplecontainer/samplecontainer.js?rev=630930&r1=630929&r2=630930&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-samplecontainer/samplecontainer.js (original)
+++ incubator/shindig/trunk/features/opensocial-samplecontainer/samplecontainer.js Mon Feb 25 08:44:21 2008
@@ -148,14 +148,14 @@
 opensocial.SampleContainer.prototype.getIds = function(idSpec) {
   var ids = [];
   if (idSpec == opensocial.DataRequest.Group.VIEWER_FRIENDS) {
-    var friends = this.viewerFriends.asArray();
-    for (var i = 0; i < friends.length; i++) {
-      ids.push(friends[i].getId());
+    var viewerFriends = this.viewerFriends.asArray();
+    for (var i = 0; i < viewerFriends.length; i++) {
+      ids.push(viewerFriends[i].getId());
     }
   } else if (idSpec == opensocial.DataRequest.Group.OWNER_FRIENDS) {
-    var friends = this.ownerFriends.asArray();
-    for (var i = 0; i < friends.length; i++) {
-      ids.push(friends[i].getId());
+    var ownerFriends = this.ownerFriends.asArray();
+    for (var j = 0; j < ownerFriends.length; j++) {
+      ids.push(ownerFriends[j].getId());
     }
   } else if (idSpec == opensocial.DataRequest.PersonId.VIEWER) {
     ids.push(this.viewer.getId());
@@ -263,8 +263,8 @@
         var ids = this.getIds(request.idSpec);
 
         var values = {};
-        for (var i = 0; i < ids.length; i++) {
-          var id = ids[i];
+        for (var idIndex = 0; idIndex < ids.length; idIndex++) {
+          var id = ids[idIndex];
           if (this.personAppData[id]) {
             values[id] = {};
             for (var j = 0; j < request.keys.length; j++) {
@@ -299,11 +299,11 @@
         break;
 
       case 'FETCH_ACTIVITIES' :
-        var ids = this.getIds(request.idSpec);
+        var allIds = this.getIds(request.idSpec);
 
         var requestedActivities = [];
-        for (var i = 0; i < ids.length; i++) {
-          var activitiesForId = this.activities[ids];
+        for (var k = 0; k < allIds.length; k++) {
+          var activitiesForId = this.activities[allIds[k]];
           if (activitiesForId) {
             requestedActivities = requestedActivities.concat(activitiesForId);
           }

Modified: incubator/shindig/trunk/features/opensocial-samplecontainer/statefileparser.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-samplecontainer/statefileparser.js?rev=630930&r1=630929&r2=630930&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-samplecontainer/statefileparser.js (original)
+++ incubator/shindig/trunk/features/opensocial-samplecontainer/statefileparser.js Mon Feb 25 08:44:21 2008
@@ -52,9 +52,6 @@
   'If the state does not load make sure your URLs are in the same ' +
   'domain as this page.';
 
-  var me = this;
-
-
   $.ajax({type: "GET", url: stateUrl, dataType: "xml", timeout: 5000,
     error: function() {
       gadgetMessageDiv.innerHTML
@@ -110,7 +107,6 @@
   }
 
   // Build the friends list
-  var me = this;
   var viewerFriends = new Array();
   var friendsNode = $(containerNode).find('viewerFriends')[0];
   $(friendsNode).find('person').each(function() {
@@ -231,11 +227,11 @@
   xmlText += '  <personAppData>\n';
   for (var person in container.personAppData) {
     if (___.canInnocentEnum(container.personAppData, person)) {
-      for (var field in container.personAppData[person]) {
-        if (___.canInnocentEnum(container.personAppData[person], field)) {
+      for (var personField in container.personAppData[person]) {
+        if (___.canInnocentEnum(container.personAppData[person], personField)) {
           xmlText += '    <data person="' + person + '" ';
-          xmlText += 'field="' + field + '">';
-          xmlText += container.personAppData[person][field];
+          xmlText += 'field="' + personField + '">';
+          xmlText += container.personAppData[person][personField];
           xmlText += '</data>\n';
         }
       }
@@ -255,13 +251,13 @@
           continue;
         }
         xmlText += '    <stream';
-        for (var field in StateFileParser.STREAM_FIELDS) {
-          if (___.canInnocentEnum(StateFileParser.STREAM_FIELDS, field)) {
-            var value = activity.getField(field);
-            if (value == null) {
+        for (var streamField in StateFileParser.STREAM_FIELDS) {
+          if (___.canInnocentEnum(StateFileParser.STREAM_FIELDS, streamField)) {
+            var streamValue = activity.getField(streamField);
+            if (streamValue == null) {
               continue;
             }
-            xmlText += ' ' + field + '="' + value + '"';
+            xmlText += ' ' + streamField + '="' + streamValue + '"';
           }
         }
         xmlText += '>\n';
@@ -269,14 +265,14 @@
       }
 
       xmlText += '      <activity';
-      for (var field in activity.fields_) {
-        if (___.canInnocentEnum(activity.fields_, field)) {
-          var value = activity.getField(field);
-          if (value == null || field == 'mediaItems'
-              || field in StateFileParser.STREAM_FIELDS) {
+      for (var activityField in activity.fields_) {
+        if (___.canInnocentEnum(activity.fields_, activityField)) {
+          var activityValue = activity.getField(activityField);
+          if (activityValue == null || activityField == 'mediaItems'
+              || activityField in StateFileParser.STREAM_FIELDS) {
             continue;
           }
-          xmlText += ' ' + field + '="' + value + '"';
+          xmlText += ' ' + activityField + '="' + activityValue + '"';
         }
       }
       xmlText += '>';

Modified: incubator/shindig/trunk/java/gadgets/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/pom.xml?rev=630930&r1=630929&r2=630930&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/pom.xml (original)
+++ incubator/shindig/trunk/java/gadgets/pom.xml Mon Feb 25 08:44:21 2008
@@ -123,6 +123,7 @@
         <!-- <artifactId>maven-javascript-plugin</artifactId> -->
         <groupId>net.sf.alchim</groupId>
         <artifactId>yuicompressor-maven-plugin</artifactId>
+        <version>0.6</version>
         <executions>
           <execution>
             <goals>
@@ -141,8 +142,9 @@
             <exclude>**/*.png</exclude>
             <!-- Syndicator files are JSON, not javascript -->
             <exclude>**/*syndicator*.js</exclude>
-						<!-- Caja has some bugs too -->
-						<exclude>**/caja/*.js</exclude>
+            <!-- Caja has some bugs too -->
+            <exclude>**/caja/*.js</exclude>
+            <exclude>**/opensocial-samplecontainer/caja-compatible-jquery.js</exclude>
           </excludes>
         </configuration>
       </plugin>

Modified: incubator/shindig/trunk/javascript/container/cookies.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/cookies.js?rev=630930&r1=630929&r2=630930&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/container/cookies.js (original)
+++ incubator/shindig/trunk/javascript/container/cookies.js Mon Feb 25 08:44:21 2008
@@ -164,7 +164,7 @@
 goog.net.cookies.getKeyValues_ = function() {
   var cookie = String(document.cookie);
   var parts = cookie.split(/\s*;\s*/);
-  var keys = [], values = [], index, part, pair;
+  var keys = [], values = [], index, part;
   for (var i = 0; part = parts[i]; i++) {
     index = part.indexOf('=');
 

Modified: incubator/shindig/trunk/javascript/container/ifpc.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/ifpc.js?rev=630930&r1=630929&r2=630930&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/container/ifpc.js (original)
+++ incubator/shindig/trunk/javascript/container/ifpc.js Mon Feb 25 08:44:21 2008
@@ -273,7 +273,7 @@
    * @param {String} packet encoded parameters
    */
   function handleRequest(packet) {
-    var packet = decodeArgs_(packet);
+    packet = decodeArgs_(packet);
 
     var iframeId = packet.shift();
     var callId = packet.shift();
@@ -312,7 +312,7 @@
 
       var args = decodeArgs_(data);
 
-      var iframeId = args.shift();
+      iframeId = args.shift();
       var serviceName = args.shift();
       var remote_relay_url = args.shift();
       var callbackId = args.shift();