less requests

This commit is contained in:
j 2011-10-20 21:32:12 +02:00
parent 19d390e561
commit 95ce013aa4

View file

@ -6,7 +6,8 @@ pandora.ui.item = function() {
pandora.api.get({
id: pandora.user.ui.item,
keys: []
keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView)>-1 ?
['rendered', 'cuts', 'videoRatio', 'duration', 'layers', 'parts', 'size'] : []
}, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) {
if (result.status.code == 200) {
@ -102,14 +103,13 @@ pandora.ui.item = function() {
);
} else if (pandora.user.ui.itemView == 'video') {
pandora.api.get({id: pandora.user.ui.item, keys: ['layers']}, function(r) {
// fixme: duplicated
var clipsQuery = pandora.getClipsQuery(),
isClipsQuery = !!clipsQuery.conditions.length,
layers = [],
video = {};
pandora.site.layers.forEach(function(layer, i) {
layers[i] = Ox.extend({}, layer, {items: r.data.layers[layer.id]});
layers[i] = Ox.extend({}, layer, {items: result.data.layers[layer.id]});
});
pandora.site.video.resolutions.forEach(function(resolution) {
video[resolution] = Ox.range(result.data.parts).map(function(i) {
@ -134,8 +134,8 @@ pandora.ui.item = function() {
scaleToFill: pandora.user.ui.videoScale == 'fill',
showAnnotations: pandora.user.ui.showAnnotations,
showControls: pandora.user.ui.showControls,
subtitles: r.data.layers.subtitles ?
r.data.layers.subtitles.map(function(subtitle) {
subtitles: result.data.layers.subtitles ?
result.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}) : [],
tooltips: true,
@ -169,16 +169,14 @@ pandora.ui.item = function() {
pandora.$ui.player.options({showAnnotations: data.value});
}
}));
});
} else if (pandora.user.ui.itemView == 'timeline') {
pandora.api.get({id: pandora.user.ui.item, keys: ['layers']}, function(r) {
var clipsQuery = pandora.getClipsQuery(),
isClipsQuery = !!clipsQuery.conditions.length,
layers = [],
video = {};
pandora.site.layers.forEach(function(layer) {
layers.push(Ox.extend({items: r.data.layers[layer.id]}, layer));
layers.push(Ox.extend({items: result.data.layers[layer.id]}, layer));
});
pandora.site.video.resolutions.forEach(function(resolution) {
video[resolution] = Ox.range(result.data.parts).map(function(i) {
@ -211,8 +209,8 @@ pandora.ui.item = function() {
showAnnotations: pandora.user.ui.showAnnotations,
showLargeTimeline: true,
// fixme: layers have value, subtitles has text?
subtitles: r.data.layers.subtitles ?
r.data.layers.subtitles.map(function(subtitle) {
subtitles: result.data.layers.subtitles ?
result.data.layers.subtitles.map(function(subtitle) {
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
}) : [],
tooltips: true,
@ -285,7 +283,6 @@ pandora.ui.item = function() {
});
});
*/
});
} else if (pandora.user.ui.itemView == 'map') {
pandora.$ui.contentPanel.replaceElement(1, pandora.ui.navigationView('map', result.data.videoRatio));