jleyba / js-dossier

A JavaScript documentation generation tool.
Apache License 2.0
150 stars 15 forks source link

Search bar not working #77

Closed myphysicslab closed 8 years ago

myphysicslab commented 8 years ago

After typing the name UtilityCore in the Search bar, I get this:

Firefox can’t find the file at /Users/erikn/Documents/Programming/
jssimlab/docs//Users/erikn/Documents/Programming/jssimlab/docs/
myphysicslab.lab.util.UtilityCore.html.

Obviously the location of the file is being appended twice at the front. Perhaps there is something wrong with my dossier_config.json file? The contents of that file are:

{
    "output": "docs",
    "sources": [
        "src/lab/",
        "src/sims/",
        "src/test/"
    ],
    "closureLibraryDir": "closure-library/closure/goog",
    "readme": "README.md",
    "useMarkdown": "true",
    "typeFilters": [
        ".*\.i18n",
        "myphysicslab.lab.util.Terminal.regexPair"
    ],
    "excludes": [
        "goog/",
        "src/lab/engine2D/test",
        "src/lab/graph/test",
        "src/lab/model/test",
        "src/lab/util/test",
        "src/lab/view/test",
        "src/sims/experimental",
        "src/sims/pendulum/test",
        "src/sims/springs/test"
     ]
}
myphysicslab commented 8 years ago

I've found the problem and the fix. It's in the file src/js/app.js in the load method. The branch for when the url doesn't start with "http" is appending the base path, but should not be doing that.

load(/** string */uri) {
  if (this.navDrawer.isOpen && !page.useGutterNav()) {
    this.navDrawer.hide();
  }

  if (location.protocol.startsWith('http')) {
    // ... code not shown ...
  } else {
    location.href = page.getBasePath() + uri;
  }
}

That last line should be changed to just:

    location.href = uri;