CYB-368 - Gallery: browser back button in item detail view doesn't return to gallery main

https://jira.ets.berkeley.edu/jira/browse/CYB-368
@nicolaasmatthijs indeed, it actually made the code a bit cleaner when I combined them. Thanks!