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

51 lines
1.7 KiB
JavaScript
Raw Normal View History

2011-05-25 19:42:45 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.info = function() {
var that = new Ox.Element()
.append(
app.$ui.infoStill = new Ox.Element()
.css({
position: 'absolute',
left: 0,
top: 0,
height: '96px'
})
)
.append(
app.$ui.infoTimeline = new Ox.Element('<img>')
.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();
}
});
if(app.user.ui.item) {
pandora.api.getItem(app.user.ui.item, function(result) {
app.ui.infoRatio = result.data.stream.aspectRatio;
2011-05-25 19:42:45 +00:00
var width = that.width() || 256,
height = width / app.ui.infoRatio + 16;
app.$ui.infoStill.removeElement();
app.$ui.infoStill = pandora.ui.flipbook(app.user.ui.item)
.appendTo(that.$element);
app.$ui.infoStill.css({
'height': (height-16) + 'px'
});
that.css({
height: height + 'px'
});
pandora.resizeFolders();
!app.user.ui.showInfo && app.$ui.leftPanel.css({bottom: -height});
app.$ui.leftPanel.size(2, height );
});
app.$ui.infoTimeline.attr('src', '/'+app.user.ui.item+'/timeline.16.png');
2011-05-25 19:42:45 +00:00
}
return that;
};