eirikb / nipster

Search tool for npm
http://nipstr.com/
126 stars 20 forks source link

please url-encode the #hash%20value ? #7

Closed DTrejo closed 12 years ago

DTrejo commented 12 years ago

Would be great if this could be added, as then I'd be able to make links to certain searches.

Relevant line: https://github.com/eirikb/nipster/blob/gh-pages/main.js#L43

Would you be open to a pull request for this?

Thank you, D

eirikb commented 12 years ago

Do you think a normal encodeURIComponent would be enough?

DTrejo commented 12 years ago

Yes! I think that would be perfect! :) On Jul 10, 2012 11:13 PM, "Eirik Brandtzæg" < reply@reply.github.com> wrote:

Do you think a normal encodeURIComponent would be enough?


Reply to this email directly or view it on GitHub: https://github.com/eirikb/nipster/issues/7#issuecomment-6898924

DTrejo commented 12 years ago

(And decodeuricomponent as well) On Jul 10, 2012 11:56 PM, David.Daniel.Trejo@gmail.com wrote:

Yes! I think that would be perfect! :) On Jul 10, 2012 11:13 PM, "Eirik Brandtzæg" < reply@reply.github.com> wrote:

Do you think a normal encodeURIComponent would be enough?


Reply to this email directly or view it on GitHub: https://github.com/eirikb/nipster/issues/7#issuecomment-6898924

eirikb commented 12 years ago

It seems History.js decodes the string, so a simple window.History.replaceState({}, '', '#' + encodedInput) will not work. But I also noticed that History.js actually does not support hashes, so we might have to revert back to a normal change. Reverting will break the back-button-fix which History.js provides. I guess a quick workaround is to just check if window.history exists and use it when possible, as little functionality is actually used.

DTrejo commented 12 years ago

Thanks for looking into this. You can now see that the node.js irc chatroom has the bot running.

To see you site in action:

npm search nipster

and a problem-child search:

npm search nipster rocks
> http://eirikb.github.com/nipster/#nipster%20rocks
eirikb commented 12 years ago

I see the problem now, so I made a quick fix for this.
Looks good? http://eirikb.github.com/nipster/#nipster%20rocks

DTrejo commented 12 years ago

SCORE!

Thank your Eirik! D