fix bugs in timelines view
This commit is contained in:
parent
96f60e4184
commit
fd116dbb70
2 changed files with 22 additions and 14 deletions
|
@ -104,7 +104,9 @@ pandora.ui.item = function() {
|
||||||
} else if (pandora.user.ui.itemView == 'video') {
|
} else if (pandora.user.ui.itemView == 'video') {
|
||||||
pandora.api.get({id: pandora.user.ui.item, keys: ['layers']}, function(r) {
|
pandora.api.get({id: pandora.user.ui.item, keys: ['layers']}, function(r) {
|
||||||
// fixme: duplicated
|
// fixme: duplicated
|
||||||
var layers = [],
|
var clipsQuery = pandora.getClipsQuery(),
|
||||||
|
isClipsQuery = !!clipsQuery.conditions.length,
|
||||||
|
layers = [],
|
||||||
video = {};
|
video = {};
|
||||||
pandora.site.layers.forEach(function(layer, i) {
|
pandora.site.layers.forEach(function(layer, i) {
|
||||||
layers[i] = Ox.extend({}, layer, {items: r.data.layers[layer.id]});
|
layers[i] = Ox.extend({}, layer, {items: r.data.layers[layer.id]});
|
||||||
|
@ -120,6 +122,7 @@ pandora.ui.item = function() {
|
||||||
annotationsSize: pandora.user.ui.annotationsSize,
|
annotationsSize: pandora.user.ui.annotationsSize,
|
||||||
cuts: result.data.cuts || [],
|
cuts: result.data.cuts || [],
|
||||||
duration: result.data.duration,
|
duration: result.data.duration,
|
||||||
|
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
|
||||||
getTimelineImageURL: function(i) {
|
getTimelineImageURL: function(i) {
|
||||||
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
||||||
},
|
},
|
||||||
|
@ -170,7 +173,9 @@ pandora.ui.item = function() {
|
||||||
|
|
||||||
} else if (pandora.user.ui.itemView == 'timeline') {
|
} else if (pandora.user.ui.itemView == 'timeline') {
|
||||||
pandora.api.get({id: pandora.user.ui.item, keys: ['layers']}, function(r) {
|
pandora.api.get({id: pandora.user.ui.item, keys: ['layers']}, function(r) {
|
||||||
var layers = [],
|
var clipsQuery = pandora.getClipsQuery(),
|
||||||
|
isClipsQuery = !!clipsQuery.conditions.length,
|
||||||
|
layers = [],
|
||||||
video = {};
|
video = {};
|
||||||
pandora.site.layers.forEach(function(layer) {
|
pandora.site.layers.forEach(function(layer) {
|
||||||
layers.push(Ox.extend({items: r.data.layers[layer.id]}, layer));
|
layers.push(Ox.extend({items: r.data.layers[layer.id]}, layer));
|
||||||
|
@ -185,7 +190,7 @@ pandora.ui.item = function() {
|
||||||
annotationsSize: pandora.user.ui.annotationsSize,
|
annotationsSize: pandora.user.ui.annotationsSize,
|
||||||
cuts: result.data.cuts || [],
|
cuts: result.data.cuts || [],
|
||||||
duration: result.data.duration,
|
duration: result.data.duration,
|
||||||
find: '',
|
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
|
||||||
getFrameURL: function(position) {
|
getFrameURL: function(position) {
|
||||||
return '/' + pandora.user.ui.item + '/' + Ox.last(pandora.site.video.resolutions) + 'p' + position + '.jpg';
|
return '/' + pandora.user.ui.item + '/' + Ox.last(pandora.site.video.resolutions) + 'p' + position + '.jpg';
|
||||||
},
|
},
|
||||||
|
|
|
@ -253,8 +253,6 @@ pandora.ui.list = function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (view == 'timelines') {
|
} else if (view == 'timelines') {
|
||||||
var clipsQuery = pandora.getClipsQuery(),
|
|
||||||
isClipsQuery = clipsQuery.conditions.length;
|
|
||||||
that = Ox.InfoList({
|
that = Ox.InfoList({
|
||||||
borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16,
|
borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16,
|
||||||
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1,
|
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1,
|
||||||
|
@ -262,7 +260,9 @@ pandora.ui.list = function() {
|
||||||
id: 'list',
|
id: 'list',
|
||||||
item: function(data, sort, size) {
|
item: function(data, sort, size) {
|
||||||
size = 128;
|
size = 128;
|
||||||
var ui = pandora.user.ui,
|
var clipsQuery = pandora.getClipsQuery(),
|
||||||
|
isClipsQuery = !!clipsQuery.conditions.length,
|
||||||
|
ui = pandora.user.ui,
|
||||||
ratio = ui.icons == 'posters'
|
ratio = ui.icons == 'posters'
|
||||||
? (ui.showSitePoster ? 5/8 : data.posterRatio) : 1,
|
? (ui.showSitePoster ? 5/8 : data.posterRatio) : 1,
|
||||||
url = '/' + data.id + '/' + (
|
url = '/' + data.id + '/' + (
|
||||||
|
@ -296,22 +296,26 @@ pandora.ui.list = function() {
|
||||||
pandora.$ui.videoPreview.options({
|
pandora.$ui.videoPreview.options({
|
||||||
position: event.position
|
position: event.position
|
||||||
});
|
});
|
||||||
|
if (pandora.user.ui.videoPoints[data.id]) {
|
||||||
pandora.UI.set('videoPoints.' + data.id + '.position', event.position);
|
pandora.UI.set('videoPoints.' + data.id + '.position', event.position);
|
||||||
|
} else {
|
||||||
|
pandora.UI.set('videoPoints.' + data.id, {'in': 0, out: 0, position: event.position});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
id: data.id,
|
id: data.id,
|
||||||
options: {
|
options: {
|
||||||
duration: data.duration,
|
duration: data.duration,
|
||||||
find: 'cinema',
|
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
|
||||||
getImageURL: function(i) {
|
getImageURL: function(i) {
|
||||||
return '/' + data.id + '/timeline16p' + i + '.png';
|
return '/' + data.id + '/timeline16p' + i + '.png';
|
||||||
},
|
},
|
||||||
position: pandora.user.ui.videoPoints[data.id]
|
position: pandora.user.ui.videoPoints[data.id]
|
||||||
? pandora.user.ui.videoPoints[data.id].position : 0,
|
? pandora.user.ui.videoPoints[data.id].position : 0,
|
||||||
results: data.clips ? data.clips.map(function(clip) {
|
results: isClipsQuery ? data.clips.map(function(clip) {
|
||||||
return {'in': clip['in'], out: clip.out};
|
return {'in': clip['in'], out: clip.out};
|
||||||
}) : [],
|
}) : [],
|
||||||
subtitles: data.clips ? data.clips.map(function(clip) {
|
subtitles: isClipsQuery ? data.clips.map(function(clip) {
|
||||||
return {'in': clip['in'], out: clip.out, text: clip.annotations[0].value};
|
return {'in': clip['in'], out: clip.out, text: clip.annotations[0].value};
|
||||||
}) : []
|
}) : []
|
||||||
}
|
}
|
||||||
|
@ -319,6 +323,8 @@ pandora.ui.list = function() {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
|
var clipsQuery = pandora.getClipsQuery(),
|
||||||
|
isClipsQuery = !!clipsQuery.conditions.length;
|
||||||
pandora.api.find(Ox.extend(data, Ox.extend({
|
pandora.api.find(Ox.extend(data, Ox.extend({
|
||||||
query: pandora.user.ui.find
|
query: pandora.user.ui.find
|
||||||
}, isClipsQuery ? {clips: {
|
}, isClipsQuery ? {clips: {
|
||||||
|
@ -327,10 +333,7 @@ pandora.ui.list = function() {
|
||||||
keys: []
|
keys: []
|
||||||
}} : {})), callback);
|
}} : {})), callback);
|
||||||
},
|
},
|
||||||
keys: Ox.merge(
|
keys: ['clips', 'director', 'duration', 'id', 'posterRatio', 'title', 'year'],
|
||||||
['director', 'duration', 'id', 'posterRatio', 'title', 'year'],
|
|
||||||
isClipsQuery ? ['clips'] : []
|
|
||||||
),
|
|
||||||
selected: pandora.user.ui.listSelection,
|
selected: pandora.user.ui.listSelection,
|
||||||
size: 192,
|
size: 192,
|
||||||
sort: pandora.user.ui.listSort,
|
sort: pandora.user.ui.listSort,
|
||||||
|
|
Loading…
Reference in a new issue