Added JS event for when the user changes the directory

This enables apps to detect directory changes which might be caused by
the user using the browser back button.

Please review @karlitschek @DeepDiver1975 @butonic @Kondou-ger 

This will be used to quick fix https://github.com/owncloud/apps/issues/1403 until we get a cleaner solution involving having the current file name in the URL.