2011-07-29 18:37:11 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
2012-11-01 14:21:44 +00:00
|
|
|
|
2012-02-03 09:15:38 +00:00
|
|
|
'use strict';
|
2012-11-01 14:21:44 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.ui.mainMenu = function() {
|
2011-09-27 14:14:40 +00:00
|
|
|
|
2012-03-27 07:14:59 +00:00
|
|
|
var isGuest = pandora.user.level == 'guest',
|
2011-09-23 10:44:54 +00:00
|
|
|
ui = pandora.user.ui,
|
2011-11-02 02:41:24 +00:00
|
|
|
findState = pandora.getFindState(ui.find),
|
2012-11-01 14:21:44 +00:00
|
|
|
fullscreenState = Ox.Fullscreen.getState(),
|
2011-06-19 17:49:25 +00:00
|
|
|
that = Ox.MainMenu({
|
2011-05-25 19:42:45 +00:00
|
|
|
extras: [
|
2011-06-19 17:49:25 +00:00
|
|
|
pandora.$ui.loadingIcon = Ox.LoadingIcon({
|
2011-05-25 19:42:45 +00:00
|
|
|
size: 'medium'
|
|
|
|
})
|
|
|
|
],
|
|
|
|
id: 'mainMenu',
|
2012-05-24 08:22:56 +00:00
|
|
|
menus: [].concat(
|
2011-10-14 19:25:29 +00:00
|
|
|
[
|
2012-05-24 08:22:56 +00:00
|
|
|
{ id: pandora.site.site.id + 'Menu', title: pandora.site.site.name, items: [].concat(
|
2011-10-24 15:58:10 +00:00
|
|
|
[
|
|
|
|
{ id: 'home', title: 'Home' },
|
|
|
|
{}
|
|
|
|
],
|
2012-06-16 21:14:40 +00:00
|
|
|
Ox.clone(pandora.site.sitePages, true),
|
2011-10-24 15:58:10 +00:00
|
|
|
[
|
|
|
|
{},
|
|
|
|
{ id: 'software', title: 'Software' }
|
|
|
|
]
|
|
|
|
) },
|
2011-10-14 19:25:29 +00:00
|
|
|
{ id: 'userMenu', title: 'User', items: [
|
2012-03-08 09:40:04 +00:00
|
|
|
{ id: 'username', title: 'User: ' + (isGuest ? 'not signed in' : Ox.encodeHTMLEntities(pandora.user.username)), disabled: true },
|
2011-09-04 21:15:53 +00:00
|
|
|
{},
|
2011-10-14 19:25:29 +00:00
|
|
|
{ id: 'preferences', title: 'Preferences...', disabled: isGuest, keyboard: 'control ,' },
|
2011-11-03 14:09:30 +00:00
|
|
|
{ id: 'archives', title: 'Archives...', disabled: /*isGuest*/ true },
|
2011-10-14 19:25:29 +00:00
|
|
|
{},
|
|
|
|
{ id: 'signup', title: 'Sign Up...', disabled: !isGuest },
|
|
|
|
isGuest ? { id: 'signin', title: 'Sign In...' }
|
|
|
|
: { id: 'signout', title: 'Sign Out...'}
|
|
|
|
] },
|
|
|
|
getListMenu(),
|
|
|
|
{ id: 'editMenu', title: 'Edit', items: [
|
2013-02-25 10:20:04 +00:00
|
|
|
{ id: 'add', title: 'Add ' + pandora.site.itemName.singular, disabled: pandora.site.itemRequiresVideo || !pandora.site.capabilities.canAddItems[pandora.user.level] },
|
|
|
|
{ id: 'upload', title: 'Upload Video...', disabled: !pandora.site.capabilities.canAddItems[pandora.user.level] },
|
|
|
|
{},
|
2011-10-14 19:25:29 +00:00
|
|
|
{ id: 'undo', title: 'Undo', disabled: true, keyboard: 'control z' },
|
|
|
|
{ id: 'redo', title: 'Redo', disabled: true, keyboard: 'shift control z' },
|
|
|
|
{},
|
|
|
|
{ id: 'cut', title: 'Cut', disabled: true, keyboard: 'control x' },
|
|
|
|
{ id: 'copy', title: 'Copy', disabled: true, keyboard: 'control c' },
|
|
|
|
{ id: 'paste', title: 'Paste', disabled: true, keyboard: 'control v' },
|
|
|
|
{ id: 'delete', title: 'Delete', disabled: true, keyboard: 'delete' },
|
|
|
|
{},
|
|
|
|
{ id: 'selectall', title: 'Select All', disabled: true, keyboard: 'control a' },
|
|
|
|
{ id: 'selectnone', title: 'Select None', disabled: true, keyboard: 'shift control a' },
|
|
|
|
{ id: 'invertselection', title: 'Invert Selection', disabled: true, keyboard: 'alt control a' }
|
|
|
|
] },
|
|
|
|
{ id: 'viewMenu', title: 'View', items: [
|
2012-03-18 14:59:00 +00:00
|
|
|
{ id: 'items', title: 'View ' + pandora.site.itemName.plural, items: [
|
|
|
|
{ group: 'listview', min: 1, max: 1, items: pandora.site.listViews.map(function(view) {
|
2011-10-14 19:25:29 +00:00
|
|
|
return Ox.extend({
|
2012-05-26 15:46:24 +00:00
|
|
|
checked: ui.listView == view.id
|
2011-10-14 19:25:29 +00:00
|
|
|
}, view);
|
|
|
|
}) },
|
|
|
|
]},
|
2012-05-24 08:22:56 +00:00
|
|
|
{ id: 'icons', title: 'Icons', items: [].concat([
|
2012-02-19 14:15:24 +00:00
|
|
|
{ group: 'viewicons', min: 1, max: 1, items: ['posters', 'frames'].map(function(icons) {
|
|
|
|
return {id: icons, title: Ox.toTitleCase(icons), checked: ui.icons == icons};
|
2012-12-22 01:17:59 +00:00
|
|
|
}) },
|
2012-02-19 14:15:24 +00:00
|
|
|
{},
|
2012-12-22 01:17:59 +00:00
|
|
|
], pandora.site.media.importPosters ? [
|
|
|
|
{ id: 'showsiteposters', title: 'Always Show ' + pandora.site.site.name + ' Poster', checked: ui.showSitePosters },
|
|
|
|
{}
|
|
|
|
] : [], [
|
|
|
|
{ id: 'showreflections', title: 'Show Reflections', checked: true, disabled: true }
|
|
|
|
]
|
2012-02-19 14:15:24 +00:00
|
|
|
) },
|
2012-03-06 21:28:27 +00:00
|
|
|
{ id: 'timelines', title: 'Timelines', items: [
|
2012-03-17 06:31:34 +00:00
|
|
|
{ group: 'viewtimelines', min: 1, max: 1, items: pandora.site.timelines.map(function(mode) {
|
2012-06-15 13:20:35 +00:00
|
|
|
return {id: mode.id, title: mode.title, checked: ui.videoTimeline == mode.id};
|
2012-03-06 21:28:27 +00:00
|
|
|
}) }
|
|
|
|
]},
|
2011-10-14 19:25:29 +00:00
|
|
|
{ id: 'columns', title: 'Columns', items: [
|
2011-11-11 13:20:53 +00:00
|
|
|
{ id: 'loadcolumns', title: 'Load Layout...', disabled: true },
|
|
|
|
{ id: 'savecolumns', title: 'Save Layout...', disabled: true },
|
2011-10-14 19:25:29 +00:00
|
|
|
{},
|
2011-11-11 13:20:53 +00:00
|
|
|
{ id: 'resetcolumns', title: 'Reset Layout', disabled: true }
|
2012-03-06 21:28:27 +00:00
|
|
|
] },
|
2011-10-14 19:25:29 +00:00
|
|
|
{},
|
2012-03-18 14:59:00 +00:00
|
|
|
{ id: 'item', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], items: [
|
2011-10-14 19:25:29 +00:00
|
|
|
{ group: 'itemview', min: 1, max: 1, items: pandora.site.itemViews.map(function(view) {
|
|
|
|
return Ox.extend({
|
2012-05-26 15:46:24 +00:00
|
|
|
checked: ui.itemView == view.id
|
2011-10-14 19:25:29 +00:00
|
|
|
}, view);
|
|
|
|
}) },
|
2012-03-06 21:28:27 +00:00
|
|
|
] },
|
2012-03-18 14:59:00 +00:00
|
|
|
{ id: 'clips', title: 'Open Clips', items: [
|
2012-04-18 08:41:32 +00:00
|
|
|
{ group: 'videoview', min: 1, max: 1, items: ['player', 'editor', 'timeline'].map(function(view) {
|
2012-04-17 07:06:19 +00:00
|
|
|
return {id: view, title: Ox.toTitleCase(view), checked: ui.videoView == view};
|
2011-10-14 19:25:29 +00:00
|
|
|
}) }
|
|
|
|
] },
|
|
|
|
{},
|
2011-11-06 08:28:10 +00:00
|
|
|
{ id: 'filters', title: 'Filters', items: [
|
|
|
|
{ group: 'filters', min: 5, max: 5, items: pandora.site.filters.map(function(filter) {
|
2011-10-14 19:25:29 +00:00
|
|
|
return Ox.extend({
|
2012-01-04 08:10:47 +00:00
|
|
|
checked: Ox.getIndexById(ui.filters, filter.id) > -1
|
2011-11-06 08:28:10 +00:00
|
|
|
}, filter);
|
2011-10-14 19:25:29 +00:00
|
|
|
}) },
|
|
|
|
{},
|
2011-11-06 08:28:10 +00:00
|
|
|
{ id: 'resetfilters', title: 'Reset Filters' }
|
2011-10-14 19:25:29 +00:00
|
|
|
] },
|
|
|
|
{},
|
|
|
|
{ id: 'showsidebar', title: (ui.showSidebar ? 'Hide' : 'Show') + ' Sidebar', keyboard: 'shift s' },
|
2011-11-02 06:48:45 +00:00
|
|
|
{ id: 'showinfo', title: (ui.showInfo ? 'Hide' : 'Show') + ' Info', disabled: !ui.showSidebar, keyboard: 'shift i' },
|
2011-11-06 08:28:10 +00:00
|
|
|
{ id: 'showfilters', title: (ui.showFilters ? 'Hide' : 'Show') + ' Filters', disabled: !!ui.item, keyboard: 'shift f' },
|
2011-10-14 19:25:29 +00:00
|
|
|
{ id: 'showbrowser', title: (ui.showBrowser ? 'Hide' : 'Show') + ' ' + pandora.site.itemName.singular + ' Browser', disabled: !ui.item, keyboard: 'shift b' },
|
2012-04-17 12:05:23 +00:00
|
|
|
{ id: 'showannotations', title: (ui.showAnnotations ? 'Hide' : 'Show') + ' Annotations', disabled: !ui.item || ['timeline', 'player', 'editor'].indexOf(ui.itemView) == -1, keyboard: 'shift a' },
|
2012-04-17 07:06:19 +00:00
|
|
|
{ id: 'showtimeline', title: (ui.showTimeline ? 'Hide' : 'Show') + ' Timeline', disabled: !ui.item || ui.itemView != 'player', keyboard: 'shift t' },
|
2011-10-14 19:25:29 +00:00
|
|
|
{},
|
2012-11-01 15:19:46 +00:00
|
|
|
{ id: 'togglefullscreen', title: (fullscreenState ? 'Exit' : 'Enter') + ' Fullscreen', disabled: fullscreenState === void 0, keyboard: 'shift alt control f' },
|
2012-11-01 14:21:44 +00:00
|
|
|
{ id: 'entervideofullscreen', title: 'Enter Video Fullscreen', disabled: !ui.item || ui.itemView != 'player' },
|
2012-03-23 12:00:04 +00:00
|
|
|
{},
|
2011-10-14 19:25:29 +00:00
|
|
|
{ id: 'theme', title: 'Theme', items: [
|
2013-02-10 11:52:31 +00:00
|
|
|
{ group: 'settheme', min: 1, max: 1, items: pandora.site.themes.map(function(theme) {
|
|
|
|
return {id: theme, title: Ox.Theme.getThemeData(theme).themeName, checked: ui.theme == theme}
|
|
|
|
}) }
|
2011-10-14 19:25:29 +00:00
|
|
|
] }
|
2011-05-25 19:42:45 +00:00
|
|
|
]},
|
2011-10-14 19:25:29 +00:00
|
|
|
getSortMenu(),
|
|
|
|
{ id: 'findMenu', title: 'Find', items: [
|
|
|
|
{ id: 'find', title: 'Find', items: [
|
2012-03-18 14:59:00 +00:00
|
|
|
{ group: 'find', min: 0, max: 1, items: pandora.site.findKeys.map(function(key, i) {
|
2011-10-14 19:25:29 +00:00
|
|
|
return Ox.extend({
|
2011-11-02 02:41:24 +00:00
|
|
|
checked: key.id == findState.key
|
2011-10-14 19:25:29 +00:00
|
|
|
}, key);
|
|
|
|
}) }
|
|
|
|
] },
|
2012-03-18 14:59:00 +00:00
|
|
|
{ id: 'advancedfind', title: 'Advanced Find...', keyboard: 'shift control f' },
|
|
|
|
{},
|
2012-06-15 14:43:05 +00:00
|
|
|
{ id: 'findsimilar', title: 'Find Similar Clips...', keyboard: 'alt control f', disabled: !pandora.getItemIdAndPosition() }
|
2011-08-19 06:40:19 +00:00
|
|
|
] },
|
2011-10-14 19:25:29 +00:00
|
|
|
{ id: 'dataMenu', title: 'Data', items: [
|
2012-03-27 07:14:59 +00:00
|
|
|
{ id: 'titles', title: 'Manage Titles...', disabled: !pandora.site.capabilities.canManageTitlesAndNames[pandora.user.level] },
|
|
|
|
{ id: 'names', title: 'Manage Names...', disabled: !pandora.site.capabilities.canManageTitlesAndNames[pandora.user.level] },
|
2011-09-18 00:31:41 +00:00
|
|
|
{},
|
2012-03-27 07:14:59 +00:00
|
|
|
{ id: 'places', title: 'Manage Places...', disabled: !pandora.site.capabilities.canManagePlacesAndEvents[pandora.user.level] },
|
|
|
|
{ id: 'events', title: 'Manage Events...', disabled: !pandora.site.capabilities.canManagePlacesAndEvents[pandora.user.level] },
|
2011-10-14 19:25:29 +00:00
|
|
|
{},
|
2012-03-27 07:14:59 +00:00
|
|
|
{ id: 'users', title: 'Manage Users...', disabled: !pandora.site.capabilities.canManageUsers[pandora.user.level] },
|
|
|
|
{ id: 'statistics', title: 'Statistics...', disabled: !pandora.site.capabilities.canManageUsers[pandora.user.level] }
|
2011-09-17 23:24:53 +00:00
|
|
|
] },
|
2011-10-14 19:25:29 +00:00
|
|
|
{ id: 'helpMenu', title: 'Help', items: [
|
2013-03-04 12:52:27 +00:00
|
|
|
{ id: 'help', title: 'Help...', keyboard: 'control ?' },
|
|
|
|
{ id: 'api', title: 'API Documentation...' }
|
2011-09-09 12:09:05 +00:00
|
|
|
] }
|
2011-10-14 19:25:29 +00:00
|
|
|
],
|
|
|
|
pandora.site.capabilities.canSeeDebugMenu[pandora.user.level]
|
|
|
|
? [
|
|
|
|
{ id: 'debugMenu', title: 'Debug', items: [
|
2011-10-26 20:45:12 +00:00
|
|
|
{ id: 'clearcache', title: 'Clear Cache'},
|
|
|
|
{ id: 'reloadapplication', title: 'Reload Application'},
|
2012-06-30 11:56:04 +00:00
|
|
|
{},
|
2012-06-30 12:13:35 +00:00
|
|
|
{ id: 'debugmode', title: (pandora.localStorage('enableDebugMode') ? 'Disable' : 'Enable') + ' Debug Mode' },
|
2012-06-30 11:56:04 +00:00
|
|
|
{ id: 'eventlogging', title: (pandora.localStorage('enableEventLogging') ? 'Disable' : 'Enable') + ' Event Logging'},
|
|
|
|
{},
|
2012-06-30 12:13:35 +00:00
|
|
|
{ id: 'errorlogs', title: 'View Error Logs...'},
|
|
|
|
{ id: 'tests', title: 'Run Tests'}
|
2011-10-14 19:25:29 +00:00
|
|
|
] }
|
|
|
|
]
|
|
|
|
: []
|
|
|
|
)
|
2011-05-25 19:42:45 +00:00
|
|
|
})
|
2011-11-01 12:03:02 +00:00
|
|
|
.bindKeyboard()
|
2011-05-25 19:42:45 +00:00
|
|
|
.bindEvent({
|
2011-09-17 17:40:15 +00:00
|
|
|
change: function(data) {
|
2011-09-18 01:52:43 +00:00
|
|
|
var value = data.checked[0] ? data.checked[0].id : null;
|
2011-11-07 12:12:13 +00:00
|
|
|
if (data.id == 'allitems') {
|
|
|
|
if (data.checked) {
|
|
|
|
pandora.UI.set('find', {conditions: [], operator: '&'});
|
|
|
|
} else {
|
|
|
|
that.checkItem('allitems');
|
|
|
|
}
|
2013-02-11 09:00:16 +00:00
|
|
|
} else if (data.id == 'cliporder') {
|
|
|
|
if (!ui.item) {
|
|
|
|
pandora.UI.set({listSort: [{key: pandora.user.ui.listSort[0].key, operator: value == 'ascending' ? '+' : '-'}]});
|
|
|
|
} else {
|
|
|
|
pandora.UI.set({itemSort: [{key: pandora.user.ui.itemSort[0].key, operator: value == 'ascending' ? '+' : '-'}]});
|
|
|
|
}
|
|
|
|
} else if (data.id == 'clipsort') {
|
|
|
|
if (!ui.item) {
|
|
|
|
pandora.UI.set({listSort: [{key: value, operator: pandora.getSortOperator(value)}]});
|
|
|
|
} else {
|
|
|
|
pandora.UI.set({itemSort: [{key: value, operator: pandora.getSortOperator(value)}]});
|
|
|
|
}
|
2011-11-07 12:12:13 +00:00
|
|
|
} else if (data.id == 'find') {
|
2012-03-18 14:59:00 +00:00
|
|
|
if (value) {
|
|
|
|
pandora.$ui.findSelect.value(value);
|
2012-03-18 15:11:16 +00:00
|
|
|
if (pandora.user.ui._findState.key == 'advanced') {
|
|
|
|
// fixme: autocomplete function doesn't get updated
|
|
|
|
pandora.$ui.findInput.options({placeholder: ''});
|
|
|
|
}
|
2012-03-18 14:59:00 +00:00
|
|
|
} else {
|
|
|
|
that.checkItem('findMenu_find_' + pandora.$ui.findSelect.value());
|
|
|
|
}
|
2012-03-18 15:11:16 +00:00
|
|
|
pandora.$ui.findInput.focusInput(true);
|
2013-02-11 09:00:16 +00:00
|
|
|
} else if (data.id == 'itemorder') {
|
|
|
|
pandora.UI.set({listSort: [{key: pandora.user.ui.listSort[0].key, operator: value == 'ascending' ? '+' : '-'}]});
|
|
|
|
} else if (data.id == 'itemsort') {
|
|
|
|
pandora.UI.set({listSort: [{key: value, operator: pandora.getSortOperator(value)}]});
|
2011-09-26 19:17:39 +00:00
|
|
|
} else if (data.id == 'itemview') {
|
|
|
|
pandora.UI.set({itemView: value});
|
2012-03-18 14:59:00 +00:00
|
|
|
} else if (data.id == 'listview') {
|
|
|
|
var set = {listView: value};
|
|
|
|
if (
|
|
|
|
!pandora.isClipView(key, pandora.user.ui.item)
|
|
|
|
&& ['title', 'position'].indexOf(pandora.user.ui.listSort[0].key) > -1
|
|
|
|
) {
|
|
|
|
set.listSort = pandora.site.user.ui.listSort;
|
|
|
|
}
|
|
|
|
pandora.UI.set(set);
|
2011-11-06 08:28:10 +00:00
|
|
|
} else if (Ox.startsWith(data.id, 'orderfilter')) {
|
|
|
|
var filters = Ox.clone(pandora.user.ui.filters),
|
|
|
|
id = data.id.replace('orderfilter', ''),
|
2012-01-04 08:10:47 +00:00
|
|
|
index = Ox.getIndexById(filters, id),
|
|
|
|
key = filters[index].sort[0].key,
|
2011-09-17 23:24:53 +00:00
|
|
|
operator = value == 'ascending' ? '+' : '-';
|
2012-01-04 08:10:47 +00:00
|
|
|
pandora.$ui.filters[index].options({
|
2011-09-17 23:24:53 +00:00
|
|
|
sort: [{key: key, operator: operator}]
|
|
|
|
});
|
2012-01-04 08:10:47 +00:00
|
|
|
filters[index].sort[0].operator = operator;
|
2011-11-06 08:28:10 +00:00
|
|
|
pandora.UI.set({filters: filters});
|
2011-09-09 12:09:05 +00:00
|
|
|
} else if (data.id == 'settheme') {
|
2013-02-22 04:16:58 +00:00
|
|
|
var iframe, src;
|
2011-09-09 12:09:05 +00:00
|
|
|
Ox.Theme(value);
|
|
|
|
pandora.UI.set('theme', value);
|
2013-02-24 07:48:25 +00:00
|
|
|
iframe = Ox.UI.elements[$('#embed').data('oxid')];
|
2013-02-22 04:16:58 +00:00
|
|
|
if (iframe) {
|
2013-02-24 07:48:25 +00:00
|
|
|
src = iframe.attr('src');
|
2013-02-22 04:16:58 +00:00
|
|
|
if (src && Ox.parseURL(src).hostname == document.location.hostname) {
|
2013-02-24 07:48:25 +00:00
|
|
|
iframe.postMessage('settheme', {theme: value});
|
2013-02-22 04:16:58 +00:00
|
|
|
}
|
|
|
|
}
|
2012-03-20 11:51:28 +00:00
|
|
|
} else if (data.id == 'showsiteposters') {
|
|
|
|
pandora.UI.set('showSitePosters', data.checked)
|
2011-11-06 08:28:10 +00:00
|
|
|
} else if (Ox.startsWith(data.id, 'sortfilter')) {
|
|
|
|
var filters = Ox.clone(ui.filters),
|
|
|
|
id = data.id.replace('sortfilter', ''),
|
2012-01-04 08:10:47 +00:00
|
|
|
index = Ox.getIndexById(filters, id),
|
2011-11-06 08:28:10 +00:00
|
|
|
type = Ox.getObjectById(pandora.site.filters, id).type,
|
2011-09-17 23:24:53 +00:00
|
|
|
key = value,
|
2011-09-17 23:50:38 +00:00
|
|
|
operator = key == 'name' && type == 'string' ? '+' : '-';
|
2011-11-06 08:28:10 +00:00
|
|
|
pandora.$ui.mainMenu.checkItem(
|
|
|
|
'sortMenu_orderfilters_orderfilter' + id + '_'
|
|
|
|
+ (operator == '+' ? 'ascending' : 'descending')
|
|
|
|
);
|
2012-01-04 08:10:47 +00:00
|
|
|
pandora.$ui.filters[index].options({
|
2011-09-17 23:24:53 +00:00
|
|
|
sort: [{key: key, operator: operator}]
|
|
|
|
});
|
2012-01-04 08:10:47 +00:00
|
|
|
filters[index].sort[0].key = key;
|
2011-11-06 08:28:10 +00:00
|
|
|
pandora.UI.set({filters: filters});
|
2012-03-18 14:59:00 +00:00
|
|
|
} else if (data.id == 'videoview') {
|
|
|
|
var set = {videoView: value};
|
2011-10-09 13:13:11 +00:00
|
|
|
if (
|
2012-04-17 12:05:23 +00:00
|
|
|
(value == 'timeline' && ['player', 'editor'].indexOf(ui.itemView) > -1)
|
|
|
|
|| (value == 'player' && ['timeline', 'editor'].indexOf(ui.itemView) > -1)
|
|
|
|
|| (value == 'editor' && ['timeline', 'player'].indexOf(ui.itemView) > -1)
|
2011-10-09 13:13:11 +00:00
|
|
|
) {
|
2012-03-18 14:59:00 +00:00
|
|
|
set.itemView = value;
|
2011-10-09 13:13:11 +00:00
|
|
|
}
|
|
|
|
pandora.UI.set(set);
|
2012-03-18 14:59:00 +00:00
|
|
|
} else if (data.id == 'viewicons') {
|
|
|
|
pandora.UI.set({icons: value});
|
2012-05-24 09:56:52 +00:00
|
|
|
} else if (data.id.slice(0, 8) == 'viewlist') {
|
2011-11-03 17:11:10 +00:00
|
|
|
pandora.UI.set({
|
|
|
|
find: {
|
2011-11-07 12:12:13 +00:00
|
|
|
conditions: data.checked ? [
|
2012-05-24 09:56:52 +00:00
|
|
|
{key: 'list', value: data.id.slice(8), operator: '=='}
|
2011-11-03 17:11:10 +00:00
|
|
|
] : [],
|
|
|
|
operator: '&'
|
|
|
|
}
|
|
|
|
});
|
2012-03-06 21:28:27 +00:00
|
|
|
} else if (data.id == 'viewtimelines') {
|
|
|
|
pandora.UI.set({videoTimeline: value});
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
|
|
|
},
|
2011-09-17 17:40:15 +00:00
|
|
|
click: function(data) {
|
2012-06-15 14:43:05 +00:00
|
|
|
if ([
|
|
|
|
'home', 'software', 'signup', 'signin', 'signout',
|
2013-03-06 13:28:44 +00:00
|
|
|
'preferences', 'tv', 'api'
|
2012-06-15 14:43:05 +00:00
|
|
|
].concat(
|
2012-01-20 18:10:25 +00:00
|
|
|
pandora.site.sitePages.map(function(page) {
|
|
|
|
return page.id;
|
2012-06-15 14:43:05 +00:00
|
|
|
})
|
2012-01-30 23:56:41 +00:00
|
|
|
).indexOf(data.id) > -1) {
|
2011-11-09 22:32:54 +00:00
|
|
|
pandora.UI.set({page: data.id});
|
2011-09-29 17:25:04 +00:00
|
|
|
} else if ([
|
|
|
|
'newlist', 'newlistfromselection', 'newsmartlist', 'newsmartlistfromresults'
|
|
|
|
].indexOf(data.id) > -1) {
|
|
|
|
pandora.addList(data.id.indexOf('smart') > -1, data.id.indexOf('from') > -1);
|
|
|
|
} else if (data.id == 'duplicatelist') {
|
|
|
|
pandora.addList(pandora.user.ui._list);
|
|
|
|
} else if (data.id == 'editlist') {
|
|
|
|
pandora.ui.listDialog().open();
|
2013-02-25 10:20:04 +00:00
|
|
|
} else if (data.id == 'add') {
|
|
|
|
pandora.addItem();
|
|
|
|
} else if (data.id == 'upload') {
|
|
|
|
pandora.$ui.uploadDialog = pandora.ui.uploadDialog().open();
|
2011-09-29 17:25:04 +00:00
|
|
|
} else if (data.id == 'deletelist') {
|
|
|
|
pandora.ui.deleteListDialog().open();
|
2013-03-09 03:49:15 +00:00
|
|
|
} else if (data.id == 'print') {
|
2013-03-09 05:27:07 +00:00
|
|
|
window.open(document.location.href + '#?print=true', '_blank');
|
2011-10-13 10:12:00 +00:00
|
|
|
} else if (data.id == 'showsidebar') {
|
|
|
|
pandora.UI.set({showSidebar: !ui.showSidebar});
|
|
|
|
} else if (data.id == 'showinfo') {
|
|
|
|
pandora.UI.set({showInfo: !ui.showInfo});
|
2011-11-06 08:28:10 +00:00
|
|
|
} else if (data.id == 'showfilters') {
|
|
|
|
pandora.UI.set({showFilters: !ui.showFilters});
|
2011-10-13 10:12:00 +00:00
|
|
|
} else if (data.id == 'showbrowser') {
|
|
|
|
pandora.UI.set({showBrowser: !ui.showBrowser});
|
|
|
|
} else if (data.id == 'showannotations') {
|
|
|
|
pandora.UI.set({showAnnotations: !ui.showAnnotations});
|
2011-11-05 22:14:10 +00:00
|
|
|
} else if (data.id == 'showtimeline') {
|
|
|
|
pandora.UI.set({showTimeline: !ui.showTimeline});
|
2012-11-01 15:19:46 +00:00
|
|
|
} else if (data.id == 'togglefullscreen') {
|
2012-11-01 14:21:44 +00:00
|
|
|
Ox.Fullscreen.toggle();
|
|
|
|
} else if (data.id == 'entervideofullscreen') {
|
2012-03-23 12:00:04 +00:00
|
|
|
pandora.$ui.player.options({fullscreen: true});
|
2011-11-11 12:28:20 +00:00
|
|
|
} else if (data.id == 'advancedfind') {
|
2012-06-15 14:43:05 +00:00
|
|
|
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
|
|
|
} else if (data.id == 'findsimilar') {
|
|
|
|
pandora.$ui.sequencesDialog = pandora.ui.sequencesDialog().open();
|
2011-10-11 11:29:05 +00:00
|
|
|
} else if (data.id == 'titles') {
|
2011-11-01 20:04:16 +00:00
|
|
|
(pandora.$ui.titlesDialog || (
|
|
|
|
pandora.$ui.titlesDialog = pandora.ui.titlesDialog()
|
|
|
|
)).open();
|
|
|
|
} else if (data.id == 'names') {
|
|
|
|
(pandora.$ui.namesDialog || (
|
|
|
|
pandora.$ui.namesDialog = pandora.ui.namesDialog()
|
|
|
|
)).open();
|
2011-05-25 19:42:45 +00:00
|
|
|
} else if (data.id == 'places') {
|
2011-11-01 20:04:16 +00:00
|
|
|
(pandora.$ui.placesDialog || (
|
|
|
|
pandora.$ui.placesDialog = pandora.ui.placesDialog()
|
|
|
|
)).open();
|
2011-09-24 23:09:48 +00:00
|
|
|
} else if (data.id == 'events') {
|
2011-11-01 20:04:16 +00:00
|
|
|
(pandora.$ui.eventsDialog || (
|
|
|
|
pandora.$ui.eventsDialog = pandora.ui.eventsDialog()
|
|
|
|
)).open();
|
2011-09-24 23:09:48 +00:00
|
|
|
} else if (data.id == 'users') {
|
2011-11-11 18:55:13 +00:00
|
|
|
pandora.$ui.usersDialog = pandora.ui.usersDialog().open();
|
2012-03-22 20:08:51 +00:00
|
|
|
} else if (data.id == 'statistics') {
|
|
|
|
pandora.$ui.statisticsDialog = pandora.ui.statisticsDialog().open();
|
2011-11-06 08:28:10 +00:00
|
|
|
} else if (data.id == 'resetfilters') {
|
2011-09-18 00:31:41 +00:00
|
|
|
pandora.UI.set({
|
2011-11-06 08:28:10 +00:00
|
|
|
filters: pandora.site.user.ui.filters
|
2011-09-18 00:31:41 +00:00
|
|
|
});
|
|
|
|
pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser());
|
2013-03-06 13:28:44 +00:00
|
|
|
} else if (data.id == 'help') {
|
|
|
|
pandora.UI.set({page: 'help', 'hash.anchor': ui.help});
|
2011-10-26 20:45:12 +00:00
|
|
|
} else if (data.id == 'clearcache') {
|
|
|
|
Ox.Request.clearCache();
|
|
|
|
} else if (data.id == 'reloadapplication') {
|
2012-03-23 11:17:50 +00:00
|
|
|
Ox.Request.clearCache();
|
2011-10-26 20:45:12 +00:00
|
|
|
pandora.$ui.appPanel.reload();
|
2012-06-30 11:56:04 +00:00
|
|
|
} else if (data.id == 'debugmode') {
|
|
|
|
if (pandora.localStorage('enableDebugMode')) {
|
|
|
|
pandora.localStorage['delete']('enableDebugMode');
|
|
|
|
} else {
|
|
|
|
pandora.localStorage('enableDebugMode', true);
|
|
|
|
}
|
2012-06-30 12:13:35 +00:00
|
|
|
window.location.reload();
|
2012-06-30 11:56:04 +00:00
|
|
|
} else if (data.id == 'eventlogging') {
|
|
|
|
if (pandora.localStorage('enableEventLogging')) {
|
|
|
|
pandora.localStorage['delete']('enableEventLogging');
|
2011-10-28 18:05:17 +00:00
|
|
|
} else {
|
2012-06-30 11:56:04 +00:00
|
|
|
pandora.localStorage('enableEventLogging', true);
|
2011-10-28 18:05:17 +00:00
|
|
|
}
|
2012-06-30 12:13:35 +00:00
|
|
|
Ox.Event[pandora.localStorage('enableEventLogging') ? 'bind' : 'unbind'](pandora.logEvent);
|
2012-06-30 11:56:04 +00:00
|
|
|
that.setItemTitle('eventlogging', (pandora.localStorage('enableEventLogging') ? 'Disable' : 'Enable') + ' Event Logging');
|
2012-06-30 12:13:35 +00:00
|
|
|
} else if (data.id == 'errorlogs') {
|
2012-06-30 11:56:04 +00:00
|
|
|
pandora.$ui.logsDialog = pandora.ui.logsDialog().open();
|
2012-05-28 21:53:56 +00:00
|
|
|
} else if (data.id == 'tests') {
|
|
|
|
pandora.tests();
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
2011-09-27 23:30:13 +00:00
|
|
|
},
|
2012-06-07 05:00:47 +00:00
|
|
|
key_alt_control_f: function() {
|
2012-06-15 14:43:05 +00:00
|
|
|
if (!pandora.hasDialogOrScreen() && pandora.getItemIdAndPosition()) {
|
|
|
|
pandora.$ui.sequencesDialog = pandora.ui.sequencesDialog().open();
|
|
|
|
}
|
2012-06-07 05:00:47 +00:00
|
|
|
},
|
2013-01-04 15:07:58 +00:00
|
|
|
key_alt_control_shift_a: function() {
|
|
|
|
if (!pandora.hasDialogOrScreen() && !ui.item) {
|
|
|
|
pandora.$ui.filters.clearFilters();
|
|
|
|
}
|
|
|
|
},
|
2012-11-01 14:21:44 +00:00
|
|
|
key_alt_control_shift_f: function() {
|
|
|
|
Ox.Fullscreen.toggle();
|
|
|
|
},
|
2012-04-24 08:37:10 +00:00
|
|
|
key_backtick: function() {
|
|
|
|
changeFocus(1);
|
|
|
|
},
|
2011-11-03 14:09:30 +00:00
|
|
|
key_control_comma: function() {
|
2011-11-07 19:55:39 +00:00
|
|
|
if (!pandora.hasDialogOrScreen()) {
|
2011-11-10 09:12:09 +00:00
|
|
|
pandora.UI.set({page: 'preferences'});
|
2011-11-03 14:09:30 +00:00
|
|
|
}
|
|
|
|
},
|
2011-11-01 12:03:02 +00:00
|
|
|
key_control_f: function() {
|
2011-11-07 19:55:39 +00:00
|
|
|
if (!pandora.hasDialogOrScreen()) {
|
2011-11-11 12:28:20 +00:00
|
|
|
if (pandora.user.ui._findState.key != 'advanced') {
|
|
|
|
pandora.$ui.findInput.focusInput(true);
|
|
|
|
} else {
|
|
|
|
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2013-03-09 03:49:15 +00:00
|
|
|
key_control_p: function() {
|
2013-03-09 05:27:07 +00:00
|
|
|
window.open(document.location.href + '#?print=true', '_blank');
|
2013-03-09 03:49:15 +00:00
|
|
|
},
|
2011-11-11 12:28:20 +00:00
|
|
|
key_control_shift_f: function() {
|
|
|
|
if (!pandora.hasDialogOrScreen()) {
|
|
|
|
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
2011-11-01 12:03:02 +00:00
|
|
|
}
|
|
|
|
},
|
2011-11-06 21:24:47 +00:00
|
|
|
key_control_shift_w: function() {
|
2011-11-07 19:55:39 +00:00
|
|
|
if (!pandora.hasDialogOrScreen() || (ui.item || ui._list)) {
|
2011-11-06 21:24:47 +00:00
|
|
|
pandora.UI.set({find: {conditions: [], operator: '&'}});
|
|
|
|
}
|
|
|
|
},
|
2011-11-03 14:09:30 +00:00
|
|
|
key_control_slash: function() {
|
2011-11-07 19:55:39 +00:00
|
|
|
if (!pandora.hasDialogOrScreen()) {
|
2013-03-06 13:28:44 +00:00
|
|
|
pandora.UI.set({page: 'help', 'hash.anchor': ui.help});
|
2011-11-03 14:09:30 +00:00
|
|
|
}
|
|
|
|
},
|
2011-12-22 15:48:48 +00:00
|
|
|
key_control_space: function() {
|
|
|
|
if (!pandora.hasDialogOrScreen()) {
|
|
|
|
pandora.UI.set({page: 'tv'});
|
|
|
|
}
|
|
|
|
},
|
2011-11-06 21:20:59 +00:00
|
|
|
key_control_w: function() {
|
2011-11-07 19:55:39 +00:00
|
|
|
if (!pandora.hasDialogOrScreen()) {
|
2011-11-06 21:20:59 +00:00
|
|
|
if (ui.item) {
|
|
|
|
pandora.UI.set({item: ''});
|
|
|
|
} else if (ui._list) {
|
|
|
|
pandora.UI.set({find: {conditions: [], operator: '&'}});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2011-11-01 12:03:02 +00:00
|
|
|
key_shift_a: function() {
|
2012-04-17 12:05:23 +00:00
|
|
|
ui.item && ['timeline', 'player', 'editor'].indexOf(ui.itemView) > -1
|
2011-11-02 06:48:45 +00:00
|
|
|
&& pandora.UI.set({showAnnotations: !ui.showAnnotations});
|
2011-11-01 12:03:02 +00:00
|
|
|
},
|
|
|
|
key_shift_b: function() {
|
2011-11-02 06:48:45 +00:00
|
|
|
ui.item && pandora.UI.set({showBrowser: !ui.showBrowser});
|
2011-11-01 12:03:02 +00:00
|
|
|
},
|
2012-04-24 08:37:10 +00:00
|
|
|
key_shift_backtick: function() {
|
|
|
|
changeFocus(-1);
|
|
|
|
},
|
2011-11-06 08:28:10 +00:00
|
|
|
key_shift_f: function() {
|
|
|
|
!ui.item && pandora.UI.set({showFilters: !ui.showFilters});
|
2011-11-01 12:03:02 +00:00
|
|
|
},
|
|
|
|
key_shift_i: function() {
|
2011-11-02 06:48:45 +00:00
|
|
|
ui.showSidebar && pandora.UI.set({showInfo: !ui.showInfo});
|
2011-11-01 12:03:02 +00:00
|
|
|
},
|
|
|
|
key_shift_s: function() {
|
|
|
|
pandora.UI.set({showSidebar: !ui.showSidebar});
|
|
|
|
},
|
2011-11-05 22:14:10 +00:00
|
|
|
key_shift_t: function() {
|
2012-09-15 11:48:09 +00:00
|
|
|
ui.item && ui.itemView == 'player'
|
2011-11-05 22:14:10 +00:00
|
|
|
&& pandora.UI.set({showTimeline: !ui.showTimeline});
|
|
|
|
},
|
2011-09-29 17:25:04 +00:00
|
|
|
pandora_find: function() {
|
2011-11-07 12:12:13 +00:00
|
|
|
var list = ui._list,
|
|
|
|
listData = pandora.getListData(),
|
|
|
|
previousList = pandora.UI.getPrevious()._list,
|
|
|
|
action = list && listData.user == pandora.user.username
|
|
|
|
? 'enableItem' : 'disableItem';
|
|
|
|
if (list != previousList) {
|
|
|
|
that.uncheckItem(previousList == '' ? 'allitems' : 'viewlist' + previousList);
|
|
|
|
that.checkItem(list == '' ? 'allitems' : 'viewlist' + list);
|
|
|
|
}
|
2011-09-29 17:25:04 +00:00
|
|
|
that[action]('editlist');
|
|
|
|
that[action]('duplicatelist');
|
|
|
|
that[action]('deletelist');
|
2011-10-13 10:12:00 +00:00
|
|
|
that[ui.listSelection.length ? 'enableItem' : 'disableItem']('newlistfromselection');
|
|
|
|
},
|
2011-11-06 08:28:10 +00:00
|
|
|
pandora_filters: function(data) {
|
2011-11-05 18:22:23 +00:00
|
|
|
that.replaceMenu('sortMenu', getSortMenu());
|
|
|
|
},
|
2011-10-13 10:12:00 +00:00
|
|
|
pandora_item: function(data) {
|
|
|
|
if (!!data.value != !!data.previousValue) {
|
2011-11-06 08:28:10 +00:00
|
|
|
that[data.value ? 'disableItem' : 'enableItem']('showfilters');
|
2011-10-13 10:12:00 +00:00
|
|
|
that[data.value ? 'enableItem' : 'disableItem']('showbrowser');
|
2011-10-31 16:45:55 +00:00
|
|
|
that.replaceMenu('sortMenu', getSortMenu());
|
2011-10-13 10:12:00 +00:00
|
|
|
}
|
2011-10-13 10:19:56 +00:00
|
|
|
if (!data.value) {
|
|
|
|
that.disableItem('showannotations');
|
2012-03-23 12:00:04 +00:00
|
|
|
that.disableItem('showtimeline');
|
2012-11-01 14:21:44 +00:00
|
|
|
that.disableItem('entervideofullscreen');
|
2012-03-23 12:00:04 +00:00
|
|
|
} else {
|
2012-04-17 12:05:23 +00:00
|
|
|
if (['timeline', 'player', 'editor'].indexOf(ui.itemView) > -1) {
|
2012-03-23 12:00:04 +00:00
|
|
|
that.enableItem('showannotations');
|
|
|
|
}
|
2012-04-17 07:06:19 +00:00
|
|
|
if (ui.itemView == 'player') {
|
2012-03-23 12:00:04 +00:00
|
|
|
that.enableItem('showtimeline');
|
2012-11-01 14:21:44 +00:00
|
|
|
that.enableItem('entervideofullscreen');
|
2012-03-23 12:00:04 +00:00
|
|
|
}
|
2011-10-13 10:19:56 +00:00
|
|
|
}
|
2011-10-13 10:12:00 +00:00
|
|
|
},
|
2013-02-11 09:00:16 +00:00
|
|
|
pandora_itemsort: function(data) {
|
|
|
|
that.checkItem('sortMenu_sortclips_' + data.value[0].key);
|
|
|
|
that.checkItem('sortMenu_orderclips_' + (
|
|
|
|
data.value[0].operator == '+' ? 'ascending' : 'descending')
|
|
|
|
);
|
|
|
|
},
|
2011-10-13 10:12:00 +00:00
|
|
|
pandora_itemview: function(data) {
|
2012-03-23 12:00:04 +00:00
|
|
|
var action,
|
2013-02-20 06:34:53 +00:00
|
|
|
isVideoView = ['player', 'editor', 'timeline'].indexOf(data.value) > -1,
|
|
|
|
wasVideoView = ['player', 'editor', 'timeline'].indexOf(data.previousValue) > -1;
|
2012-03-18 14:59:00 +00:00
|
|
|
that.checkItem('viewMenu_item_' + data.value);
|
2013-02-11 09:00:16 +00:00
|
|
|
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) {
|
|
|
|
that.replaceMenu('sortMenu', getSortMenu());
|
|
|
|
}
|
2012-03-18 14:59:00 +00:00
|
|
|
if (isVideoView) {
|
|
|
|
that.checkItem('viewMenu_clips_' + data.value);
|
|
|
|
}
|
2011-10-13 10:12:00 +00:00
|
|
|
if (isVideoView != wasVideoView) {
|
|
|
|
that[isVideoView ? 'enableItem' : 'disableItem']('showannotations');
|
|
|
|
}
|
2012-04-17 08:03:11 +00:00
|
|
|
if ((data.value == 'player') != (data.previousValue == 'player')) {
|
2012-04-17 07:06:19 +00:00
|
|
|
action = data.value == 'player' ? 'enableItem' : 'disableItem';
|
2012-03-23 12:00:04 +00:00
|
|
|
that[action]('showtimeline');
|
2012-11-01 14:21:44 +00:00
|
|
|
that[action]('entervideofullscreen');
|
2011-11-05 22:14:10 +00:00
|
|
|
}
|
2012-06-15 14:43:05 +00:00
|
|
|
that[
|
|
|
|
pandora.getItemIdAndPosition() ? 'enableItem' : 'disableItem'
|
|
|
|
]('findsimilar');
|
2011-09-29 17:25:04 +00:00
|
|
|
},
|
|
|
|
pandora_listselection: function(data) {
|
2012-06-15 14:43:05 +00:00
|
|
|
that[
|
|
|
|
data.value.length ? 'enableItem' : 'disableItem'
|
|
|
|
]('newlistfromselection');
|
|
|
|
that[
|
|
|
|
pandora.getItemIdAndPosition() ? 'enableItem' : 'disableItem'
|
|
|
|
]('findsimilar');
|
2011-09-29 17:25:04 +00:00
|
|
|
},
|
2012-03-18 14:59:00 +00:00
|
|
|
pandora_listsort: function(data) {
|
2013-02-11 09:00:16 +00:00
|
|
|
if (pandora.isClipView(pandora.user.ui.listView, false)) {
|
|
|
|
that.checkItem('sortMenu_sortclips_' + data.value[0].key);
|
|
|
|
that.checkItem('sortMenu_orderclips_' + (
|
|
|
|
data.value[0].operator == '+' ? 'ascending' : 'descending')
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
that.checkItem('sortMenu_sortitems_' + data.value[0].key);
|
|
|
|
that.checkItem('sortMenu_orderitems_' + (
|
|
|
|
data.value[0].operator == '+' ? 'ascending' : 'descending')
|
|
|
|
);
|
|
|
|
}
|
2012-03-18 14:59:00 +00:00
|
|
|
},
|
2011-09-29 17:25:04 +00:00
|
|
|
pandora_listview: function(data) {
|
2012-03-18 14:59:00 +00:00
|
|
|
that.checkItem('viewMenu_items_' + data.value);
|
2011-09-27 23:30:13 +00:00
|
|
|
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) {
|
|
|
|
that.replaceMenu('sortMenu', getSortMenu());
|
|
|
|
}
|
2012-06-15 14:43:05 +00:00
|
|
|
that[
|
|
|
|
pandora.getItemIdAndPosition() ? 'enableItem' : 'disableItem'
|
|
|
|
]('findsimilar');
|
2011-10-13 10:12:00 +00:00
|
|
|
},
|
|
|
|
pandora_showannotations: function(data) {
|
|
|
|
that.setItemTitle('showannotations', (data.value ? 'Hide' : 'Show') + ' Annotations');
|
|
|
|
},
|
|
|
|
pandora_showbrowser: function(data) {
|
|
|
|
that.setItemTitle('showbrowser', (data.value ? 'Hide' : 'Show') + ' ' + pandora.site.itemName.singular + ' Browser');
|
|
|
|
},
|
2011-11-06 08:28:10 +00:00
|
|
|
pandora_showfilters: function(data) {
|
|
|
|
that.setItemTitle('showfilters', (data.value ? 'Hide' : 'Show') + ' Filters');
|
2011-10-13 10:12:00 +00:00
|
|
|
},
|
|
|
|
pandora_showinfo: function(data) {
|
|
|
|
that.setItemTitle('showinfo', (data.value ? 'Hide' : 'Show') + ' Info');
|
|
|
|
},
|
|
|
|
pandora_showsidebar: function(data) {
|
|
|
|
that.setItemTitle('showsidebar', (data.value ? 'Hide' : 'Show') + ' Sidebar');
|
2011-11-02 06:48:45 +00:00
|
|
|
that[data.value ? 'enableItem' : 'disableItem']('showinfo');
|
2011-11-05 22:14:10 +00:00
|
|
|
},
|
|
|
|
pandora_showtimeline: function(data) {
|
|
|
|
that.setItemTitle('showtimeline', (data.value ? 'Hide' : 'Show') + ' Timeline');
|
2012-06-15 13:20:35 +00:00
|
|
|
},
|
|
|
|
pandora_videotimeline: function(data) {
|
|
|
|
that.checkItem('viewMenu_timelines_' + data.value);
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
|
|
|
});
|
2011-09-18 01:52:43 +00:00
|
|
|
|
2012-11-01 14:21:44 +00:00
|
|
|
Ox.Fullscreen.bind('change', function(state) {
|
2012-11-01 15:19:46 +00:00
|
|
|
that.setItemTitle('togglefullscreen', (state ? 'Exit' : 'Enter') + ' Fullscreen');
|
2012-11-01 14:21:44 +00:00
|
|
|
});
|
|
|
|
|
2012-04-24 08:37:10 +00:00
|
|
|
function changeFocus(direction) {
|
|
|
|
var elements = [],
|
|
|
|
index,
|
|
|
|
listData = pandora.getListData();
|
|
|
|
elements[0] = !listData.folder ? pandora.$ui.allItems
|
|
|
|
: pandora.$ui.folderList[listData.folder];
|
|
|
|
if (!ui.item && ui.showFilters) {
|
|
|
|
pandora.$ui.filters.forEach(function($filter) {
|
|
|
|
if ($filter.options('selected').length) {
|
|
|
|
elements.push($filter);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (ui.item && ui.showBrowser) {
|
|
|
|
elements.push(pandora.$ui.browser);
|
|
|
|
}
|
|
|
|
if (!ui.item) {
|
|
|
|
if (['map', 'calendar'].indexOf(ui.listView) > -1) {
|
|
|
|
elements.push(pandora.$ui[ui.listView]);
|
|
|
|
if (pandora.$ui.clipList.options('selected').length) {
|
|
|
|
elements.push(pandora.$ui.clipList);
|
|
|
|
}
|
|
|
|
} else if (pandora.$ui.list.options('selected').length) {
|
|
|
|
elements.push(pandora.$ui.list);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (['player', 'editor', 'timeline', 'map', 'calendar'].indexOf(ui.itemView) > -1) {
|
|
|
|
elements.push(pandora.$ui[ui.itemView]);
|
|
|
|
}
|
|
|
|
if (
|
|
|
|
['clips', 'map', 'calendar'].indexOf(ui.itemView) > -1
|
|
|
|
&& pandora.$ui.clipList.options('selected').length
|
|
|
|
) {
|
|
|
|
elements.push(pandora.$ui.clipList);
|
|
|
|
}
|
|
|
|
if (
|
|
|
|
ui.itemView == 'data'
|
|
|
|
&& pandora.$ui.item.options('selected').length
|
|
|
|
) {
|
|
|
|
elements.push(pandora.$ui.item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
index = direction == 1 ? -1 : elements.length;
|
|
|
|
Ox.forEach(elements, function(element, i) {
|
|
|
|
if (element.hasFocus()) {
|
|
|
|
index = i;
|
2012-07-04 11:40:37 +00:00
|
|
|
return false;
|
2012-04-24 08:37:10 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
elements[Ox.mod((index + direction), elements.length)].gainFocus();
|
|
|
|
}
|
|
|
|
|
2011-09-27 14:14:40 +00:00
|
|
|
function getListMenu(lists) {
|
2012-05-24 08:22:56 +00:00
|
|
|
return { id: 'listMenu', title: 'List', items: [].concat(
|
2012-03-20 11:51:28 +00:00
|
|
|
{ id: 'allitems', title: 'All ' + pandora.site.itemName.plural, checked: !ui.item && !ui._list, keyboard: 'shift control w' },
|
2011-09-27 14:14:40 +00:00
|
|
|
['personal', 'favorite', 'featured'].map(function(folder) {
|
|
|
|
return {
|
|
|
|
id: folder + 'lists',
|
|
|
|
title: Ox.toTitleCase(folder) + ' Lists',
|
2011-11-07 12:12:13 +00:00
|
|
|
items: Ox.isUndefined(lists)
|
|
|
|
? [{id: 'loading', title: 'Loading...', disabled: true}]
|
|
|
|
: lists[folder].length == 0
|
|
|
|
? [{id: 'nolists', title: 'No ' + Ox.toTitleCase(folder) + ' Lists', disabled: true}]
|
|
|
|
: lists[folder].map(function(list) {
|
2011-09-27 14:14:40 +00:00
|
|
|
return {
|
|
|
|
id: 'viewlist' + list.id,
|
2012-02-22 10:14:07 +00:00
|
|
|
title: Ox.encodeHTMLEntities((
|
|
|
|
folder == 'favorite' ? list.user + ': ' : ''
|
|
|
|
) + list.name),
|
2011-09-28 00:10:26 +00:00
|
|
|
checked: list.id == pandora.user.ui._list
|
2011-09-27 14:14:40 +00:00
|
|
|
};
|
2011-11-07 12:12:13 +00:00
|
|
|
})
|
2011-09-27 14:14:40 +00:00
|
|
|
};
|
|
|
|
}),
|
|
|
|
[
|
|
|
|
{},
|
2011-10-18 17:21:24 +00:00
|
|
|
{ id: 'newlist', title: 'New List', disabled: isGuest, keyboard: 'control n' },
|
|
|
|
{ id: 'newlistfromselection', title: 'New List from Selection', disabled: isGuest || ui.listSelection.length == 0, keyboard: 'shift control n' },
|
|
|
|
{ id: 'newsmartlist', title: 'New Smart List', disabled: isGuest, keyboard: 'alt control n' },
|
|
|
|
{ id: 'newsmartlistfromresults', title: 'New Smart List from Results', disabled: isGuest, keyboard: 'shift alt control n' },
|
2011-09-27 14:14:40 +00:00
|
|
|
{},
|
2011-10-18 17:21:24 +00:00
|
|
|
{ id: 'duplicatelist', title: 'Duplicate Selected List', disabled: isGuest || !pandora.user.ui._list, keyboard: 'control d' },
|
|
|
|
{ id: 'editlist', title: 'Edit Selected List...', disabled: isGuest || !pandora.user.ui._list, keyboard: 'control e' },
|
|
|
|
{ id: 'deletelist', title: 'Delete Selected List...', disabled: isGuest || !pandora.user.ui._list, keyboard: 'delete' },
|
2011-12-22 15:48:48 +00:00
|
|
|
{},
|
2013-03-09 03:49:15 +00:00
|
|
|
{ id: 'print', title: 'Print', keyboard: 'control p' },
|
2011-12-22 15:48:48 +00:00
|
|
|
{ id: 'tv', title: 'TV', keyboard: 'control space' }
|
2011-09-27 14:14:40 +00:00
|
|
|
]
|
|
|
|
)};
|
|
|
|
};
|
|
|
|
|
|
|
|
function getSortMenu() {
|
|
|
|
var ui = pandora.user.ui,
|
2013-02-11 09:00:16 +00:00
|
|
|
isClipView = pandora.isClipView(),
|
|
|
|
clipItems = (isClipView ? pandora.site.clipKeys.map(function(key) {
|
2012-03-21 09:22:31 +00:00
|
|
|
return Ox.extend(Ox.clone(key), {
|
|
|
|
checked: ui.listSort[0].key == key.id,
|
2013-02-11 09:00:16 +00:00
|
|
|
title: (!ui.item ? 'Clip ' : '') + key.title
|
2012-03-21 09:22:31 +00:00
|
|
|
});
|
2013-02-11 09:00:16 +00:00
|
|
|
}) : []).concat(!ui.item ? pandora.site.sortKeys.map(function(key) {
|
|
|
|
return Ox.extend({
|
|
|
|
checked: ui.listSort[0].key == key.id
|
|
|
|
}, key);
|
|
|
|
}) : []);
|
2011-09-27 14:14:40 +00:00
|
|
|
return { id: 'sortMenu', title: 'Sort', items: [
|
2013-02-11 09:00:16 +00:00
|
|
|
{ id: 'sortitems', title: 'Sort ' + pandora.site.itemName.plural + ' by', disabled: !ui.item && isClipView, items: [
|
|
|
|
{ group: 'itemsort', min: 1, max: 1, items: pandora.site.sortKeys.map(function(key) {
|
|
|
|
return Ox.extend({
|
|
|
|
checked: ui.listSort[0].key == key.id
|
|
|
|
}, key);
|
|
|
|
}) }
|
|
|
|
] },
|
|
|
|
{ id: 'orderitems', title: 'Order ' + pandora.site.itemName.plural, disabled: !ui.item && isClipView, items: [
|
|
|
|
{ group: 'itemorder', min: 1, max: 1, items: [
|
|
|
|
{ id: 'ascending', title: 'Ascending', checked: (ui.listSort[0].operator || pandora.getSortOperator(ui.listSort[0].key)) == '+' },
|
|
|
|
{ id: 'descending', title: 'Descending', checked: (ui.listSort[0].operator || pandora.getSortOperator(ui.listSort[0].key)) == '-' }
|
|
|
|
]}
|
|
|
|
] },
|
|
|
|
{ id: 'sortclips', title: 'Sort Clips by', disabled: !isClipView, items: [
|
|
|
|
{ group: 'clipsort', min: 1, max: 1, items: clipItems }
|
2011-09-27 14:14:40 +00:00
|
|
|
] },
|
2013-02-11 09:00:16 +00:00
|
|
|
{ id: 'orderclips', title: 'Order Clips', disabled: !isClipView, items: [
|
|
|
|
{ group: 'cliporder', min: 1, max: 1, items: [
|
2011-09-27 14:14:40 +00:00
|
|
|
{ id: 'ascending', title: 'Ascending', checked: (ui.listSort[0].operator || pandora.getSortOperator(ui.listSort[0].key)) == '+' },
|
|
|
|
{ id: 'descending', title: 'Descending', checked: (ui.listSort[0].operator || pandora.getSortOperator(ui.listSort[0].key)) == '-' }
|
|
|
|
]}
|
|
|
|
] },
|
2011-11-11 16:11:01 +00:00
|
|
|
{ id: 'advancedsort', title: 'Advanced Sort...', keyboard: 'shift control s', disabled: true },
|
2011-09-27 14:14:40 +00:00
|
|
|
{},
|
2011-11-06 08:28:10 +00:00
|
|
|
{ id: 'sortfilters', title: 'Sort Filters', items: pandora.user.ui.filters.map(function(filter) {
|
2011-09-27 14:14:40 +00:00
|
|
|
return {
|
2011-11-06 08:28:10 +00:00
|
|
|
id: 'sortfilter' + filter.id,
|
|
|
|
title: 'Sort ' + Ox.getObjectById(pandora.site.filters, filter.id).title + ' Filter by',
|
2011-09-27 14:14:40 +00:00
|
|
|
items: [
|
2011-11-06 08:28:10 +00:00
|
|
|
{ group: 'sortfilter' + filter.id, min: 1, max: 1, items: [
|
|
|
|
{ id: 'name', title: 'Name', checked: filter.sort[0].key == 'name' },
|
|
|
|
{ id: 'items', title: 'Items', checked: filter.sort[0].key == 'items' }
|
2011-09-27 14:14:40 +00:00
|
|
|
] }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}) },
|
2011-11-06 08:28:10 +00:00
|
|
|
{ id: 'orderfilters', title: 'Order Filters', items: pandora.user.ui.filters.map(function(filter) {
|
2011-09-27 14:14:40 +00:00
|
|
|
return {
|
2011-11-06 08:28:10 +00:00
|
|
|
id: 'orderfilter' + filter.id,
|
|
|
|
title: 'Order ' + Ox.getObjectById(pandora.site.filters, filter.id).title + ' Filter',
|
2011-09-27 14:14:40 +00:00
|
|
|
items: [
|
2011-11-06 08:28:10 +00:00
|
|
|
{ group: 'orderfilter' + filter.id, min: 1, max: 1, items: [
|
|
|
|
{ id: 'ascending', title: 'Ascending', checked: filter.sort[0].operator == '+' },
|
|
|
|
{ id: 'descending', title: 'Descending', checked: filter.sort[0].operator == '-' }
|
2011-09-27 14:14:40 +00:00
|
|
|
] }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}) }
|
|
|
|
] };
|
|
|
|
}
|
|
|
|
|
2011-11-07 12:12:13 +00:00
|
|
|
// fixme: the sidebar makes (almost) the same requests.
|
2011-09-18 01:52:43 +00:00
|
|
|
// is it ok to make them twice, or should the sidebar trigger the menu replace?
|
|
|
|
|
|
|
|
var counter = 0,
|
|
|
|
lists = {},
|
|
|
|
queries = {
|
|
|
|
// fixme: duplicated
|
|
|
|
personal: {conditions: [
|
2011-09-28 17:32:03 +00:00
|
|
|
{key: 'user', value: pandora.user.username, operator: '=='},
|
|
|
|
{key: 'status', value: 'featured', operator: '!='}
|
2011-09-18 01:52:43 +00:00
|
|
|
], operator: '&'},
|
|
|
|
favorite: {conditions: [
|
|
|
|
{key: 'subscribed', value: true, operator: '='},
|
2011-09-28 17:32:03 +00:00
|
|
|
{key: 'status', value: 'featured', operator: '!='},
|
2011-09-18 01:52:43 +00:00
|
|
|
], operator: '&'},
|
|
|
|
featured: {conditions: [
|
|
|
|
{key: 'status', value: 'featured', operator: '='}
|
|
|
|
], operator: '&'}
|
|
|
|
};
|
|
|
|
|
|
|
|
Ox.forEach(queries, function(query, folder) {
|
|
|
|
pandora.api.findLists({
|
|
|
|
query: query,
|
2011-11-07 12:12:13 +00:00
|
|
|
keys: ['id', 'name', 'user'],
|
|
|
|
sort: [{key: 'position', operator: '+'}]
|
2011-09-18 01:52:43 +00:00
|
|
|
}, function(result) {
|
|
|
|
lists[folder] = result.data.items;
|
|
|
|
if (++counter == 3) {
|
2011-09-27 14:14:40 +00:00
|
|
|
pandora.$ui.mainMenu.replaceMenu('listMenu', getListMenu(lists));
|
2011-09-18 01:52:43 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
return that;
|
2011-09-27 22:12:37 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
};
|