determine current path in javascript

I gave up, this is so much easier