function parse_url_and_load_page() {
// 'search', 'reverse', 'details'
- var pagename = window.location.pathname.replace('.html', '').replace(/^\//, '');
+ var pagename = window.location.pathname.replace('.html', '').replace(/.+\//, '');
+
+ if (pagename === '') pagename = 'search';
$('body').attr('id', pagename + '-page');
url_params.forEach(function (value, key) {
if (value === '') to_delete.push(key);
});
- for (var i=0; i<to_delete.length; i++) {
+ for (var i = 0; i < to_delete.length; i += 1) {
url_params.delete(to_delete[i]);
}
return url_params.toString();