Sha256: a7343257d1ec47eff02689867fad6416c94dd9bda31d6aaa5aea104e9048f8d4

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

Stored size: 1.41 KB

Contents

(function() {
    var baseUrl= findScriptBaseName();

    function findScriptBaseName()
    {
        var scripts= document.getElementsByTagName("script");
        if (!scripts || !scripts.length)
            throw new Error("Could not find script");

        var l= scripts.length;
        var s;
        
        for (--l; l>=0; --l)
        {
            s= scripts[l];
            if (s.src)
            {
                var src= s.src;
                var lastSlash= src.lastIndexOf('/');
        
                if (-1===lastSlash)
                    throw new Error("Couldn't determine path from src: " + src);
            
                return src.substring(0, lastSlash+1);
            }
        }
        
        throw new Error("No script tags with src attribute.");
    }

    window.__bootstrap_nextScript= function()
    {
        if (!scripts.length)
            window.__filename__= null;
        else
            window.__filename__= scripts.shift();
    }
    
    var scripts= [];
    
    function loadScript(script)
    {
        script= baseUrl + script;
        scripts.push(script);

        if (!window.__filename__)
            window.__bootstrap_nextScript();
        
        document.write( ['<', 'script type="text/javascript"',
                         ' onload="window.__bootstrap_nextScript()"',
                         ' src="', script, '"></script>'].join("") );
    }
    
    @LOAD_SCRIPTS@
    
})();

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
distil-0.10.1 lib/bootstrap-template.js
distil-0.10.0 lib/bootstrap-template.js
distil-0.8.4 lib/bootstrap-template.js
distil-0.8.2 lib/bootstrap-template.js
distil-0.8.1 lib/bootstrap-template.js
distil-0.8.0 lib/bootstrap-template.js
distil-0.7.0 lib/bootstrap-template.js