diff options
Diffstat (limited to 'www/js/router.js')
-rw-r--r-- | www/js/router.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/www/js/router.js b/www/js/router.js index 62b9a77..d9d070f 100644 --- a/www/js/router.js +++ b/www/js/router.js @@ -69,9 +69,11 @@ Rdxport.Router.prototype.route = function(page, subpage) { //todo: add errors });*/ + var href = ['', '']; if (!page && !subpage) { - page = locationHrefValue(); - subpage = ''; + href = locationHrefValue(); + page = href[1]; + subpage = href[2]; } shows_cleanup(); @@ -90,8 +92,9 @@ Rdxport.Router.prototype.route = function(page, subpage) { var href = $(this).attr('href').split('/'); self.route(href[1], href[2]); }); - $(window).on('popstate', function(event) { - self.route(locationHrefValue(), ''); + $(window).off('popstate').on('popstate', function(event) { + var href = locationHrefValue(); + self.route(href[1], href[2]); }); switch (page) { @@ -115,10 +118,11 @@ Rdxport.Router.prototype.route = function(page, subpage) { break; } - if (locationHrefValue() !== page && page !== 'logout') { + href = locationHrefValue(); + if (href[1] !== page && page !== 'logout' && (!href[2] || href[2] !== subpage)) { var url = '/' + page + '/'; if (subpage) { - url +=+ subpage + '/'; + url += subpage + '/'; } history.pushState(null, null, url); } @@ -149,7 +153,7 @@ Rdxport.Router.prototype.logout = function() { Rdxport.Router.prototype.shows = function(subpage) { $('#app-shows').show(); $('#nav-btn-shows').addClass('active'); - shows_init(); + shows_init(subpage); }; Rdxport.Router.prototype.jingles = function() { @@ -161,7 +165,7 @@ Rdxport.Router.prototype.jingles = function() { Rdxport.Router.prototype.musicpools = function(subpage) { $('#app-musicpools').show(); $('#nav-btn-musicpools').addClass('active'); - musicpools_init(); + musicpools_init(subpage); }; Rdxport.Router.prototype.musicgrid = function() { |