pandora/static/js/pandora/tv.js

88 lines
2.8 KiB
JavaScript
Raw Normal View History

2011-12-19 21:12:23 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
pandora.ui.tv = function() {
var that = Ox.Element()
.addClass('OxScreen')
.css({
position: 'absolute',
width: '100%',
height: '100%',
opacity: 0,
zIndex: 1000
}),
$player;
function play() {
pandora.api.tv({
list: pandora.user.ui._list
}, function(result) {
var videoOptions = pandora.getVideoOptions(result.data);
2011-12-20 13:08:30 +00:00
$player && $player.remove();
2011-12-19 21:12:23 +00:00
$player = Ox.VideoPlayer({
censored: videoOptions.censored,
controlsBottom: ['volume', 'scale', 'timeline', 'position', 'resolution'],
controlsTop: ['close', 'title'],
duration: result.data.duration,
fullscreen: true,
logo: pandora.site.tv.showLogo ? '/static/png/logo256.png' : '',
position: result.data.position,
2011-12-20 13:08:30 +00:00
resolution: pandora.user.ui.videoResolution,
2011-12-19 21:12:23 +00:00
scaleToFill: pandora.user.ui.videoScale == 'fill',
subtitles: videoOptions.subtitles,
tooltips: true,
timeline: '/' + result.data.item + '/timeline16p.png',
title: pandora.site.site.name + ' — ' + (
pandora.user.ui._list
? pandora.user.ui._list
: 'All ' + pandora.site.itemName.plural
) + ' — '
+ result.data.title
+ ' (' + result.data.director.join(', ') + ') '
+ result.data.year,
video: videoOptions.video,
volume: pandora.user.ui.videoVolume
})
.bindEvent({
2011-12-20 13:08:30 +00:00
close: that.fadeOutScreen,
ended: play,
resolution: function(data) {
pandora.UI.set('videoResolution', data.resolution);
}
2011-12-19 21:12:23 +00:00
})
.appendTo(that);
});
}
that.fadeInScreen = function() {
that.appendTo(Ox.UI.$body).animate({opacity: 1}, 500);
play();
2011-12-20 13:08:30 +00:00
return that;
2011-12-19 21:12:23 +00:00
};
that.fadeOutScreen = function() {
2011-12-20 13:08:30 +00:00
that.animate({opacity: 0}, 500, function() {
that.remove();
});
pandora.UI.set('page', '');
return that;
2011-12-19 21:12:23 +00:00
};
that.hideScreen = function() {
2011-12-20 13:08:30 +00:00
that.remove();
pandora.UI.set('page', '');
return that;
2011-12-19 21:12:23 +00:00
};
that.showScreen = function() {
that.css({opacity: 1}).appendTo(Ox.UI.$body);
play();
2011-12-20 13:08:30 +00:00
return that;
2011-12-19 21:12:23 +00:00
};
return that;
2011-12-20 13:08:30 +00:00
}