From 9524306739c7cffd05ca78c07bb8c87f17c26e0d Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 16 Apr 2011 00:54:16 +0200 Subject: [PATCH] Show wanted if no page is selected --- couchpotato/static/scripts/couchpotato.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/couchpotato/static/scripts/couchpotato.js b/couchpotato/static/scripts/couchpotato.js index d299f77..6512829 100644 --- a/couchpotato/static/scripts/couchpotato.js +++ b/couchpotato/static/scripts/couchpotato.js @@ -23,7 +23,11 @@ var CouchPotato = new Class({ self.createPages(); History.addEvent('change', self.openPage.bind(self)); - History.handleInitialState(); + + if(window.location.hash) + History.handleInitialState(); + else + self.openPage(window.location.pathname); self.c.addEvent('click:relay(a)', self.pushState.bind(self)); }, @@ -77,9 +81,14 @@ var CouchPotato = new Class({ if(self.current_page) self.current_page.hide() - var page = self.pages[page_name]; - page.open(action, params); - page.show(); + try { + var page = self.pages[page_name] || self.pages.Wanted; + page.open(action, params); + page.show(); + } + catch(e){ + p("Can't open page:" + url) + } self.current_page = page;