cablegates/static/js/pandora/ui/info.js

56 lines
1.8 KiB
JavaScript
Raw Normal View History

2011-07-29 18:37:11 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-05-25 19:42:45 +00:00
pandora.ui.info = function() {
2011-06-19 17:49:25 +00:00
var that = Ox.Element()
2011-05-25 19:42:45 +00:00
.append(
2011-06-19 17:49:25 +00:00
pandora.$ui.infoStill = Ox.Element()
2011-05-25 19:42:45 +00:00
.css({
position: 'absolute',
left: 0,
top: 0,
height: '96px'
})
)
.append(
2011-06-19 17:49:25 +00:00
pandora.$ui.infoTimeline = Ox.Element('<img>')
2011-05-25 19:42:45 +00:00
.css({
position: 'absolute',
left: 0,
bottom: 0,
height: '16px'
2011-05-25 19:42:45 +00:00
})
)
.bindEvent({
toggle: function(event, data) {
2011-06-04 16:46:39 +00:00
pandora.UI.set({showInfo: !data.collapsed});
2011-05-25 19:42:45 +00:00
pandora.resizeFolders();
}
});
2011-08-06 18:00:15 +00:00
if (pandora.user.ui.item) {
pandora.api.get({
id: pandora.user.ui.item,
keys: ['stream']
}, function(result) {
2011-06-06 15:48:11 +00:00
pandora.user.infoRatio = result.data.stream.aspectRatio;
2011-05-25 19:42:45 +00:00
var width = that.width() || 256,
2011-06-06 15:48:11 +00:00
height = width / pandora.user.infoRatio + 16;
pandora.$ui.infoStill.removeElement();
pandora.$ui.infoStill = pandora.ui.flipbook(pandora.user.ui.item)
2011-05-25 19:42:45 +00:00
.appendTo(that.$element);
2011-06-06 15:48:11 +00:00
pandora.$ui.infoStill.css({
2011-05-25 19:42:45 +00:00
'height': (height-16) + 'px'
});
that.css({
height: height + 'px'
});
pandora.resizeFolders();
2011-06-06 15:48:11 +00:00
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -height});
2011-08-06 18:00:15 +00:00
pandora.$ui.leftPanel.size(2, height);
});
pandora.$ui.infoTimeline.attr({
src: '/' + pandora.user.ui.item + '/timeline16p.png'
2011-05-25 19:42:45 +00:00
});
}
return that;
};