Sha256: c1dea33e7ee4460dd58a04de3f97a3c59c789ae0c42444b3f82bfa3dcfe5ce7f

Contents?: true

Size: 755 Bytes

Versions: 4

Compression:

Stored size: 755 Bytes

Contents

Skyline.Utils = {
  /*
    Function: getJsLocation(filename)
    Find the url, filename and parent url of "filename"
    
    Returns:
    A Hash with the following keys:
    filename - The filename you passed in
    url - The full SRC/url of the filename
    base - The parent url of filename
  */
  getJsLocation : function(filename){
    var sElements = document.getElementsByTagName("SCRIPT");
    var r = {};
  	for (var i=0; i<sElements.length; i++) {
  		src = sElements[i].src;
  		if (src && src.indexOf(filename) != -1) {

  			r.filename = filename;
  			r.base = src.substring(0, src.lastIndexOf('/'));
        r.url = src;

  			if ((p = src.indexOf('?')) != -1){
  				r.query = src.substring(p + 1);
  			}
  			return r;
  		}
  	}

  }
};

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
westarete-skylinecms-3.0.8.20100329 public/skyline/javascripts/src/skyline/src/utils.js
westarete-skylinecms-3.0.8.20100330 public/skyline/javascripts/src/skyline/src/utils.js
skylinecms-3.0.8 public/skyline/javascripts/src/skyline/src/utils.js
skylinecms-3.0.7 public/skyline/javascripts/src/skyline/src/utils.js