From bcf9d37930949d2bdedbdebaef75c92e5ab925a4 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 2 Aug 2013 17:01:24 +0000 Subject: [PATCH] remove player/editor/timeline losefocus handlers (opening the item menu will make them lose focus), add gainfocus handler to browser; correct definition of canCut; enable mainMenu.replaceItemMenu --- static/js/browser.js | 3 +++ static/js/clipList.js | 3 --- static/js/editor.js | 3 --- static/js/mainMenu.js | 6 +++--- static/js/player.js | 3 --- static/js/timeline.js | 3 --- 6 files changed, 6 insertions(+), 15 deletions(-) diff --git a/static/js/browser.js b/static/js/browser.js index ec3bcef5d..d33cb1572 100644 --- a/static/js/browser.js +++ b/static/js/browser.js @@ -133,6 +133,9 @@ pandora.ui.browser = function() { copyadd: function() { Ox.Clipboard.add(pandora.user.ui.item, 'item'); }, + gainfocus: function() { + pandora.$ui.mainMenu.replaceItemMenu(); + }, open: function() { that.scrollToSelection(); }, diff --git a/static/js/clipList.js b/static/js/clipList.js index 8c92c53f2..d9a67ec57 100644 --- a/static/js/clipList.js +++ b/static/js/clipList.js @@ -147,9 +147,6 @@ pandora.ui.clipList = function(videoRatio) { pandora.$ui.statusbar.set('total', data); } }, - losefocus: function() { - pandora.$ui.mainMenu.replaceItemMenu(); - }, open: function(data) { var id = data.ids[0], item = !ui.item ? id.split('/')[0] : ui.item, diff --git a/static/js/editor.js b/static/js/editor.js index bdd97c841..60b223292 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -186,9 +186,6 @@ pandora.ui.editor = function(data) { Ox.getObjectById(pandora.site.layers, data.layer).title ).open(); }, - losefocus: function() { - pandora.$ui.mainMenu.replaceItemMenu(); - }, muted: function(data) { pandora.UI.set({videoMuted: data.muted}); }, diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index 48c4de0cc..0d37375d5 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -817,7 +817,8 @@ pandora.ui.mainMenu = function() { : !!ui.listSelection.length, canPaste = !ui.item && !isClipView && !isVideoView && listData.editable && listData.type == 'static' && Ox.Clipboard.type() == 'item', - canCut = canCopy && canPaste; + canCut = canCopy && !ui.item && !isClipView && !isVideoView + && listData.editable && listData.type == 'static'; return { id: 'itemMenu', title: Ox._('Item'), items: [ { id: 'add', title: Ox._('Add {0}', [Ox._(pandora.site.itemName.singular)]), disabled: pandora.site.itemRequiresVideo || !pandora.site.capabilities.canAddItems[pandora.user.level] }, { id: 'upload', title: Ox._('Upload Video...'), disabled: !pandora.site.capabilities.canAddItems[pandora.user.level] }, @@ -987,8 +988,7 @@ pandora.ui.mainMenu = function() { } that.replaceItemMenu = function() { - // FIXME: on opening the menu, this throws in Ox.Focus - // that.replaceMenu('itemMenu', getItemMenu()); + that.replaceMenu('itemMenu', getItemMenu()); return that; }; diff --git a/static/js/player.js b/static/js/player.js index 60aa2dc02..95733a2d4 100644 --- a/static/js/player.js +++ b/static/js/player.js @@ -98,9 +98,6 @@ pandora.ui.player = function(data) { loop: function(data) { pandora.UI.set({videoLoop: data.loop}); }, - losefocus: function() { - pandora.$ui.mainMenu.replaceItemMenu(); - }, muted: function(data) { pandora.UI.set({videoMuted: data.muted}); }, diff --git a/static/js/timeline.js b/static/js/timeline.js index 89100d215..f6ece0f4a 100644 --- a/static/js/timeline.js +++ b/static/js/timeline.js @@ -75,9 +75,6 @@ pandora.ui.timeline = function(data) { Ox.getObjectById(pandora.site.layers, data.layer).title ).open(); }, - losefocus: function() { - pandora.$ui.mainMenu.replaceItemMenu(); - }, muted: function(data) { pandora.UI.set({videoMuted: data.muted}); },