updating info (part 1)

This commit is contained in:
rolux 2011-09-18 06:51:28 +00:00
parent 5adeb5290b
commit 02db844ef0
3 changed files with 35 additions and 38 deletions

View file

@ -9,54 +9,47 @@ pandora.ui.info = function(id) {
}
});
if (id) {
if (!pandora.user.ui.item && pandora.user.ui.lists[pandora.user.ui.list].listView == 'clip') {
if (!pandora.user.ui.item && pandora.isClipView(pandora.user.ui.lists[pandora.user.ui.list].listView)) {
// Poster
pandora.api.get({id: id, keys: ['posterRatio']}, function(result) {
pandora.api.get({id: id, keys: ['director', 'posterRatio', 'title']}, function(result) {
var ratio = result.data.posterRatio,
height = pandora.user.ui.sidebarSize;
height = Math.min(pandora.user.ui.sidebarSize, 256);
that.empty().append(
$('<img>').attr({
src: '/' + id + '/poster' + pandora.user.ui.sidebarSize + '.jpg'
Ox.Element({
element: '<img>',
tooltip: '<span class="OxBright">' + result.data.title + '</span>' + (
result.data.director ? '<br/>' + result.data.director.join(', ') : ''
)
}).attr({
src: '/' + id + '/poster256.jpg'
}).css({
position: 'absolute',
left: 0,
top: 0,
right: 0,
bottom: 0,
height: height + 'px',
margin: 'auto'
})
);
pandora.user.infoRatio = 1;
resize(height);
});
} else {
// Video Preview
pandora.api.get({id: id, keys: ['duration', 'videoRatio']}, function(result) {
if (result.data) {
var height = Math.round(pandora.user.ui.sidebarSize / result.data.videoRatio) + 16;
pandora.$ui.videoPreview && pandora.$ui.videoPreview.removeElement();
pandora.$ui.videoPreview = pandora.ui.videoPreview({
id: id,
duration: result.data.duration,
ratio: result.data.videoRatio
frameRatio: result.data.videoRatio
}).appendTo(pandora.$ui.info);
pandora.user.infoRatio = pandora.user.ui.sidebarSize / height;
resize(height);
}
});
}
} else if (pandora.$ui.leftPanel) {
pandora.user.infoRatio = 1;
resize(pandora.user.ui.sidebarSize);
}
function resize(height) {
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -height});
pandora.$ui.leftPanel.size(2, height);
that.animate({
height: height + 'px'
}, 250, function() {
pandora.resizeFolders();
});
//pandora.user.infoRatio = 1;
//resize(pandora.user.ui.sidebarSize);
}
return that;
};

View file

@ -13,7 +13,7 @@ pandora.ui.leftPanel = function() {
collapsed: !pandora.user.ui.showInfo,
collapsible: true,
element: pandora.$ui.info = pandora.ui.info(),
size: Math.round(pandora.user.ui.sidebarSize / pandora.user.infoRatio),
size: Math.min(pandora.user.ui.sidebarSize, 256),
tooltip: 'info'
}
],
@ -23,7 +23,8 @@ pandora.ui.leftPanel = function() {
.bindEvent({
resize: function(data) {
Ox.print('LEFT PANEL RESIZE')
var infoSize = Math.round(data.size / pandora.user.infoRatio);
var infoSize = Math.min(data.size, 256);
// fixme: don't make a request here:
pandora.UI.set('sidebarSize', data.size);
if (data.size < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
pandora.$ui.sectionButtons.removeElement();
@ -36,10 +37,14 @@ pandora.ui.leftPanel = function() {
}
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoSize});
pandora.$ui.leftPanel.size(2, infoSize);
pandora.$ui.videoPreview && pandora.$ui.videoPreview.options({
frameHeight: infoSize - 16,
frameWidth: data.size
if (pandora.$ui.videoPreview) {
pandora.$ui.videoPreview.options({
height: infoSize,
width: data.size
});
} else {
pandora.$ui.info.find('img').css({height: infoSize + 'px'})
}
pandora.resizeFolders();
},
resizeend: function(data) {

View file

@ -1,13 +1,11 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript
pandora.ui.videoPreview = function(data) {
var frameWidth = pandora.user.ui.sidebarSize,
frameHeight = Math.round(frameWidth / data.ratio),
that = Ox.VideoPreview({
var that = Ox.VideoPreview({
duration: data.duration,
getFrame: function(position) {
var width = pandora.user.ui.sidebarSize,
height = Math.round(width / pandora.user.infoRatio),
height = Math.min(width, 256),
resolution = Ox.filter(pandora.site.video.resolutions, function(resolution, i) {
return resolution >= height || i == pandora.site.video.resolutions.length - 1;
})[0];
@ -15,9 +13,10 @@ pandora.ui.videoPreview = function(data) {
Ox.isUndefined(position) ? '' : position
) + '.jpg';
},
frameHeight: frameHeight,
frameWidth: frameWidth,
frameRatio: data.frameRatio,
height: Math.min(pandora.user.ui.sidebarSize, 256),
timeline: '/' + data.id + '/timeline16p.png',
width: pandora.user.ui.sidebarSize
})
.bindEvent({
click: function(event) {
@ -28,16 +27,16 @@ pandora.ui.videoPreview = function(data) {
position: event.position
});
} else {
pandora.UI.set('videoPosition|' + data.id, event.position);
pandora.UI.set(
'videoPoints|' + data.id,
{'in': 0, out: 0, position: event.position}
);
pandora.URL.set(
'/' + data.id + '/timeline' //'/' + Ox.formatDuration(event.position, 2)
);
}
}
});
function getResolution() {
return
}
return that;
};