diff --git a/static/js/pandora/editor.js b/static/js/pandora/editor.js index 4c146a5ed..674ab357f 100644 --- a/static/js/pandora/editor.js +++ b/static/js/pandora/editor.js @@ -4,249 +4,252 @@ pandora.ui.editor = function(data) { - // fixme: var ui = pandora.user.ui; + var ui = pandora.user.ui, - return Ox.VideoEditor({ - annotationsCalendarSize: pandora.user.ui.annotationsCalendarSize, - annotationsFont: pandora.user.ui.annotationsFont, - annotationsMapSize: pandora.user.ui.annotationsMapSize, - annotationsRange: pandora.user.ui.annotationsRange, - annotationsSize: pandora.user.ui.annotationsSize, - annotationsSort: pandora.user.ui.annotationsSort, - censored: data.censored, - censoredIcon: pandora.site.cantPlay.icon, - censoredTooltip: pandora.site.cantPlay.text, - clickLink: pandora.clickLink, - cuts: data.cuts || [], - duration: data.duration, - enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= data.rightslevel, - enableImport: pandora.site.capabilities.canImportAnnotations[pandora.user.level], - enableSetPosterFrame: !pandora.site.media.importFrames && data.editable, - enableSubtitles: pandora.user.ui.videoSubtitles, - find: pandora.user.ui.itemFind, - getFrameURL: function(position) { - return '/' + pandora.user.ui.item + '/' + pandora.user.ui.videoResolution + 'p' + position + '.jpg'; - }, - getLargeTimelineURL: function(type, i) { - return '/' + pandora.user.ui.item + '/timeline' + type + '64p' + i + '.jpg'; - }, - getSmallTimelineURL: function(type, i) { - return '/' + pandora.user.ui.item + '/timeline' + type + '16p' + i + '.jpg'; - }, - height: pandora.$ui.contentPanel.size(1), - id: 'editor', - 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], - layers: data.annotations.map(function(layer) { - return Ox.extend({ - editable: layer.canAddAnnotations[pandora.user.level] - }, layer); - }), - muted: pandora.user.ui.videoMuted, - out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, - position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, - posterFrame: data.posterFrame, - resolution: pandora.user.ui.videoResolution, - selected: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation - ? pandora.user.ui.item + '/' + pandora.user.ui.videoPoints[pandora.user.ui.item].annotation - : '', - showAnnotations: pandora.user.ui.showAnnotations, - showAnnotationsCalendar: pandora.user.ui.showAnnotationsCalendar, - showAnnotationsMap: pandora.user.ui.showAnnotationsMap, - showLargeTimeline: true, - showLayers: Ox.clone(pandora.user.ui.showLayers), - showUsers: pandora.site.annotations.showUsers, - subtitles: data.subtitles, - timeline: pandora.user.ui.videoTimeline, - timelines: pandora.site.timelines, - tooltips: true, - video: data.video, - videoRatio: data.videoRatio, - videoSize: pandora.user.ui.videoSize, - volume: pandora.user.ui.videoVolume, - width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 - }).bindEvent({ - addannotation: function(data) { - Ox.Log('', 'addAnnotation', data); - // async to not capture keyboard input - setTimeout(function() { - var d = new Date(), - created = Ox.formatDate(d, '%Y-%m-%dT%H:%M:%SZ'), - date = Ox.formatDate(d, '%B %e, %Y'), - type = Ox.getObjectById(pandora.site.layers, data.layer).type; - pandora.$ui.editor.addAnnotation(data.layer, Ox.extend( - { - created: created, - date: date, - duration: data.out - data['in'], - editable: true, - id: '_' + Ox.uid(), + that = Ox.VideoEditor({ + annotationsCalendarSize: ui.annotationsCalendarSize, + annotationsFont: ui.annotationsFont, + annotationsMapSize: ui.annotationsMapSize, + annotationsRange: ui.annotationsRange, + annotationsSize: ui.annotationsSize, + annotationsSort: ui.annotationsSort, + censored: data.censored, + censoredIcon: pandora.site.cantPlay.icon, + censoredTooltip: pandora.site.cantPlay.text, + clickLink: pandora.clickLink, + cuts: data.cuts || [], + duration: data.duration, + enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= data.rightslevel, + enableImport: pandora.site.capabilities.canImportAnnotations[pandora.user.level], + enableSetPosterFrame: !pandora.site.media.importFrames && data.editable, + enableSubtitles: ui.videoSubtitles, + find: ui.itemFind, + getFrameURL: function(position) { + return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg'; + }, + getLargeTimelineURL: function(type, i) { + return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; + }, + getSmallTimelineURL: function(type, i) { + return '/' + ui.item + '/timeline' + type + '16p' + i + '.jpg'; + }, + height: pandora.$ui.contentPanel.size(1), + id: 'editor', + 'in': ui.videoPoints[ui.item]['in'], + layers: data.annotations.map(function(layer) { + return Ox.extend({ + editable: layer.canAddAnnotations[pandora.user.level] + }, layer); + }), + muted: ui.videoMuted, + out: ui.videoPoints[ui.item].out, + position: ui.videoPoints[ui.item].position, + posterFrame: data.posterFrame, + resolution: ui.videoResolution, + selected: ui.videoPoints[ui.item].annotation + ? ui.item + '/' + ui.videoPoints[ui.item].annotation + : '', + showAnnotations: ui.showAnnotations, + showAnnotationsCalendar: ui.showAnnotationsCalendar, + showAnnotationsMap: ui.showAnnotationsMap, + showLargeTimeline: true, + showLayers: Ox.clone(ui.showLayers), + showUsers: pandora.site.annotations.showUsers, + subtitles: data.subtitles, + timeline: ui.videoTimeline, + timelines: pandora.site.timelines, + tooltips: true, + video: data.video, + videoRatio: data.videoRatio, + videoSize: ui.videoSize, + volume: ui.videoVolume, + width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 + }).bindEvent({ + addannotation: function(data) { + Ox.Log('', 'addAnnotation', data); + // async to not capture keyboard input + setTimeout(function() { + var d = new Date(), + created = Ox.formatDate(d, '%Y-%m-%dT%H:%M:%SZ'), + date = Ox.formatDate(d, '%B %e, %Y'), + type = Ox.getObjectById(pandora.site.layers, data.layer).type; + that.addAnnotation(data.layer, Ox.extend( + { + created: created, + date: date, + duration: data.out - data['in'], + editable: true, + id: '_' + Ox.uid(), + 'in': data['in'], + modified: created, + out: data.out, + user: pandora.user.username, + value: '' + }, + type == 'place' ? { + place: {lat: null, lng: null} + } : type == 'event' ? { + event: {start: '', end: ''} + } : {} + )); + }); + }, + annotationsfont: function(data) { + pandora.UI.set({annotationsFont: data.font}); + }, + annotationsrange: function(data) { + pandora.UI.set({annotationsRange: data.range}); + }, + annotationssize: function(data) { + pandora.UI.set({annotationsSize: data.size}); + }, + annotationssort: function(data) { + pandora.UI.set({annotationsSort: data.sort}); + }, + censored: function() { + pandora.URL.push(pandora.site.cantPlay.link); + }, + define: function(data) { + var dialog = data.type + 'sDialog'; + pandora.$ui[dialog] && pandora.$ui[dialog].remove(); + pandora.$ui[dialog] = pandora.ui[dialog](data).open(); + }, + downloadvideo: function(data) { + document.location.href = '/' + ui.item + '/torrent/'; + }, + downloadselection: function(data) { + document.location.href = '/' + ui.item + + '/' + Ox.max(pandora.site.video.resolutions) + + 'p.webm?t=' + data['in'] + ',' + data.out; + }, + editannotation: function(data) { + Ox.Log('', 'editAnnotation', data); + function callback(result) { + Ox.Log('', 'editAnnotation result', result); + result.data.date = Ox.formatDate( + result.data.modified.slice(0, 10), '%B %e, %Y' + ); + that.updateAnnotation(data.id, result.data); + }; + if (data.id[0] == '_') { + pandora.api.addAnnotation({ 'in': data['in'], - modified: created, + item: ui.item, + layer: data.layer, out: data.out, - user: pandora.user.username, - value: '' + value: data.value + }, callback); + } else { + pandora.api.editAnnotation({ + id: data.id, + 'in': data['in'], + out: data.out, + value: data.value + }, callback); + } + }, + embedselection: function(data) { + pandora.$ui.embedDialog && pandora.$ui.embedDialog.remove(); + pandora.$ui.embedDialog = pandora.ui.embedDialog(data).open(); + }, + find: function(data) { + pandora.UI.set('itemFind', data.find); + }, + findannotations: function(data) { + pandora.UI.set({ + item: '', + find: { + conditions: [{key: data.key, value: data.value, operator: '='}], + operator: '&' }, - type == 'place' ? { - place: {lat: null, lng: null} - } : type == 'event' ? { - event: {start: '', end: ''} - } : {} - )); - }); - }, - annotationsfont: function(data) { - pandora.UI.set({annotationsFont: data.font}); - }, - annotationsrange: function(data) { - pandora.UI.set({annotationsRange: data.range}); - }, - annotationssize: function(data) { - pandora.UI.set({annotationsSize: data.size}); - }, - annotationssort: function(data) { - pandora.UI.set({annotationsSort: data.sort}); - }, - censored: function() { - pandora.URL.push(pandora.site.cantPlay.link); - }, - define: function(data) { - var dialog = data.type + 'sDialog'; - pandora.$ui[dialog] && pandora.$ui[dialog].remove(); - pandora.$ui[dialog] = pandora.ui[dialog](data).open(); - }, - downloadvideo: function(data) { - document.location.href = '/' + pandora.user.ui.item + '/torrent/'; - }, - downloadselection: function(data) { - document.location.href = '/' + pandora.user.ui.item - + '/' + Ox.max(pandora.site.video.resolutions) - + 'p.webm?t=' + data['in'] + ',' + data.out; - }, - editannotation: function(data) { - Ox.Log('', 'editAnnotation', data); - function callback(result) { - Ox.Log('', 'editAnnotation result', result); - result.data.date = Ox.formatDate( - result.data.modified.slice(0, 10), '%B %e, %Y' + listView: 'clip' + }); + }, + importannotations: function(data) { + pandora.ui.importAnnotations().open(); + }, + info: function(data) { + pandora.ui.annotationDialog( + Ox.getObjectById(pandora.site.layers, data.layer).title + ).open(); + }, + muted: function(data) { + pandora.UI.set('videoMuted', data.muted); + }, + points: function(data) { + pandora.UI.set('videoPoints.' + ui.item, { + annotation: ui.videoPoints[ui.item].annotation, + 'in': data['in'], + out: data.out, + position: data.position + }); + }, + position: function(data) { + pandora.UI.set( + 'videoPoints.' + ui.item + '.position', + data.position ); - pandora.$ui.editor.updateAnnotation(data.id, result.data); - }; - if (data.id[0] == '_') { - pandora.api.addAnnotation({ - 'in': data['in'], - item: pandora.user.ui.item, - layer: data.layer, - out: data.out, - value: data.value - }, callback); - } else { - pandora.api.editAnnotation({ - id: data.id, - 'in': data['in'], - out: data.out, - value: data.value - }, callback); + }, + posterframe: function(data) { + pandora.api.setPosterFrame({ + id: ui.item, + position: data.position + }); + }, + removeannotation: function(data) { + pandora.UI.set('videoPoints.' + ui.item + '.annotation', null); + pandora.api.removeAnnotation({ + id: data.id + }, function(result) { + //fixme: check for errors + //that.removeAnnotation(data.layer, data.id); + }); + }, + resize: function(data) { + that.options({height: data.size}); + }, + resizecalendar: function(data) { + pandora.UI.set('annotationsCalendarSize', data.size); + }, + resizemap: function(data) { + pandora.UI.set('annotationsMapSize', data.size); + }, + resolution: function(data) { + pandora.UI.set('videoResolution', data.resolution); + }, + select: function(data) { + pandora.UI.set('videoPoints.' + ui.item + '.annotation', data.id.split('/')[1]); + }, + subtitles: function(data) { + pandora.UI.set('videoSubtitles', data.subtitles); + }, + timeline: function(data) { + pandora.UI.set('videoTimeline', data.timeline); + }, + togglecalendar: function(data) { + pandora.UI.set('showAnnotationsCalendar', !data.collapsed); + }, + togglemap: function(data) { + pandora.UI.set('showAnnotationsMap', !data.collapsed); + }, + togglesize: function(data) { + pandora.UI.set({videoSize: data.size}); + }, + toggleannotations: function(data) { + pandora.UI.set('showAnnotations', data.showAnnotations); + }, + togglelayer: function(data) { + pandora.UI.set('showLayers.' + data.layer, !data.collapsed); + }, + pandora_showannotations: function(data) { + that.options({showAnnotations: data.value}); + }, + pandora_videotimeline: function(data) { + that.options({timeline: data.value}); } - }, - embedselection: function(data) { - pandora.$ui.embedDialog && pandora.$ui.embedDialog.remove(); - pandora.$ui.embedDialog = pandora.ui.embedDialog(data).open(); - }, - find: function(data) { - pandora.UI.set('itemFind', data.find); - }, - findannotations: function(data) { - pandora.UI.set({ - item: '', - find: { - conditions: [{key: data.key, value: data.value, operator: '='}], - operator: '&' - }, - listView: 'clip' - }); - }, - importannotations: function(data) { - pandora.ui.importAnnotations().open(); - }, - info: function(data) { - pandora.ui.annotationDialog( - Ox.getObjectById(pandora.site.layers, data.layer).title - ).open(); - }, - muted: function(data) { - pandora.UI.set('videoMuted', data.muted); - }, - points: function(data) { - pandora.UI.set('videoPoints.' + pandora.user.ui.item, { - annotation: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation, - 'in': data['in'], - out: data.out, - position: data.position - }); - }, - position: function(data) { - pandora.UI.set( - 'videoPoints.' + pandora.user.ui.item + '.position', - data.position - ); - }, - posterframe: function(data) { - pandora.api.setPosterFrame({ - id: pandora.user.ui.item, - position: data.position - }); - }, - removeannotation: function(data) { - pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', null); - pandora.api.removeAnnotation({ - id: data.id - }, function(result) { - //fixme: check for errors - //pandora.$ui.editor.removeAnnotation(data.layer, data.id); - }); - }, - resize: function(data) { - pandora.$ui.editor.options({ - height: data.size - }); - }, - resizecalendar: function(data) { - pandora.UI.set('annotationsCalendarSize', data.size); - }, - resizemap: function(data) { - pandora.UI.set('annotationsMapSize', data.size); - }, - resolution: function(data) { - pandora.UI.set('videoResolution', data.resolution); - }, - select: function(data) { - pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]); - }, - subtitles: function(data) { - pandora.UI.set('videoSubtitles', data.subtitles); - }, - timeline: function(data) { - pandora.UI.set('videoTimeline', data.timeline); - }, - togglecalendar: function(data) { - pandora.UI.set('showAnnotationsCalendar', !data.collapsed); - }, - togglemap: function(data) { - pandora.UI.set('showAnnotationsMap', !data.collapsed); - }, - togglesize: function(data) { - pandora.UI.set({videoSize: data.size}); - }, - toggleannotations: function(data) { - pandora.UI.set('showAnnotations', data.showAnnotations); - }, - togglelayer: function(data) { - pandora.UI.set('showLayers.' + data.layer, !data.collapsed); - }, - pandora_showannotations: function(data) { - pandora.$ui.editor.options({showAnnotations: data.value}); - } - }); + }); + + return that; }; diff --git a/static/js/pandora/menu.js b/static/js/pandora/menu.js index 8406cc953..2e65f6e23 100644 --- a/static/js/pandora/menu.js +++ b/static/js/pandora/menu.js @@ -70,7 +70,7 @@ pandora.ui.mainMenu = function() { ) }, { id: 'timelines', title: 'Timelines', items: [ { group: 'viewtimelines', min: 1, max: 1, items: pandora.site.timelines.map(function(mode) { - return {id: mode.id, title: mode.title, checked: ui.videoTimeline == mode.id, disabled: true}; + return {id: mode.id, title: mode.title, checked: ui.videoTimeline == mode.id}; }) } ]}, { id: 'columns', title: 'Columns', items: [ @@ -504,6 +504,9 @@ pandora.ui.mainMenu = function() { }, pandora_showtimeline: function(data) { that.setItemTitle('showtimeline', (data.value ? 'Hide' : 'Show') + ' Timeline'); + }, + pandora_videotimeline: function(data) { + that.checkItem('viewMenu_timelines_' + data.value); } }); diff --git a/static/js/pandora/player.js b/static/js/pandora/player.js index 90155c15d..d5d795faa 100644 --- a/static/js/pandora/player.js +++ b/static/js/pandora/player.js @@ -4,135 +4,140 @@ pandora.ui.player = function(data) { - // fixme: var ui = pandora.user.ui; + var ui = pandora.user.ui, - return Ox.VideoPanel({ - annotationsCalendarSize: pandora.user.ui.annotationsCalendarSize, - annotationsFont: pandora.user.ui.annotationsFont, - annotationsMapSize: pandora.user.ui.annotationsMapSize, - annotationsRange: pandora.user.ui.annotationsRange, - annotationsSize: pandora.user.ui.annotationsSize, - annotationsSort: pandora.user.ui.annotationsSort, - censored: data.censored, - censoredIcon: pandora.site.cantPlay.icon, - censoredTooltip: pandora.site.cantPlay.text, - clickLink: pandora.clickLink, - cuts: data.cuts || [], - duration: data.duration, - enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= data.rightslevel, - enableSubtitles: pandora.user.ui.videoSubtitles, - find: pandora.user.ui.itemFind, - getLargeTimelineURL: function(type, i) { - return '/' + pandora.user.ui.item + '/timeline' + type + '64p' + i + '.jpg'; - }, - height: pandora.$ui.contentPanel.size(1), - 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], - layers: data.annotations, - muted: pandora.user.ui.videoMuted, - out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, - position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, - resolution: pandora.user.ui.videoResolution, - scaleToFill: pandora.user.ui.videoScale == 'fill', - selected: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation - ? pandora.user.ui.item + '/' + pandora.user.ui.videoPoints[pandora.user.ui.item].annotation - : '', - showAnnotations: pandora.user.ui.showAnnotations, - showAnnotationsCalendar: pandora.user.ui.showAnnotationsCalendar, - showAnnotationsMap: pandora.user.ui.showAnnotationsMap, - showLayers: Ox.clone(pandora.user.ui.showLayers), - showUsers: pandora.site.annotations.showUsers, - showTimeline: pandora.user.ui.showTimeline, - smallTimelineURL: '/' + pandora.user.ui.item + '/timeline16p.jpg', - subtitles: data.subtitles, - timeline: pandora.user.ui.videoTimeline, - tooltips: true, - video: data.video, - volume: pandora.user.ui.videoVolume, - width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 - }).bindEvent({ - annotationsfont: function(data) { - pandora.UI.set({annotationsFont: data.font}); - }, - annotationsrange: function(data) { - pandora.UI.set({annotationsRange: data.range}); - }, - annotationssize: function(data) { - pandora.UI.set({annotationsSize: data.size}); - }, - annotationssort: function(data) { - pandora.UI.set({annotationsSort: data.sort}); - }, - censored: function() { - pandora.$ui.player.options('fullscreen') && pandora.$ui.player.options({ - fullscreen: false - }); - pandora.URL.push(pandora.site.cantPlay.link); - }, - downloadvideo: function(data) { - document.location.href = '/' + pandora.user.ui.item + '/torrent/'; - }, - find: function(data) { - pandora.UI.set('itemFind', data.find); - }, - info: function(data) { - pandora.ui.annotationDialog( - Ox.getObjectById(pandora.site.layers, data.layer).title - ).open(); - }, - muted: function(data) { - pandora.UI.set('videoMuted', data.muted); - }, - position: function(data) { - pandora.UI.set( - 'videoPoints.' + pandora.user.ui.item + '.position', - data.position - ); - }, - resizeannotations: function(data) { - pandora.UI.set('annotationsSize', data.annotationsSize); - }, - resizecalendar: function(data) { - pandora.UI.set('annotationsCalendarSize', data.size); - }, - resizemap: function(data) { - pandora.UI.set('annotationsMapSize', data.size); - }, - resolution: function(data) { - pandora.UI.set('videoResolution', data.resolution); - }, - scale: function(data) { - pandora.UI.set('videoScale', data.scale); - }, - select: function(data) { - pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]); - }, - subtitles: function(data) { - pandora.UI.set('videoSubtitles', data.subtitles); - }, - toggleannotations: function(data) { - pandora.UI.set('showAnnotations', data.showAnnotations); - }, - togglelayer: function(data) { - pandora.UI.set('showLayers.' + data.layer, !data.collapsed); - }, - togglemap: function(data) { - pandora.UI.set('showAnnotationsMap', !data.collapsed); - }, - togglesize: function(data) { - pandora.UI.set({videoSize: data.size}); - }, - toggletimeline: function(data) { - pandora.UI.set('showTimeline', data.showTimeline); - }, - volume: function(data) { - pandora.UI.set('videoVolume', data.volume); - }, - pandora_showannotations: function(data) { - pandora.$ui.player.options({showAnnotations: data.value}); - }, - pandora_showtimeline: function(data) { - pandora.$ui.player.options({showTimeline: data.value}); - } - }); + that = Ox.VideoPanel({ + annotationsCalendarSize: ui.annotationsCalendarSize, + annotationsFont: ui.annotationsFont, + annotationsMapSize: ui.annotationsMapSize, + annotationsRange: ui.annotationsRange, + annotationsSize: ui.annotationsSize, + annotationsSort: ui.annotationsSort, + censored: data.censored, + censoredIcon: pandora.site.cantPlay.icon, + censoredTooltip: pandora.site.cantPlay.text, + clickLink: pandora.clickLink, + cuts: data.cuts || [], + duration: data.duration, + enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= data.rightslevel, + enableSubtitles: ui.videoSubtitles, + find: ui.itemFind, + getLargeTimelineURL: function(type, i) { + return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; + }, + height: pandora.$ui.contentPanel.size(1), + 'in': ui.videoPoints[ui.item]['in'], + layers: data.annotations, + muted: ui.videoMuted, + out: ui.videoPoints[ui.item].out, + position: ui.videoPoints[ui.item].position, + resolution: ui.videoResolution, + scaleToFill: ui.videoScale == 'fill', + selected: ui.videoPoints[ui.item].annotation + ? ui.item + '/' + ui.videoPoints[ui.item].annotation + : '', + showAnnotations: ui.showAnnotations, + showAnnotationsCalendar: ui.showAnnotationsCalendar, + showAnnotationsMap: ui.showAnnotationsMap, + showLayers: Ox.clone(ui.showLayers), + showUsers: pandora.site.annotations.showUsers, + showTimeline: ui.showTimeline, + smallTimelineURL: '/' + ui.item + '/timeline16p.jpg', + subtitles: data.subtitles, + timeline: ui.videoTimeline, + tooltips: true, + video: data.video, + volume: ui.videoVolume, + width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 + }).bindEvent({ + annotationsfont: function(data) { + pandora.UI.set({annotationsFont: data.font}); + }, + annotationsrange: function(data) { + pandora.UI.set({annotationsRange: data.range}); + }, + annotationssize: function(data) { + pandora.UI.set({annotationsSize: data.size}); + }, + annotationssort: function(data) { + pandora.UI.set({annotationsSort: data.sort}); + }, + censored: function() { + that.options('fullscreen') && that.options({ + fullscreen: false + }); + pandora.URL.push(pandora.site.cantPlay.link); + }, + downloadvideo: function(data) { + document.location.href = '/' + ui.item + '/torrent/'; + }, + find: function(data) { + pandora.UI.set('itemFind', data.find); + }, + info: function(data) { + pandora.ui.annotationDialog( + Ox.getObjectById(pandora.site.layers, data.layer).title + ).open(); + }, + muted: function(data) { + pandora.UI.set('videoMuted', data.muted); + }, + position: function(data) { + pandora.UI.set( + 'videoPoints.' + ui.item + '.position', + data.position + ); + }, + resizeannotations: function(data) { + pandora.UI.set('annotationsSize', data.annotationsSize); + }, + resizecalendar: function(data) { + pandora.UI.set('annotationsCalendarSize', data.size); + }, + resizemap: function(data) { + pandora.UI.set('annotationsMapSize', data.size); + }, + resolution: function(data) { + pandora.UI.set('videoResolution', data.resolution); + }, + scale: function(data) { + pandora.UI.set('videoScale', data.scale); + }, + select: function(data) { + pandora.UI.set('videoPoints.' + ui.item + '.annotation', data.id.split('/')[1]); + }, + subtitles: function(data) { + pandora.UI.set('videoSubtitles', data.subtitles); + }, + toggleannotations: function(data) { + pandora.UI.set('showAnnotations', data.showAnnotations); + }, + togglelayer: function(data) { + pandora.UI.set('showLayers.' + data.layer, !data.collapsed); + }, + togglemap: function(data) { + pandora.UI.set('showAnnotationsMap', !data.collapsed); + }, + togglesize: function(data) { + pandora.UI.set({videoSize: data.size}); + }, + toggletimeline: function(data) { + pandora.UI.set('showTimeline', data.showTimeline); + }, + volume: function(data) { + pandora.UI.set('videoVolume', data.volume); + }, + pandora_showannotations: function(data) { + that.options({showAnnotations: data.value}); + }, + pandora_showtimeline: function(data) { + that.options({showTimeline: data.value}); + }, + pandora_videotimeline: function(data) { + that.options({timeline: data.value}); + } + }); + + return that; }; diff --git a/static/js/pandora/timeline.js b/static/js/pandora/timeline.js index 4b773a986..51a033725 100644 --- a/static/js/pandora/timeline.js +++ b/static/js/pandora/timeline.js @@ -4,109 +4,114 @@ pandora.ui.timeline = function(data) { - var ui = pandora.user.ui; + var ui = pandora.user.ui, + + that = Ox.VideoTimelinePanel({ + annotationsCalendarSize: ui.annotationsCalendarSize, + annotationsFont: ui.annotationsFont, + annotationsMapSize: ui.annotationsMapSize, + annotationsRange: ui.annotationsRange, + annotationsSize: ui.annotationsSize, + annotationsSort: ui.annotationsSort, + censored: data.censored, + censoredIcon: pandora.site.cantPlay.icon, + censoredTooltip: pandora.site.cantPlay.text, + clickLink: pandora.clickLink, + cuts: data.cuts || [], + duration: data.duration, + followPlayer: ui.followPlayer, + getFrameURL: function(position) { + return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg'; + }, + getLargeTimelineURL: function(type, i) { + return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; + }, + height: pandora.$ui.contentPanel.size(1), + layers: data.annotations, + muted: ui.videoMuted, + position: ui.videoPoints[ui.item].position, + resolution: pandora.site.video.resolutions[0], + selected: ui.videoPoints[ui.item].annotation + ? ui.item + '/' + ui.videoPoints[ui.item].annotation + : '', + showAnnotations: ui.showAnnotations, + showAnnotationsCalendar: ui.showAnnotationsCalendar, + showAnnotationsMap: ui.showAnnotationsMap, + showLayers: Ox.clone(ui.showLayers), + showUsers: pandora.site.annotations.showUsers, + smallTimelineURL: '/' + ui.item + '/timeline16p.jpg', + timeline: ui.videoTimeline, + timelines: pandora.site.timelines, + video: data.video, + videoRatio: data.videoRatio, + volume: ui.videoVolume, + width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 + }) + .bindEvent({ + annotationsfont: function(data) { + pandora.UI.set({annotationsFont: data.font}); + }, + annotationsrange: function(data) { + pandora.UI.set({annotationsRange: data.range}); + }, + annotationssize: function(data) { + pandora.UI.set({annotationsSize: data.size}); + }, + annotationssort: function(data) { + pandora.UI.set({annotationsSort: data.sort}); + }, + censored: function() { + pandora.URL.push(pandora.site.cantPlay.link); + }, + follow: function(data) { + pandora.UI.set('followPlayer', data.follow); + }, + info: function(data) { + pandora.ui.annotationDialog( + Ox.getObjectById(pandora.site.layers, data.layer).title + ).open(); + }, + muted: function(data) { + pandora.UI.set('videoMuted', data.muted); + }, + position: function(data) { + pandora.UI.set( + 'videoPoints.' + pandora.user.ui.item + '.position', + data.position + ); + }, + resizeannotations: function(data) { + pandora.UI.set('annotationsSize', data.annotationsSize); + }, + resizecalendar: function(data) { + pandora.UI.set('annotationsCalendarSize', data.size); + }, + resizemap: function(data) { + pandora.UI.set('annotationsMapSize', data.size); + }, + select: function(data) { + pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]); + }, + timeline: function(data) { + pandora.UI.set('videoTimeline', data.timeline); + }, + toggleannotations: function(data) { + pandora.UI.set('showAnnotations', data.showAnnotations); + }, + togglelayer: function(data) { + pandora.UI.set('showLayers.' + data.layer, !data.collapsed); + }, + togglemap: function(data) { + pandora.UI.set('showAnnotationsMap', !data.collapsed); + }, + pandora_showannotations: function(data) { + that.options({showAnnotations: data.value}); + }, + pandora_videotimeline: function(data) { + that.options({timeline: data.value}); + } + }); + + return that; - return Ox.VideoTimelinePanel({ - annotationsCalendarSize: ui.annotationsCalendarSize, - annotationsFont: ui.annotationsFont, - annotationsMapSize: ui.annotationsMapSize, - annotationsRange: ui.annotationsRange, - annotationsSize: ui.annotationsSize, - annotationsSort: ui.annotationsSort, - censored: data.censored, - censoredIcon: pandora.site.cantPlay.icon, - censoredTooltip: pandora.site.cantPlay.text, - clickLink: pandora.clickLink, - cuts: data.cuts || [], - duration: data.duration, - followPlayer: ui.followPlayer, - getFrameURL: function(position) { - return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg'; - }, - getLargeTimelineURL: function(type, i) { - return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; - }, - height: pandora.$ui.contentPanel.size(1), - layers: data.annotations, - muted: ui.videoMuted, - position: ui.videoPoints[ui.item].position, - resolution: pandora.site.video.resolutions[0], - selected: ui.videoPoints[ui.item].annotation - ? ui.item + '/' + ui.videoPoints[ui.item].annotation - : '', - showAnnotations: ui.showAnnotations, - showAnnotationsCalendar: ui.showAnnotationsCalendar, - showAnnotationsMap: ui.showAnnotationsMap, - showLayers: Ox.clone(ui.showLayers), - showUsers: pandora.site.annotations.showUsers, - smallTimelineURL: '/' + ui.item + '/timeline16p.jpg', - timeline: ui.videoTimeline, - timelines: pandora.site.timelines, - video: data.video, - videoRatio: data.videoRatio, - volume: ui.videoVolume, - width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 - }) - .bindEvent({ - annotationsfont: function(data) { - pandora.UI.set({annotationsFont: data.font}); - }, - annotationsrange: function(data) { - pandora.UI.set({annotationsRange: data.range}); - }, - annotationssize: function(data) { - pandora.UI.set({annotationsSize: data.size}); - }, - annotationssort: function(data) { - pandora.UI.set({annotationsSort: data.sort}); - }, - censored: function() { - pandora.URL.push(pandora.site.cantPlay.link); - }, - follow: function(data) { - pandora.UI.set('followPlayer', data.follow); - }, - info: function(data) { - pandora.ui.annotationDialog( - Ox.getObjectById(pandora.site.layers, data.layer).title - ).open(); - }, - muted: function(data) { - pandora.UI.set('videoMuted', data.muted); - }, - position: function(data) { - pandora.UI.set( - 'videoPoints.' + pandora.user.ui.item + '.position', - data.position - ); - }, - resizeannotations: function(data) { - pandora.UI.set('annotationsSize', data.annotationsSize); - }, - resizecalendar: function(data) { - pandora.UI.set('annotationsCalendarSize', data.size); - }, - resizemap: function(data) { - pandora.UI.set('annotationsMapSize', data.size); - }, - select: function(data) { - pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]); - }, - timeline: function(data) { - pandora.UI.set('videoTimeline', data.timeline); - }, - toggleannotations: function(data) { - pandora.UI.set('showAnnotations', data.showAnnotations); - }, - togglelayer: function(data) { - pandora.UI.set('showLayers.' + data.layer, !data.collapsed); - }, - togglemap: function(data) { - pandora.UI.set('showAnnotationsMap', !data.collapsed); - }, - pandora_showannotations: function(data) { - pandora.$ui.timeline.options({showAnnotations: data.value}); - } - }); - };