forked from 0x2620/pandora
correctly enable/disable 'find similar clips' menu entry
This commit is contained in:
parent
7f95c0ce6c
commit
f9df691c24
6 changed files with 73 additions and 15 deletions
|
@ -215,9 +215,11 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
//*/
|
||||
}
|
||||
!ui.item && pandora.UI.set('listSelection', [item]);
|
||||
pandora.$ui.mainMenu.enableItem('findsimilar');
|
||||
} else {
|
||||
$('.OxSelectedVideo').removeClass('OxSelectedVideo');
|
||||
!ui.item && pandora.UI.set('listSelection', []);
|
||||
pandora.$ui.mainMenu.disableItem('findsimilar');
|
||||
}
|
||||
},
|
||||
pandora_itemsort: function(data) {
|
||||
|
|
|
@ -359,7 +359,7 @@ pandora.ui.list = function() {
|
|||
} else if (view == 'calendars') {
|
||||
that = Ox.Element().css({margin: '16px'}).html(view + ' results view still missing.');
|
||||
} else if (view == 'clip') {
|
||||
that = pandora.ui.clipList();
|
||||
that = pandora.$ui.clipList = pandora.ui.clipList();
|
||||
} else if (view == 'video') {
|
||||
that = pandora.ui.clipPlayer();
|
||||
} else if (['map', 'calendar'].indexOf(view) > -1) {
|
||||
|
|
|
@ -130,7 +130,7 @@ pandora.ui.mainMenu = function() {
|
|||
] },
|
||||
{ id: 'advancedfind', title: 'Advanced Find...', keyboard: 'shift control f' },
|
||||
{},
|
||||
{ id: 'findsimilar', title: 'Find Similar Clips...', disabled: true, keyboard: 'alt control f'}
|
||||
{ id: 'findsimilar', title: 'Find Similar Clips...', keyboard: 'alt control f', disabled: !pandora.getItemIdAndPosition() }
|
||||
] },
|
||||
{ id: 'dataMenu', title: 'Data', items: [
|
||||
{ id: 'titles', title: 'Manage Titles...', disabled: !pandora.site.capabilities.canManageTitlesAndNames[pandora.user.level] },
|
||||
|
@ -257,12 +257,13 @@ pandora.ui.mainMenu = function() {
|
|||
}
|
||||
},
|
||||
click: function(data) {
|
||||
if ([].concat(
|
||||
['home', 'software'],
|
||||
if ([
|
||||
'home', 'software', 'signup', 'signin', 'signout',
|
||||
'preferences', 'tv', 'help'
|
||||
].concat(
|
||||
pandora.site.sitePages.map(function(page) {
|
||||
return page.id;
|
||||
}),
|
||||
['signup', 'signin', 'signout', 'preferences', 'tv', 'help']
|
||||
})
|
||||
).indexOf(data.id) > -1) {
|
||||
pandora.UI.set({page: data.id});
|
||||
} else if (data.id == 'upload') {
|
||||
|
@ -292,9 +293,9 @@ pandora.ui.mainMenu = function() {
|
|||
} else if (data.id == 'fullscreen') {
|
||||
pandora.$ui.player.options({fullscreen: true});
|
||||
} else if (data.id == 'advancedfind') {
|
||||
if (!pandora.hasDialogOrScreen()) {
|
||||
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
||||
}
|
||||
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
||||
} else if (data.id == 'findsimilar') {
|
||||
pandora.$ui.sequencesDialog = pandora.ui.sequencesDialog().open();
|
||||
} else if (data.id == 'titles') {
|
||||
(pandora.$ui.titlesDialog || (
|
||||
pandora.$ui.titlesDialog = pandora.ui.titlesDialog()
|
||||
|
@ -345,7 +346,9 @@ pandora.ui.mainMenu = function() {
|
|||
}
|
||||
},
|
||||
key_alt_control_f: function() {
|
||||
// ...
|
||||
if (!pandora.hasDialogOrScreen() && pandora.getItemIdAndPosition()) {
|
||||
pandora.$ui.sequencesDialog = pandora.ui.sequencesDialog().open();
|
||||
}
|
||||
},
|
||||
key_backtick: function() {
|
||||
changeFocus(1);
|
||||
|
@ -470,9 +473,17 @@ pandora.ui.mainMenu = function() {
|
|||
that[action]('showtimeline');
|
||||
that[action]('fullscreen');
|
||||
}
|
||||
that[
|
||||
pandora.getItemIdAndPosition() ? 'enableItem' : 'disableItem'
|
||||
]('findsimilar');
|
||||
},
|
||||
pandora_listselection: function(data) {
|
||||
that[data.value.length ? 'enableItem' : 'disableItem']('newlistfromselection');
|
||||
that[
|
||||
data.value.length ? 'enableItem' : 'disableItem'
|
||||
]('newlistfromselection');
|
||||
that[
|
||||
pandora.getItemIdAndPosition() ? 'enableItem' : 'disableItem'
|
||||
]('findsimilar');
|
||||
},
|
||||
pandora_listsort: function(data) {
|
||||
that.checkItem('sortMenu_sortitems_' + data.value[0].key);
|
||||
|
@ -485,6 +496,9 @@ pandora.ui.mainMenu = function() {
|
|||
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) {
|
||||
that.replaceMenu('sortMenu', getSortMenu());
|
||||
}
|
||||
that[
|
||||
pandora.getItemIdAndPosition() ? 'enableItem' : 'disableItem'
|
||||
]('findsimilar');
|
||||
},
|
||||
pandora_showannotations: function(data) {
|
||||
that.setItemTitle('showannotations', (data.value ? 'Hide' : 'Show') + ' Annotations');
|
||||
|
|
|
@ -227,7 +227,6 @@ pandora.ui.navigationView = function(type, videoRatio) {
|
|||
});
|
||||
type == 'map' && pandora.UI.set({mapSelection: id ? $element.options('find') : ''});
|
||||
}
|
||||
Ox.Log('', 'MAP SELECTION', id, data)
|
||||
}
|
||||
|
||||
function updateStatusbar(items) {
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
pandora.ui.sequencesDialog = function(id, position) {
|
||||
pandora.ui.sequencesDialog = function() {
|
||||
|
||||
var dialogHeight = Math.round((window.innerHeight - 48) * 0.9),
|
||||
var data = pandora.getItemIdAndPosition(),
|
||||
dialogHeight = Math.round((window.innerHeight - 48) * 0.9),
|
||||
dialogWidth = Math.round(window.innerWidth * 0.9),
|
||||
mode = pandora.user.ui.sequenceMode,
|
||||
sidebarWidth = 144,
|
||||
|
@ -22,7 +23,7 @@ pandora.ui.sequencesDialog = function(id, position) {
|
|||
],
|
||||
orientation: 'horizontal'
|
||||
});
|
||||
pandora.api.getSequence({id: id, mode: mode, position: position}, function(result) {
|
||||
pandora.api.getSequence({id: data.id, mode: mode, position: data.position}, function(result) {
|
||||
// result.data: {hash, in, out}
|
||||
var fixedRatio = 16/9,
|
||||
hash = result.data.hash,
|
||||
|
|
|
@ -631,6 +631,48 @@ pandora.getItemFind = function(find) {
|
|||
return itemFind;
|
||||
};
|
||||
|
||||
pandora.getItemIdAndPosition = function() {
|
||||
var selected, ret, ui = pandora.user.ui;
|
||||
function getIdAndPositionByClipId(clipId) {
|
||||
var fps = 25, split = clipId.replace('-', '/').split('/');
|
||||
return {
|
||||
id: split[0],
|
||||
position: Math.ceil(parseFloat(split[1]) * fps) / fps
|
||||
};
|
||||
}
|
||||
function getIdAndPositionByItemId(itemId) {
|
||||
return {
|
||||
id: itemId,
|
||||
position: ui.videoPoints[itemId] ? ui.videoPoints[itemId].position : 0
|
||||
};
|
||||
}
|
||||
if (!ui.item) {
|
||||
if (
|
||||
ui.listView == 'timelines'
|
||||
&& (selected = ui.listSelection).length == 1
|
||||
) {
|
||||
ret = getIdAndPositionByItemId(selected[0]);
|
||||
} else if (
|
||||
['clip', 'map', 'calendar'].indexOf(ui.listView) > -1
|
||||
&& pandora.$ui.clipList
|
||||
&& (selected = pandora.$ui.clipList.options('selected')).length == 1
|
||||
) {
|
||||
ret = getIdAndPositionByClipId(selected[0]);
|
||||
}
|
||||
} else {
|
||||
if (['player', 'editor', 'timeline'].indexOf(ui.itemView) > -1) {
|
||||
ret = getIdAndPositionByItemId(ui.item);
|
||||
} else if (
|
||||
['clips', 'map', 'calendar'].indexOf(ui.itemView) > -1
|
||||
&& pandora.$ui.clipList
|
||||
&& (selected = pandora.$ui.clipList.options('selected')).length == 1
|
||||
) {
|
||||
ret = getIdAndPositionByClipId(selected[0]);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
pandora.getListData = function(list) {
|
||||
var data = {}, folder;
|
||||
list = Ox.isUndefined(list) ? pandora.user.ui._list : list;
|
||||
|
|
Loading…
Reference in a new issue