openmedialibrary/static/js/viewer.js

36 lines
802 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_itemview: function(data) {
2014-05-25 12:16:04 +00:00
if (ui.item != item && ui.itemView == 'book') {
that.updateElement(ui.item);
}
2014-05-04 17:26:43 +00:00
}
}),
2014-05-25 12:16:04 +00:00
$iframe, item;
2014-05-04 17:26:43 +00:00
2014-05-17 11:45:57 +00:00
that.updateElement = function() {
2014-05-25 12:16:04 +00:00
item = ui.item;
if (item) {
2014-05-04 17:26:43 +00:00
$iframe = $iframe || Ox.Element('<iframe>').css({
width: '100%',
height: '100%',
border: 0
}).appendTo(that);
$iframe.attr({
2014-05-25 12:16:04 +00:00
src: '/' + item + '/reader/'
2014-05-04 17:26:43 +00:00
});
}
return that;
};
2014-05-17 11:45:57 +00:00
return that.updateElement();
2014-05-04 17:26:43 +00:00
};