From a23287f152870f7182cad1d343265b95cf71193f Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 17 Apr 2012 12:04:01 +0000 Subject: [PATCH] add timeline.js --- static/js/pandora/timeline.js | 96 +++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 static/js/pandora/timeline.js diff --git a/static/js/pandora/timeline.js b/static/js/pandora/timeline.js new file mode 100644 index 00000000..c84a29d7 --- /dev/null +++ b/static/js/pandora/timeline.js @@ -0,0 +1,96 @@ +// vim: et:ts=4:sw=4:sts=4:ft=javascript + +'use strict'; + +pandora.ui.timeline = function(data) { + + var ui = pandora.user.ui; + + return Ox.VideoTimelinePanel({ + annotationsCalendarSize: ui.annotationsCalendarSize, + annotationsFont: ui.annotationsFont, + annotationsMapSize: ui.annotationsMapSize, + annotationsRange: ui.annotationsRange, + annotationsSize: ui.annotationsSize, + annotationsSort: ui.annotationsSort, + censored: data.censored, + clickLink: pandora.clickLink, + cuts: data.cuts || [], + duration: data.duration, + followPlayer: ui.followPlayer, + getFrameURL: function(position) { + return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg'; + }, + getTimelineImageURL: function(i) { + return '/' + ui.item + '/timeline64p' + i + '.png'; + }, + 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, + timeline: ui.videoTimeline, + timelineImageURL: '/' + ui.item + '/timeline16p.png', + 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}); + }, + 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]); + }, + 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}); + } + }); + +}; \ No newline at end of file