only open available books

This commit is contained in:
j 2014-05-25 16:10:38 +02:00
parent 19292fb940
commit 9a6278bb83

View file

@ -18,13 +18,17 @@ oml.ui.viewer = function() {
that.updateElement = function() {
item = ui.item;
if (item) {
$iframe = $iframe || Ox.Element('<iframe>').css({
width: '100%',
height: '100%',
border: 0
}).appendTo(that);
$iframe.attr({
src: '/' + item + '/reader/'
oml.api.get({id: item, keys: ['mediastate']}, function(result) {
if (result.data.mediastate == 'available') {
$iframe = $iframe || Ox.Element('<iframe>').css({
width: '100%',
height: '100%',
border: 0
}).appendTo(that);
$iframe.attr({
src: '/' + item + '/reader/'
});
}
});
}
return that;