From adbc8666c0e643f6f050a2ba79f28682af7eb3ce Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 6 Mar 2013 13:28:44 +0000 Subject: [PATCH] use ui.help (still not correct) --- static/js/pandora/URL.js | 6 +++++- static/js/pandora/helpDialog.js | 17 +++++++---------- static/js/pandora/mainMenu.js | 6 ++++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index d8f5ea4e1..7dff8fcc3 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -18,7 +18,8 @@ pandora.URL = (function() { } else { - state.type = pandora.user.ui.section == 'items' ? pandora.site.itemsSection : pandora.user.ui.section; + state.type = pandora.user.ui.section == 'items' + ? pandora.site.itemsSection : pandora.user.ui.section; state.item = pandora.user.ui[pandora.user.ui.section.slice(0, -1)]; if (pandora.user.ui.section == 'items') { @@ -119,6 +120,9 @@ pandora.URL = (function() { if (state.page) { set.page = state.page; + if (state.page == 'help') { + set.help = state.hash ? state.hash.anchor : ''; + } pandora.UI.set(set); callback && callback(); diff --git a/static/js/pandora/helpDialog.js b/static/js/pandora/helpDialog.js index ed645c4ec..1fd1388c7 100644 --- a/static/js/pandora/helpDialog.js +++ b/static/js/pandora/helpDialog.js @@ -3,10 +3,7 @@ pandora.ui.helpDialog = function() { - var selected = pandora.user.ui.hash && pandora.user.ui.hash.anchor - ? pandora.user.ui.hash.anchor : 'help', - - text = {}, + var text = {}, $loading = Ox.Element() .append( @@ -64,7 +61,7 @@ pandora.ui.helpDialog = function() { resize: function() { $list.size(); }, - 'pandora_hash.anchor': function(data) { + 'pandora_help': function(data) { pandora.user.ui.page == 'help' && that.select(data.value == '' ? 'help' : data.value); } @@ -105,14 +102,14 @@ pandora.ui.helpDialog = function() { max: 1, min: 1, scrollbarVisible: true, - selected: [selected], + selected: [pandora.user.ui.help || 'help'], sort: [{key: 'index', operator: '+'}], unique: 'id' }) .bindEvent({ select: function(data) { - var id = data.ids[0]; - pandora.UI.set({'hash.anchor': id == 'help' ? '' : id}); + var id = data.ids[0] == 'help' ? '' : data.ids[0]; + pandora.UI.set({help: id, 'hash.anchor': id}); } }); @@ -134,13 +131,13 @@ pandora.ui.helpDialog = function() { orientation: 'horizontal' }); - that.select(selected).options({content: $panel}); + that.select(pandora.user.ui.help).options({content: $panel}); $list.gainFocus(); }); that.select = function(id) { - $text.html(text[id]).scrollTop(0); + $text.html(text[id || 'help']).scrollTop(0); $text.find('img') .css({ width: '100%', diff --git a/static/js/pandora/mainMenu.js b/static/js/pandora/mainMenu.js index 7a30bf4da..949d843ce 100644 --- a/static/js/pandora/mainMenu.js +++ b/static/js/pandora/mainMenu.js @@ -286,7 +286,7 @@ pandora.ui.mainMenu = function() { click: function(data) { if ([ 'home', 'software', 'signup', 'signin', 'signout', - 'preferences', 'tv', 'help', 'api' + 'preferences', 'tv', 'api' ].concat( pandora.site.sitePages.map(function(page) { return page.id; @@ -352,6 +352,8 @@ pandora.ui.mainMenu = function() { filters: pandora.site.user.ui.filters }); pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser()); + } else if (data.id == 'help') { + pandora.UI.set({page: 'help', 'hash.anchor': ui.help}); } else if (data.id == 'clearcache') { Ox.Request.clearCache(); } else if (data.id == 'reloadapplication') { @@ -420,7 +422,7 @@ pandora.ui.mainMenu = function() { }, key_control_slash: function() { if (!pandora.hasDialogOrScreen()) { - pandora.UI.set({page: 'help'}); + pandora.UI.set({page: 'help', 'hash.anchor': ui.help}); } }, key_control_space: function() {