You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by rb...@apache.org on 2012/05/10 22:15:09 UTC

svn commit: r1336874 - in /shindig/trunk: config/container.js features/src/main/javascript/features/container/init.js

Author: rbaxter85
Date: Thu May 10 20:15:08 2012
New Revision: 1336874

URL: http://svn.apache.org/viewvc?rev=1336874&view=rev
Log:
SHINDIG-1774
Committed for Mike May
init.js blindly assumes that the JS servlet feature URL is the last script tag defined

Modified:
    shindig/trunk/config/container.js
    shindig/trunk/features/src/main/javascript/features/container/init.js

Modified: shindig/trunk/config/container.js
URL: http://svn.apache.org/viewvc/shindig/trunk/config/container.js?rev=1336874&r1=1336873&r2=1336874&view=diff
==============================================================================
--- shindig/trunk/config/container.js (original)
+++ shindig/trunk/config/container.js Thu May 10 20:15:08 2012
@@ -123,6 +123,9 @@
 // Default Js Uri config: also must be overridden.
 // gadgets.uri.js.host should be protocol relative.
 "gadgets.uri.js.host" : "//${Cur['default.domain.unlocked.server']}", // Use unlocked host for better caching.
+
+// If you change the js.path you will need to define window.__CONTAINER_SCRIPT_ID prior to loading the <script>
+// tag for container JavaScript into the DOM.
 "gadgets.uri.js.path" : "${CONTEXT_ROOT}/gadgets/js",
 
 // Default concat Uri config; used for testing.

Modified: shindig/trunk/features/src/main/javascript/features/container/init.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container/init.js?rev=1336874&r1=1336873&r2=1336874&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/container/init.js (original)
+++ shindig/trunk/features/src/main/javascript/features/container/init.js Thu May 10 20:15:08 2012
@@ -1,22 +1,22 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * regarding copyright ownership.  The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * with the License.  You may obtain a copy of the License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 
-
 /**
  * @fileoverview Initial configuration/boot-strapping work for common container
  * to operate. This includes setting up global environment variables.
@@ -31,8 +31,10 @@
       scriptEl = document.getElementById(window.__CONTAINER_SCRIPT_ID);
     } else {
       var scriptEls = document.getElementsByTagName('script');
-      if (scriptEls.length > 0) {
-        scriptEl = scriptEls[scriptEls.length - 1];
+      for(var i = 0; !scriptEls && i < scriptEls.length; i++) {
+        if(/.*gadgets\/js\/.*container.*[.]js.*[?&]c=1(&|$).*/.test(scriptEls[i].src)) {
+          scriptEl = scriptEls[i];
+        }
       }
     }