|  | @@ -15,8 +15,19 @@
 | 
	
		
			
				|  |  |  var require;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  require = function (require) {
 | 
	
		
			
				|  |  | -    var scripts = document.getElementsByTagName("script");
 | 
	
		
			
				|  |  | -    var me = scripts[scripts.length - 1];
 | 
	
		
			
				|  |  | +    // To be able to use its path and attrubutes
 | 
	
		
			
				|  |  | +    // to map other parts of Amber, this code must find its <script> tag.
 | 
	
		
			
				|  |  | +    // It first looks for id 'amber-path-mapper'.
 | 
	
		
			
				|  |  | +    // When loading amber.js asynchronously, you must include this id,
 | 
	
		
			
				|  |  | +    // or the code can not reliably find its <script>.
 | 
	
		
			
				|  |  | +    var me = document.getElementById("amber-path-mapper");
 | 
	
		
			
				|  |  | +    if (!me || me.tagName.toLowerCase() !== "script") {
 | 
	
		
			
				|  |  | +        // If <script> with 'amber-path-mapper' id is not present,
 | 
	
		
			
				|  |  | +        // (this id is not necessary for inline <script> tag in HTML),
 | 
	
		
			
				|  |  | +        // it uses the "find the last <script> tag present in the moment" method.
 | 
	
		
			
				|  |  | +        var scripts = document.getElementsByTagName("script");
 | 
	
		
			
				|  |  | +        me = scripts[scripts.length - 1];
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      var src = me.src;
 | 
	
		
			
				|  |  |      // strip the last two elements from the URL
 | 
	
		
			
				|  |  |      // e.g. http://app.com/amber/support/amber.js -> http://app.com/amber
 |