sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r995968 - /sling/trunk/bundles/servlets/post/src/main/resources/system/sling.js
Date Fri, 10 Sep 2010 20:27:49 GMT
Author: justin
Date: Fri Sep 10 20:27:49 2010
New Revision: 995968

URL: http://svn.apache.org/viewvc?rev=995968&view=rev
Log:
SLING-1753 - changing logic such that all script tags are search and the first one ending
in /system/sling.js is used to determine the baseurl

Modified:
    sling/trunk/bundles/servlets/post/src/main/resources/system/sling.js

Modified: sling/trunk/bundles/servlets/post/src/main/resources/system/sling.js
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/post/src/main/resources/system/sling.js?rev=995968&r1=995967&r2=995968&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/post/src/main/resources/system/sling.js (original)
+++ sling/trunk/bundles/servlets/post/src/main/resources/system/sling.js Fri Sep 10 20:27:49
2010
@@ -412,10 +412,16 @@ var Sling = null;
     
     // obtain the base_url to communicate with sling on the server
     var scripts = document.getElementsByTagName("SCRIPT")
-    var script = scripts[scripts.length-1].src
-    Sling.baseurl = script.substring(0,script.length - Sling.PATH_OF_THIS_FILE.length);
-    Sling.currentPath = Sling._getPath();
-    Sling.isNew  = (Sling.currentPath.indexOf("/*")>=0)?true:false;
+    for (var i = 0; i < scripts.length; i++) {
+        var scriptSrc = scripts[i].src
+        if (scriptSrc.match(Sling.PATH_OF_THIS_FILE+"$")) {
+            Sling.baseurl = scriptSrc.substring(0,scriptSrc.length - Sling.PATH_OF_THIS_FILE.length);
+            Sling.currentPath = Sling._getPath();
+            Sling.isNew  = (Sling.currentPath.indexOf("/*")>=0)?true:false;
+    
+            break;
+        }
+    }
 
 // end sling code scope 
 })();



Mime
View raw message