'use strict';
oml.ui.info = function() {
var ui = oml.user.ui,
that = Ox.Element()
.addClass('OxTextPage')
.css({
padding: '0 16px',
textAlign: 'center',
overflowY: 'auto'
})
.bindEvent({
toggle: function(data) {
oml.UI.set({showInfo: !data.collapsed});
},
oml_icons: function() {
that.updateElement();
},
oml_item: function() {
that.updateElement();
},
oml_listselection: function() {
that.updateElement();
}
});
that.updateElement = function() {
var id = ui.item || ui.listSelection[0];
Ox.Request.clearCache('get');
if (id) {
oml.api.get({
id: id,
keys: [
'author', 'coverRatio',
'description', 'modified', 'title'
]
}, function(result) {
var data = result.data;
that.empty();
$('')
.attr({
src: '/' + id + '/' + ui.icons + '128.jpg?'
+ data.modified
})
.css({
margin: '16px 0 8px 0',
height: '128px'
})
.bind({
load: function() {
if (data.coverRatio > 1) {
$(this).css({
height: (128 / data.coverRatio) + 'px'
});
}
}
})
.appendTo(that);
$('