From b85a637486847446a949d5202e20e753fc059e96 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 2 Nov 2011 06:48:45 +0000 Subject: [PATCH] enable/disable show/hide menu options and keyboard shortcuts correctly --- static/js/pandora/itemClips.js | 1 + static/js/pandora/menu.js | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/static/js/pandora/itemClips.js b/static/js/pandora/itemClips.js index b42401bb..b275675a 100644 --- a/static/js/pandora/itemClips.js +++ b/static/js/pandora/itemClips.js @@ -23,6 +23,7 @@ pandora.ui.itemClips = function(options) { self.height = self.options.ratio > 1 ? Math.round(self.size / self.options.ratio) : self.size; self.options.clips.forEach(function(clip, i) { + Ox.print('CLIP', clip) var id = self.options.id + '/' + clip['in'], title = Ox.map(clip.annotations, function(annotation) { return annotation.layer == 'subtitles' ? annotation.value : 0 diff --git a/static/js/pandora/menu.js b/static/js/pandora/menu.js index 79ab8f84..047bbf17 100644 --- a/static/js/pandora/menu.js +++ b/static/js/pandora/menu.js @@ -96,7 +96,7 @@ pandora.ui.mainMenu = function() { ] }, {}, { id: 'showsidebar', title: (ui.showSidebar ? 'Hide' : 'Show') + ' Sidebar', keyboard: 'shift s' }, - { id: 'showinfo', title: (ui.showInfo ? 'Hide' : 'Show') + ' Info', keyboard: 'shift i' }, + { id: 'showinfo', title: (ui.showInfo ? 'Hide' : 'Show') + ' Info', disabled: !ui.showSidebar, keyboard: 'shift i' }, { id: 'showgroups', title: (ui.showGroups ? 'Hide' : 'Show') + ' Groups', disabled: !!ui.item, keyboard: 'shift g' }, { id: 'showbrowser', title: (ui.showBrowser ? 'Hide' : 'Show') + ' ' + pandora.site.itemName.singular + ' Browser', disabled: !ui.item, keyboard: 'shift b' }, { id: 'showannotations', title: (ui.showAnnotations ? 'Hide' : 'Show') + ' Annotations', disabled: !ui.item || ['timeline', 'video'].indexOf(ui.itemView) == -1, keyboard: 'shift a' }, @@ -282,16 +282,17 @@ pandora.ui.mainMenu = function() { } }, key_shift_a: function() { - pandora.UI.set({showAnnotations: !ui.showAnnotations}); + ui.item && ['video', 'timeline'].indexOf(ui.view) > -1 + && pandora.UI.set({showAnnotations: !ui.showAnnotations}); }, key_shift_b: function() { - pandora.UI.set({showBrowser: !ui.showBrowser}); + ui.item && pandora.UI.set({showBrowser: !ui.showBrowser}); }, key_shift_g: function() { - pandora.UI.set({showGroups: !ui.showGroups}); + !ui.item && pandora.UI.set({showGroups: !ui.showGroups}); }, key_shift_i: function() { - pandora.UI.set({showInfo: !ui.showInfo}); + ui.showSidebar && pandora.UI.set({showInfo: !ui.showInfo}); }, key_shift_s: function() { pandora.UI.set({showSidebar: !ui.showSidebar}); @@ -350,6 +351,7 @@ pandora.ui.mainMenu = function() { }, pandora_showsidebar: function(data) { that.setItemTitle('showsidebar', (data.value ? 'Hide' : 'Show') + ' Sidebar'); + that[data.value ? 'enableItem' : 'disableItem']('showinfo'); } });