pandora/static/js/timeline.js

133 lines
5.2 KiB
JavaScript
Raw Normal View History

2012-04-17 12:04:01 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
pandora.ui.timeline = function(data) {
2012-06-15 13:20:35 +00:00
var ui = pandora.user.ui,
that = Ox.VideoTimelinePanel({
annotationsCalendarSize: ui.annotationsCalendarSize,
annotationsMapSize: ui.annotationsMapSize,
annotationsRange: ui.annotationsRange,
annotationsSize: ui.annotationsSize,
annotationsSort: ui.annotationsSort,
2014-02-14 15:23:59 +00:00
annotationsTooltip: Ox._('annotations')
2014-09-25 19:56:19 +00:00
+ ' <span class="OxBright">' + Ox.SYMBOLS.shift + 'A</span>',
2014-07-24 17:46:16 +00:00
audioTrack: data.audioTrack,
2012-06-15 13:20:35 +00:00
censored: data.censored,
censoredIcon: pandora.site.cantPlay.icon,
2014-02-14 15:23:59 +00:00
censoredTooltip: Ox._(pandora.site.cantPlay.text),
2012-06-15 13:20:35 +00:00
clickLink: pandora.clickLink,
cuts: data.cuts || [],
duration: data.duration,
followPlayer: ui.followPlayer,
getFrameURL: function(position) {
return pandora.getMediaURL(
'/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg?' + data.modified
);
2012-06-15 13:20:35 +00:00
},
getLargeTimelineURL: function(type, i) {
return pandora.getMediaURL(
'/' + ui.item + '/timeline' + type + '64p' + i + '.jpg?' + data.modified
);
2012-06-15 13:20:35 +00:00
},
height: pandora.$ui.contentPanel.size(1),
2014-01-19 06:28:05 +00:00
itemName: pandora.site.itemName,
2012-06-15 13:20:35 +00:00
layers: data.annotations,
muted: ui.videoMuted,
position: ui.videoPoints[ui.item].position,
2013-03-01 11:23:35 +00:00
resolution: Ox.min(pandora.site.video.resolutions),
2012-06-15 13:20:35 +00:00
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: pandora.getMediaURL(
'/' + ui.item + '/timeline16p.jpg?' + data.modified
),
2012-06-15 13:20:35 +00:00
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({
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) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({followPlayer: data.follow});
2012-06-15 13:20:35 +00:00
},
gainfocus: function() {
pandora.$ui.mainMenu.replaceItemMenu();
},
2012-06-15 13:20:35 +00:00
info: function(data) {
pandora.ui.annotationDialog(
Ox.getObjectById(pandora.site.layers, data.layer).title
).open();
},
muted: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({videoMuted: data.muted});
2012-06-15 13:20:35 +00:00
},
2013-07-08 12:40:51 +00:00
playing: function(data) {
pandora.UI.set(
'videoPoints.' + pandora.user.ui.item + '.position',
data.position
);
},
2012-06-15 13:20:35 +00:00
position: function(data) {
pandora.UI.set(
'videoPoints.' + pandora.user.ui.item + '.position',
data.position
);
},
resizeannotations: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({annotationsSize: data.annotationsSize});
2012-06-15 13:20:35 +00:00
},
resizecalendar: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({annotationsCalendarSize: data.size});
2012-06-15 13:20:35 +00:00
},
resizemap: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({annotationsMapSize: data.size});
2012-06-15 13:20:35 +00:00
},
select: function(data) {
pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]);
},
timeline: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({videoTimeline: data.timeline});
2012-06-15 13:20:35 +00:00
},
toggleannotations: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({showAnnotations: data.showAnnotations});
2012-06-15 13:20:35 +00:00
},
togglelayer: function(data) {
pandora.UI.set('showLayers.' + data.layer, !data.collapsed);
},
togglemap: function(data) {
2013-07-14 15:36:49 +00:00
pandora.UI.set({showAnnotationsMap: !data.collapsed});
2012-06-15 13:20:35 +00:00
},
pandora_showannotations: function(data) {
that.options({showAnnotations: data.value});
},
pandora_videotimeline: function(data) {
that.options({timeline: data.value});
}
});
return that;
2012-04-17 12:04:01 +00:00
2012-05-17 09:38:59 +00:00
};