Skip to content

Instantly share code, notes, and snippets.

@chucktrukk
Created June 23, 2011 19:35
Show Gist options
  • Save chucktrukk/1043428 to your computer and use it in GitHub Desktop.
Save chucktrukk/1043428 to your computer and use it in GitHub Desktop.
find the URL for this script's absolute path and set as the resourceFolderName.
var resourcesFolderName = "my/folder/here";
var documentName = "name-of-doc";
var documentLoaderFilename = "this-script-name.js";
// find the URL for this script's absolute path and set as the resourceFolderName
try {
var scripts = document.getElementsByTagName('script');
for(var i = 0; i < scripts.length; i++) {
var scriptSrc = scripts[i].src;
if(scriptSrc != null && scriptSrc.indexOf(documentLoaderFilename) != -1) {
resourcesFolderName = scriptSrc.substr(0, scriptSrc.lastIndexOf("/"));
break;
}
}
} catch(err) { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment