diff --git a/static/js/pandora/editor.js b/static/js/pandora/editor.js index 5cb981fb..d9328bb3 100644 --- a/static/js/pandora/editor.js +++ b/static/js/pandora/editor.js @@ -2,47 +2,238 @@ 'use strict'; -// fixme: this should be deleted!! +pandora.ui.editor = function(data) { -pandora.ui.annotations = function() { - var that = Ox.Element({ - id: 'annotations' - }) - .bindEvent({ - resize: function(data) { - pandora.user.ui.annotationsSize = data.size; - }, - resizeend: function(data) { - pandora.UI.set({annotationsSize: data.size}); - }, - toggle: function(data) { - pandora.UI.set({showAnnotations: !data.collapsed}); - } + 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, + 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], + 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'; + }, + getLargeTimelineImageURL: function(i) { + return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png'; + }, + getSmallTimelineImageURL: function(i) { + return '/' + pandora.user.ui.item + '/timeline16p' + i + '.png'; + }, + 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); }), - $bins = []; - pandora.site.layers.forEach(function(layer) { - var $bin = Ox.CollapsePanel({ - id: layer.id, - size: 16, - title: layer.title - }); - $bins.push($bin); - $bin.$content.append( - $('
').css({ height: '20px' }).append( - $('
').css({ float: 'left', width: '16px', height: '16px', margin: '1px'}).append( - $('').attr({ src: Ox.UI.getImageURL('iconFind') }).css({ width: '16px', height: '16px', border: 0, background: 'rgb(64, 64, 64)', WebkitBorderRadius: '2px' }) - ) - ).append( - $('
').css({ float: 'left', width: '122px', height: '14px', margin: '2px' }).html('Foo') - ).append( - $('
').css({ float: 'left', width: '40px', height: '14px', margin: '2px', textAlign: 'right' }).html('23') - ) - ); + 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, + posterFrameControls: !pandora.site.media.importFrames, + 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, + 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(), + '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}); + }, + 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.substr(0, 10), '%B %e, %Y' + ); + 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); + } + }, + 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: pandora.user.ui.videoPoints[pandora.user.ui.item].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); + }, + 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}); + } }); - $bins.forEach(function(bin) { - that.append(bin); - }); - return that; + }; diff --git a/static/js/pandora/item.js b/static/js/pandora/item.js index 45e71049..e100b599 100644 --- a/static/js/pandora/item.js +++ b/static/js/pandora/item.js @@ -43,7 +43,7 @@ pandora.ui.item = function() { if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) { // fixme: layers have value, subtitles has text? - videoOptions = pandora.getVideoOptions(result.data); + Ox.extend(result.data, pandora.getVideoOptions(result.data)); } if (!result.data.rendered && [ @@ -124,361 +124,27 @@ pandora.ui.item = function() { } else if (pandora.user.ui.itemView == 'video') { - pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = 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: videoOptions.censored, - clickLink: pandora.clickLink, - cuts: result.data.cuts || [], - duration: result.data.duration, - enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= result.data.rightslevel, - enableSubtitles: pandora.user.ui.videoSubtitles, - find: pandora.user.ui.itemFind, - getTimelineImageURL: function(i) { - return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png'; - }, - height: pandora.$ui.contentPanel.size(1), - 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], - layers: videoOptions.layers, - 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, - subtitles: videoOptions.subtitles, - tooltips: true, - timeline: '/' + pandora.user.ui.item + '/timeline16p.png', - video: videoOptions.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}); - }, - downloadvideo: function(data) { - document.location.href = '/' + pandora.user.ui.item + '/torrent/'; - }, - find: function(data) { - pandora.UI.set('itemFind', data.find); - }, - 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); - }, - 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); - }, - 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}); - } - })); + pandora.$ui.contentPanel.replaceElement(1, + pandora.$ui.player = pandora.ui.player(result.data) + ); } else if (pandora.user.ui.itemView == 'timeline') { pandora.$ui.contentPanel.replaceElement(1, - pandora.$ui.editor = 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: videoOptions.censored, - clickLink: pandora.clickLink, - cuts: result.data.cuts || [], - duration: result.data.duration, - enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= result.data.rightslevel, - enableImport: pandora.site.capabilities.canImportAnnotations[pandora.user.level], - 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'; - }, - getLargeTimelineImageURL: function(i) { - return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png'; - }, - getSmallTimelineImageURL: function(i) { - return '/' + pandora.user.ui.item + '/timeline16p' + i + '.png'; - }, - height: pandora.$ui.contentPanel.size(1), - id: 'editor', - 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], - layers: videoOptions.layers.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: result.data.posterFrame, - posterFrameControls: !pandora.site.media.importFrames, - 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: videoOptions.subtitles, - tooltips: true, - video: videoOptions.video, - videoRatio: result.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(), - '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}); - }, - 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.substr(0, 10), - '%B %e, %Y'); - 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); - } - }, - 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: pandora.user.ui.videoPoints[pandora.user.ui.item].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); - }, - 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}); - } - }) + pandora.$ui.editor = pandora.ui.editor(result.data) ); } else if (pandora.user.ui.itemView == 'map') { - pandora.$ui.contentPanel.replaceElement(1, pandora.ui.navigationView('map', result.data.videoRatio)); + pandora.$ui.contentPanel.replaceElement(1, + pandora.ui.navigationView('map', result.data.videoRatio) + ); } else if (pandora.user.ui.itemView == 'calendar') { - pandora.$ui.contentPanel.replaceElement(1, pandora.ui.navigationView('calendar', result.data.videoRatio)); + pandora.$ui.contentPanel.replaceElement(1, + pandora.ui.navigationView('calendar', result.data.videoRatio) + ); } else if (pandora.user.ui.itemView == 'data') { diff --git a/static/js/pandora/player.js b/static/js/pandora/player.js new file mode 100644 index 00000000..2320fd6f --- /dev/null +++ b/static/js/pandora/player.js @@ -0,0 +1,122 @@ +// vim: et:ts=4:sw=4:sts=4:ft=javascript + +'use strict'; + +pandora.ui.player = function(data) { + + 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, + 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, + getTimelineImageURL: function(i) { + return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png'; + }, + 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, + subtitles: data.subtitles, + tooltips: true, + timeline: '/' + pandora.user.ui.item + '/timeline16p.png', + 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}); + }, + downloadvideo: function(data) { + document.location.href = '/' + pandora.user.ui.item + '/torrent/'; + }, + find: function(data) { + pandora.UI.set('itemFind', data.find); + }, + 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); + }, + 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); + }, + 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}); + } + }); + +}; \ No newline at end of file diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index d72a8fdb..4b46893f 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -841,9 +841,9 @@ pandora.getVideoOptions = function(data) { return pandora.getVideoUrl(data.item || pandora.user.ui.item, resolution, i + 1); }); }); - options.layers = []; + options.annotations = []; pandora.site.layers.forEach(function(layer, i) { - options.layers[i] = Ox.extend({}, layer, { + options.annotations[i] = Ox.extend({}, layer, { items: data.layers[layer.id].map(function(annotation) { annotation.date = Ox.formatDate(annotation.modified.substr(0, 10), '%B %e, %Y'); annotation.duration = Math.abs(annotation.out - annotation['in']);