Implement window.location redirection script

See `src/shim.html`. The strategy is as follows:

  1.  GET: `host.com/search/q=star`
  1.  nginx tries to serve the file `WWW_ROOT/search/q=star`
  1.  No such file, so nginx responds (should be 301/302) with `shim.html`
  1.  `shim.html` runs its `<script>`, matches `/search/`, and re-writes `window.location` to `/#/search/q=star`
  1.  nginx sees GET: `/`
  1.  nginx returns `index.html`, and the browser still has `location.hash="/#/search/q=star"`
  1. `require.js` load the application, `backbone.router` takes over using `location.hash`

@romanchyla @aholachek :
See in-line comments, especially the point about regex vs string matching and dealing with multiple '#'s. Feedback expected!
i'll review and write a test for it, if the webserver is ready, then this
is the only thing that stops us from deployment :)

On Thu, Sep 11, 2014 at 11:12 AM, Vladimir Sudilovsky <
notifications@github.com> wrote:

> In src/shim.html:
>
> > +
> > +(function () {
> > +  var config = { //Will be moved to a separate file? How will we pass this config to this script? AMD seems overkill for this.
> > +    'routes': [
> > +      '/search', //Should we upgrade these to regex instead of simple string matching
> > +      '/account',
> > +    ],
> > +    'error_pages': {
> > +      404: '/404.html'
> > +    },
> > +  }
> > +
> > +  function findApplicationRoute() {
> > +    //The window.location object can be written without the window prefix.
> > +    //Is it worth it to write this in vanilla JS instead of using jQuery.each?
> > +    $.each(config.routes, function(index,value){
>
> Don't think that implementation will work. As soon as you change
> location.pathname, the browser moves to that path.
>
> $.each doesn't need to break, since it will return on the first match.
> Nevertheless, probably better to just do return with vanilla JS since
> less dependencies is better.
>
> Anyways, I'm waiting to hear what you want me to do with this. The
> webserver is configured to serve src/shim.html in adsabs-vagrant.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/adsabs/bumblebee/pull/90/files#r17426680>.
>