enable timeline types

This commit is contained in:
rolux 2012-06-15 13:20:35 +00:00
parent 494adb5959
commit 1f6abbe32f
4 changed files with 487 additions and 471 deletions

View file

@ -4,15 +4,15 @@
pandora.ui.editor = function(data) { pandora.ui.editor = function(data) {
// fixme: var ui = pandora.user.ui; var ui = pandora.user.ui,
return Ox.VideoEditor({ that = Ox.VideoEditor({
annotationsCalendarSize: pandora.user.ui.annotationsCalendarSize, annotationsCalendarSize: ui.annotationsCalendarSize,
annotationsFont: pandora.user.ui.annotationsFont, annotationsFont: ui.annotationsFont,
annotationsMapSize: pandora.user.ui.annotationsMapSize, annotationsMapSize: ui.annotationsMapSize,
annotationsRange: pandora.user.ui.annotationsRange, annotationsRange: ui.annotationsRange,
annotationsSize: pandora.user.ui.annotationsSize, annotationsSize: ui.annotationsSize,
annotationsSort: pandora.user.ui.annotationsSort, annotationsSort: ui.annotationsSort,
censored: data.censored, censored: data.censored,
censoredIcon: pandora.site.cantPlay.icon, censoredIcon: pandora.site.cantPlay.icon,
censoredTooltip: pandora.site.cantPlay.text, censoredTooltip: pandora.site.cantPlay.text,
@ -22,47 +22,47 @@ pandora.ui.editor = function(data) {
enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= data.rightslevel, enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= data.rightslevel,
enableImport: pandora.site.capabilities.canImportAnnotations[pandora.user.level], enableImport: pandora.site.capabilities.canImportAnnotations[pandora.user.level],
enableSetPosterFrame: !pandora.site.media.importFrames && data.editable, enableSetPosterFrame: !pandora.site.media.importFrames && data.editable,
enableSubtitles: pandora.user.ui.videoSubtitles, enableSubtitles: ui.videoSubtitles,
find: pandora.user.ui.itemFind, find: ui.itemFind,
getFrameURL: function(position) { getFrameURL: function(position) {
return '/' + pandora.user.ui.item + '/' + pandora.user.ui.videoResolution + 'p' + position + '.jpg'; return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg';
}, },
getLargeTimelineURL: function(type, i) { getLargeTimelineURL: function(type, i) {
return '/' + pandora.user.ui.item + '/timeline' + type + '64p' + i + '.jpg'; return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg';
}, },
getSmallTimelineURL: function(type, i) { getSmallTimelineURL: function(type, i) {
return '/' + pandora.user.ui.item + '/timeline' + type + '16p' + i + '.jpg'; return '/' + ui.item + '/timeline' + type + '16p' + i + '.jpg';
}, },
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
id: 'editor', id: 'editor',
'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], 'in': ui.videoPoints[ui.item]['in'],
layers: data.annotations.map(function(layer) { layers: data.annotations.map(function(layer) {
return Ox.extend({ return Ox.extend({
editable: layer.canAddAnnotations[pandora.user.level] editable: layer.canAddAnnotations[pandora.user.level]
}, layer); }, layer);
}), }),
muted: pandora.user.ui.videoMuted, muted: ui.videoMuted,
out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, out: ui.videoPoints[ui.item].out,
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, position: ui.videoPoints[ui.item].position,
posterFrame: data.posterFrame, posterFrame: data.posterFrame,
resolution: pandora.user.ui.videoResolution, resolution: ui.videoResolution,
selected: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation selected: ui.videoPoints[ui.item].annotation
? pandora.user.ui.item + '/' + pandora.user.ui.videoPoints[pandora.user.ui.item].annotation ? ui.item + '/' + ui.videoPoints[ui.item].annotation
: '', : '',
showAnnotations: pandora.user.ui.showAnnotations, showAnnotations: ui.showAnnotations,
showAnnotationsCalendar: pandora.user.ui.showAnnotationsCalendar, showAnnotationsCalendar: ui.showAnnotationsCalendar,
showAnnotationsMap: pandora.user.ui.showAnnotationsMap, showAnnotationsMap: ui.showAnnotationsMap,
showLargeTimeline: true, showLargeTimeline: true,
showLayers: Ox.clone(pandora.user.ui.showLayers), showLayers: Ox.clone(ui.showLayers),
showUsers: pandora.site.annotations.showUsers, showUsers: pandora.site.annotations.showUsers,
subtitles: data.subtitles, subtitles: data.subtitles,
timeline: pandora.user.ui.videoTimeline, timeline: ui.videoTimeline,
timelines: pandora.site.timelines, timelines: pandora.site.timelines,
tooltips: true, tooltips: true,
video: data.video, video: data.video,
videoRatio: data.videoRatio, videoRatio: data.videoRatio,
videoSize: pandora.user.ui.videoSize, videoSize: ui.videoSize,
volume: pandora.user.ui.videoVolume, volume: ui.videoVolume,
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({ }).bindEvent({
addannotation: function(data) { addannotation: function(data) {
@ -73,7 +73,7 @@ pandora.ui.editor = function(data) {
created = Ox.formatDate(d, '%Y-%m-%dT%H:%M:%SZ'), created = Ox.formatDate(d, '%Y-%m-%dT%H:%M:%SZ'),
date = Ox.formatDate(d, '%B %e, %Y'), date = Ox.formatDate(d, '%B %e, %Y'),
type = Ox.getObjectById(pandora.site.layers, data.layer).type; type = Ox.getObjectById(pandora.site.layers, data.layer).type;
pandora.$ui.editor.addAnnotation(data.layer, Ox.extend( that.addAnnotation(data.layer, Ox.extend(
{ {
created: created, created: created,
date: date, date: date,
@ -115,10 +115,10 @@ pandora.ui.editor = function(data) {
pandora.$ui[dialog] = pandora.ui[dialog](data).open(); pandora.$ui[dialog] = pandora.ui[dialog](data).open();
}, },
downloadvideo: function(data) { downloadvideo: function(data) {
document.location.href = '/' + pandora.user.ui.item + '/torrent/'; document.location.href = '/' + ui.item + '/torrent/';
}, },
downloadselection: function(data) { downloadselection: function(data) {
document.location.href = '/' + pandora.user.ui.item document.location.href = '/' + ui.item
+ '/' + Ox.max(pandora.site.video.resolutions) + '/' + Ox.max(pandora.site.video.resolutions)
+ 'p.webm?t=' + data['in'] + ',' + data.out; + 'p.webm?t=' + data['in'] + ',' + data.out;
}, },
@ -129,12 +129,12 @@ pandora.ui.editor = function(data) {
result.data.date = Ox.formatDate( result.data.date = Ox.formatDate(
result.data.modified.slice(0, 10), '%B %e, %Y' result.data.modified.slice(0, 10), '%B %e, %Y'
); );
pandora.$ui.editor.updateAnnotation(data.id, result.data); that.updateAnnotation(data.id, result.data);
}; };
if (data.id[0] == '_') { if (data.id[0] == '_') {
pandora.api.addAnnotation({ pandora.api.addAnnotation({
'in': data['in'], 'in': data['in'],
item: pandora.user.ui.item, item: ui.item,
layer: data.layer, layer: data.layer,
out: data.out, out: data.out,
value: data.value value: data.value
@ -177,8 +177,8 @@ pandora.ui.editor = function(data) {
pandora.UI.set('videoMuted', data.muted); pandora.UI.set('videoMuted', data.muted);
}, },
points: function(data) { points: function(data) {
pandora.UI.set('videoPoints.' + pandora.user.ui.item, { pandora.UI.set('videoPoints.' + ui.item, {
annotation: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation, annotation: ui.videoPoints[ui.item].annotation,
'in': data['in'], 'in': data['in'],
out: data.out, out: data.out,
position: data.position position: data.position
@ -186,29 +186,27 @@ pandora.ui.editor = function(data) {
}, },
position: function(data) { position: function(data) {
pandora.UI.set( pandora.UI.set(
'videoPoints.' + pandora.user.ui.item + '.position', 'videoPoints.' + ui.item + '.position',
data.position data.position
); );
}, },
posterframe: function(data) { posterframe: function(data) {
pandora.api.setPosterFrame({ pandora.api.setPosterFrame({
id: pandora.user.ui.item, id: ui.item,
position: data.position position: data.position
}); });
}, },
removeannotation: function(data) { removeannotation: function(data) {
pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', null); pandora.UI.set('videoPoints.' + ui.item + '.annotation', null);
pandora.api.removeAnnotation({ pandora.api.removeAnnotation({
id: data.id id: data.id
}, function(result) { }, function(result) {
//fixme: check for errors //fixme: check for errors
//pandora.$ui.editor.removeAnnotation(data.layer, data.id); //that.removeAnnotation(data.layer, data.id);
}); });
}, },
resize: function(data) { resize: function(data) {
pandora.$ui.editor.options({ that.options({height: data.size});
height: data.size
});
}, },
resizecalendar: function(data) { resizecalendar: function(data) {
pandora.UI.set('annotationsCalendarSize', data.size); pandora.UI.set('annotationsCalendarSize', data.size);
@ -220,7 +218,7 @@ pandora.ui.editor = function(data) {
pandora.UI.set('videoResolution', data.resolution); pandora.UI.set('videoResolution', data.resolution);
}, },
select: function(data) { select: function(data) {
pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]); pandora.UI.set('videoPoints.' + ui.item + '.annotation', data.id.split('/')[1]);
}, },
subtitles: function(data) { subtitles: function(data) {
pandora.UI.set('videoSubtitles', data.subtitles); pandora.UI.set('videoSubtitles', data.subtitles);
@ -244,10 +242,15 @@ pandora.ui.editor = function(data) {
pandora.UI.set('showLayers.' + data.layer, !data.collapsed); pandora.UI.set('showLayers.' + data.layer, !data.collapsed);
}, },
pandora_showannotations: function(data) { pandora_showannotations: function(data) {
pandora.$ui.editor.options({showAnnotations: data.value}); that.options({showAnnotations: data.value});
},
pandora_videotimeline: function(data) {
that.options({timeline: data.value});
} }
}); });
return that;
}; };

View file

@ -70,7 +70,7 @@ pandora.ui.mainMenu = function() {
) }, ) },
{ id: 'timelines', title: 'Timelines', items: [ { id: 'timelines', title: 'Timelines', items: [
{ group: 'viewtimelines', min: 1, max: 1, items: pandora.site.timelines.map(function(mode) { { 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: [ { id: 'columns', title: 'Columns', items: [
@ -504,6 +504,9 @@ pandora.ui.mainMenu = function() {
}, },
pandora_showtimeline: function(data) { pandora_showtimeline: function(data) {
that.setItemTitle('showtimeline', (data.value ? 'Hide' : 'Show') + ' Timeline'); that.setItemTitle('showtimeline', (data.value ? 'Hide' : 'Show') + ' Timeline');
},
pandora_videotimeline: function(data) {
that.checkItem('viewMenu_timelines_' + data.value);
} }
}); });

View file

@ -4,15 +4,15 @@
pandora.ui.player = function(data) { pandora.ui.player = function(data) {
// fixme: var ui = pandora.user.ui; var ui = pandora.user.ui,
return Ox.VideoPanel({ that = Ox.VideoPanel({
annotationsCalendarSize: pandora.user.ui.annotationsCalendarSize, annotationsCalendarSize: ui.annotationsCalendarSize,
annotationsFont: pandora.user.ui.annotationsFont, annotationsFont: ui.annotationsFont,
annotationsMapSize: pandora.user.ui.annotationsMapSize, annotationsMapSize: ui.annotationsMapSize,
annotationsRange: pandora.user.ui.annotationsRange, annotationsRange: ui.annotationsRange,
annotationsSize: pandora.user.ui.annotationsSize, annotationsSize: ui.annotationsSize,
annotationsSort: pandora.user.ui.annotationsSort, annotationsSort: ui.annotationsSort,
censored: data.censored, censored: data.censored,
censoredIcon: pandora.site.cantPlay.icon, censoredIcon: pandora.site.cantPlay.icon,
censoredTooltip: pandora.site.cantPlay.text, censoredTooltip: pandora.site.cantPlay.text,
@ -20,34 +20,34 @@ pandora.ui.player = function(data) {
cuts: data.cuts || [], cuts: data.cuts || [],
duration: data.duration, duration: data.duration,
enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= data.rightslevel, enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= data.rightslevel,
enableSubtitles: pandora.user.ui.videoSubtitles, enableSubtitles: ui.videoSubtitles,
find: pandora.user.ui.itemFind, find: ui.itemFind,
getLargeTimelineURL: function(type, i) { getLargeTimelineURL: function(type, i) {
return '/' + pandora.user.ui.item + '/timeline' + type + '64p' + i + '.jpg'; return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg';
}, },
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], 'in': ui.videoPoints[ui.item]['in'],
layers: data.annotations, layers: data.annotations,
muted: pandora.user.ui.videoMuted, muted: ui.videoMuted,
out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, out: ui.videoPoints[ui.item].out,
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, position: ui.videoPoints[ui.item].position,
resolution: pandora.user.ui.videoResolution, resolution: ui.videoResolution,
scaleToFill: pandora.user.ui.videoScale == 'fill', scaleToFill: ui.videoScale == 'fill',
selected: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation selected: ui.videoPoints[ui.item].annotation
? pandora.user.ui.item + '/' + pandora.user.ui.videoPoints[pandora.user.ui.item].annotation ? ui.item + '/' + ui.videoPoints[ui.item].annotation
: '', : '',
showAnnotations: pandora.user.ui.showAnnotations, showAnnotations: ui.showAnnotations,
showAnnotationsCalendar: pandora.user.ui.showAnnotationsCalendar, showAnnotationsCalendar: ui.showAnnotationsCalendar,
showAnnotationsMap: pandora.user.ui.showAnnotationsMap, showAnnotationsMap: ui.showAnnotationsMap,
showLayers: Ox.clone(pandora.user.ui.showLayers), showLayers: Ox.clone(ui.showLayers),
showUsers: pandora.site.annotations.showUsers, showUsers: pandora.site.annotations.showUsers,
showTimeline: pandora.user.ui.showTimeline, showTimeline: ui.showTimeline,
smallTimelineURL: '/' + pandora.user.ui.item + '/timeline16p.jpg', smallTimelineURL: '/' + ui.item + '/timeline16p.jpg',
subtitles: data.subtitles, subtitles: data.subtitles,
timeline: pandora.user.ui.videoTimeline, timeline: ui.videoTimeline,
tooltips: true, tooltips: true,
video: data.video, video: data.video,
volume: pandora.user.ui.videoVolume, volume: ui.videoVolume,
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({ }).bindEvent({
annotationsfont: function(data) { annotationsfont: function(data) {
@ -63,13 +63,13 @@ pandora.ui.player = function(data) {
pandora.UI.set({annotationsSort: data.sort}); pandora.UI.set({annotationsSort: data.sort});
}, },
censored: function() { censored: function() {
pandora.$ui.player.options('fullscreen') && pandora.$ui.player.options({ that.options('fullscreen') && that.options({
fullscreen: false fullscreen: false
}); });
pandora.URL.push(pandora.site.cantPlay.link); pandora.URL.push(pandora.site.cantPlay.link);
}, },
downloadvideo: function(data) { downloadvideo: function(data) {
document.location.href = '/' + pandora.user.ui.item + '/torrent/'; document.location.href = '/' + ui.item + '/torrent/';
}, },
find: function(data) { find: function(data) {
pandora.UI.set('itemFind', data.find); pandora.UI.set('itemFind', data.find);
@ -84,7 +84,7 @@ pandora.ui.player = function(data) {
}, },
position: function(data) { position: function(data) {
pandora.UI.set( pandora.UI.set(
'videoPoints.' + pandora.user.ui.item + '.position', 'videoPoints.' + ui.item + '.position',
data.position data.position
); );
}, },
@ -104,7 +104,7 @@ pandora.ui.player = function(data) {
pandora.UI.set('videoScale', data.scale); pandora.UI.set('videoScale', data.scale);
}, },
select: function(data) { select: function(data) {
pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]); pandora.UI.set('videoPoints.' + ui.item + '.annotation', data.id.split('/')[1]);
}, },
subtitles: function(data) { subtitles: function(data) {
pandora.UI.set('videoSubtitles', data.subtitles); pandora.UI.set('videoSubtitles', data.subtitles);
@ -128,11 +128,16 @@ pandora.ui.player = function(data) {
pandora.UI.set('videoVolume', data.volume); pandora.UI.set('videoVolume', data.volume);
}, },
pandora_showannotations: function(data) { pandora_showannotations: function(data) {
pandora.$ui.player.options({showAnnotations: data.value}); that.options({showAnnotations: data.value});
}, },
pandora_showtimeline: function(data) { pandora_showtimeline: function(data) {
pandora.$ui.player.options({showTimeline: data.value}); that.options({showTimeline: data.value});
},
pandora_videotimeline: function(data) {
that.options({timeline: data.value});
} }
}); });
return that;
}; };

View file

@ -4,9 +4,9 @@
pandora.ui.timeline = function(data) { pandora.ui.timeline = function(data) {
var ui = pandora.user.ui; var ui = pandora.user.ui,
return Ox.VideoTimelinePanel({ that = Ox.VideoTimelinePanel({
annotationsCalendarSize: ui.annotationsCalendarSize, annotationsCalendarSize: ui.annotationsCalendarSize,
annotationsFont: ui.annotationsFont, annotationsFont: ui.annotationsFont,
annotationsMapSize: ui.annotationsMapSize, annotationsMapSize: ui.annotationsMapSize,
@ -105,8 +105,13 @@ pandora.ui.timeline = function(data) {
pandora.UI.set('showAnnotationsMap', !data.collapsed); pandora.UI.set('showAnnotationsMap', !data.collapsed);
}, },
pandora_showannotations: function(data) { pandora_showannotations: function(data) {
pandora.$ui.timeline.options({showAnnotations: data.value}); that.options({showAnnotations: data.value});
},
pandora_videotimeline: function(data) {
that.options({timeline: data.value});
} }
}); });
return that;
}; };