openmedialibrary/static/js/viewer.js

36 lines
806 B
JavaScript
Raw Normal View History

2014-05-04 17:26:43 +00:00
'use strict';
oml.ui.viewer = function() {
var ui = oml.user.ui,
that = Ox.Element()
.bindEvent({
oml_item: function(data) {
2014-05-17 11:45:57 +00:00
that.updateElement();
2014-05-04 17:26:43 +00:00
},
oml_itemview: function(data) {
2014-05-17 11:45:57 +00:00
that.updateElement();
2014-05-04 17:26:43 +00:00
}
}),
$iframe;
2014-05-17 11:45:57 +00:00
that.updateElement = function() {
2014-05-04 17:26:43 +00:00
if (ui.item && ui.itemView == 'book') {
$iframe = $iframe || Ox.Element('<iframe>').css({
width: '100%',
height: '100%',
border: 0
}).appendTo(that);
$iframe.attr({
src: '/' + ui.item + '/reader/'
});
}
return that;
};
2014-05-17 11:45:57 +00:00
return that.updateElement();
2014-05-04 17:26:43 +00:00
};