code: function scriptPrefix(filename) {
      var scripts = document.querySelectorAll('script[src*="' + filename + '"]');
      if (scripts.length !== 1) {
          return null;
      }
      var script = scripts[0].src;
      return script.substring(0, script.indexOf(filename));
  }
docs: Finds the directory that a loaded script is hosted on.
  
  @param {string} filename
  @return {string?}