From b7d2d2302d1ad8142ee480fd2dd0a735b499b52a Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 18 Feb 2012 06:35:38 +0000 Subject: [PATCH] fix handling of ui.page on load (fixes #512) --- static/js/pandora.js | 7 +++---- static/js/pandora/URL.js | 4 +++- static/js/pandora/appPanel.js | 8 +++----- static/js/pandora/home.js | 2 +- static/js/pandora/home.padma.js | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/static/js/pandora.js b/static/js/pandora.js index 837b31d7..b76eefd4 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -130,12 +130,11 @@ appPanel } function loadOxJS(callback) { - var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement, - script = document.createElement('script'); + var script = document.createElement('script'); script.onload = callback; script.src = '/static/oxjs/dev/Ox.js'; script.type = 'text/javascript'; - head.appendChild(script); + document.head.appendChild(script); } function loadOxUI(callback) { @@ -374,7 +373,7 @@ appPanel .attr({ src: Ox.PATH + 'Ox.UI/png/browser' + browser.name.replace(' ', '') + '128.png' }) - .css({border: 0, width: '32px', height: '32px', margin: '4px'}) + .css({width: '32px', height: '32px', margin: '4px'}) ) .appendTo($images); }); diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index f19f2619..e4583e26 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -79,7 +79,8 @@ pandora.URL = (function() { var set = { section: state.type == pandora.site.itemsSection ? 'items' : state.type, - item: state.item + item: state.item, + page: '' }; if (state.view) { @@ -132,6 +133,7 @@ pandora.URL = (function() { $(this).trigger('stop'); }); + Ox.Log('URL', 'UI.set', set) if (!pandora.$ui.appPanel && state.item && pandora.user.ui.find) { // on page load, if item is set and there was a query, // we have to check if the item actually matches the query, diff --git a/static/js/pandora/appPanel.js b/static/js/pandora/appPanel.js index 40fdfef6..9bcd7998 100644 --- a/static/js/pandora/appPanel.js +++ b/static/js/pandora/appPanel.js @@ -37,11 +37,9 @@ pandora.ui.appPanel = function() { }); function setPage(page) { if (page === '') { - /* - if (pandora.$ui.home) { - pandora.$ui.home.fadeOutScreen(); - } else - */ + ['site', 'account', 'preferences', 'help'].forEach(function(dialog) { + pandora.$ui[dialog + 'Dialog'] && pandora.$ui[dialog + 'Dialog'].close(); + }); if (pandora.$ui.tv) { pandora.$ui.tv.fadeOutScreen(); } diff --git a/static/js/pandora/home.js b/static/js/pandora/home.js index 530bfaf3..4d10d03c 100644 --- a/static/js/pandora/home.js +++ b/static/js/pandora/home.js @@ -137,7 +137,7 @@ pandora.ui.home = function() { }) .bindEvent({ click: function() { - pandora.UI.set({page: ''}); + pandora.UI.set({page: pandora.user.ui.page}); that.fadeOutScreen(); } }) diff --git a/static/js/pandora/home.padma.js b/static/js/pandora/home.padma.js index 72a7366b..0b40f561 100644 --- a/static/js/pandora/home.padma.js +++ b/static/js/pandora/home.padma.js @@ -145,7 +145,7 @@ pandora.ui.home = function() { }) .bindEvent({ click: function() { - pandora.UI.set({page: ''}); + pandora.UI.set({page: pandora.user.ui.page}); that.fadeOutScreen(); } })