some further fixes

This commit is contained in:
rlx 2011-08-19 16:04:33 +00:00
parent d9aa4a230b
commit c1b46421a8

View file

@ -168,15 +168,14 @@ pandora.ui.list = function() { // fixme: remove view argument
that = Ox.IconList({ that = Ox.IconList({
fixedRatio: fixedRatio, fixedRatio: fixedRatio,
item: function(data, sort, size) { item: function(data, sort, size) {
Ox.print('DATA', data)
size = size || 128; size = size || 128;
var ratio = data.videoRatio, var ratio = data.videoRatio,
width = ratio > fixedRatio ? size : Math.round(size * ratio / fixedRatio), width = ratio > fixedRatio ? size : Math.round(size * ratio / fixedRatio),
height = Math.round(width / ratio), height = Math.round(width / ratio),
url = '/' + data.item + '/' + height + 'p' + data['in'] + '.jpg'; url = '/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg';
return { return {
height: height, height: height,
id: data['id'], id: data.id,
info: Ox.formatDuration(data['in'], 'short') + ' - ' + Ox.formatDuration(data['out'], 'short'), info: Ox.formatDuration(data['in'], 'short') + ' - ' + Ox.formatDuration(data['out'], 'short'),
title: data.value, title: data.value,
url: url, url: url,
@ -197,7 +196,7 @@ pandora.ui.list = function() { // fixme: remove view argument
itemQuery: itemQuery itemQuery: itemQuery
}), callback); }), callback);
}, },
keys: ['id', 'value', 'in', 'out', 'video', 'videoRatio', 'item'], keys: ['id', 'value', 'in', 'out', 'videoRatio'],
max: 1, max: 1,
size: 128, size: 128,
sort: pandora.user.ui.lists[pandora.user.ui.list].sort, sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
@ -208,7 +207,7 @@ pandora.ui.list = function() { // fixme: remove view argument
}, },
open: function(data) { open: function(data) {
var id = data.ids[0], var id = data.ids[0],
item = that.value(id, 'item'), item = id.split('/')[0],
position = that.value(id, 'in'); position = that.value(id, 'in');
pandora.UI.set('videoPosition|' + item, position); pandora.UI.set('videoPosition|' + item, position);
pandora.URL.set(item + '/timeline'); pandora.URL.set(item + '/timeline');
@ -216,6 +215,7 @@ pandora.ui.list = function() { // fixme: remove view argument
openpreview: function(data) { openpreview: function(data) {
var $video = $('.OxItem.OxSelected > .OxIcon > .OxVideoPlayer'); var $video = $('.OxItem.OxSelected > .OxIcon > .OxVideoPlayer');
$video && $video.trigger('click'); $video && $video.trigger('click');
$video && Ox.print('OPENPREVIEW!!!@!')
that.closePreview(); that.closePreview();
}, },
select: function(data) { select: function(data) {
@ -227,23 +227,22 @@ pandora.ui.list = function() { // fixme: remove view argument
pandora.UI.set(['lists', pandora.user.ui.list, 'selected'].join('|'), item); pandora.UI.set(['lists', pandora.user.ui.list, 'selected'].join('|'), item);
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info(data.ids[0].split('/')[0])); pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info(data.ids[0].split('/')[0]));
if ($img.length) { if ($img.length) {
width = parseInt($img.css('width')); var width = parseInt($img.css('width')),
height = parseInt($img.css('height')); height = parseInt($img.css('height'));
pandora.api.findAnnotations({ pandora.api.get({id: item, keys: ['parts']}, function(result) {
query: { var inPoint = that.value(id, 'in'),
conditions:[{key: 'id', value: id, operator: '='}] outPoint = that.value(id, 'out'),
}, $player = Ox.VideoPlayer({
keys: ['in', 'out']
}, function(result) {
var $player = Ox.VideoPlayer({
height: height, height: height,
'in': result.data.items[0]['in'], 'in': inPoint,
out: result.data.items[0].out, out: outPoint,
paused: true, paused: true,
playInToOut: true, playInToOut: true,
poster: '/' + item + '/' + height + 'p' + result.data.items[0]['in'] + '.jpg', poster: '/' + item + '/' + height + 'p' + that.value(id, 'in') + '.jpg',
width: width, width: width,
video: '/' + item + '/96p.webm' video: Ox.range(result.data.parts).map(function(i) {
return '/' + item + '/96p' + (i + 1) + '.' + pandora.user.videoFormat
})
}) })
.addClass('OxTarget') .addClass('OxTarget')
.bindEvent({ .bindEvent({