this.openPrint(cb);
} else if (view === 'download') {
this.openDownload(cb);
+ } else if (view === 'pdf') {
+ this.openPDF(param1, cb);
} else if (view === 'article') {
this.fluidbook.articles.openArticle(param1, cb);
} else {
if (closeMenu) {
this.fluidbook.nav.closeMenu();
}
- }, openNotes: function (p1, p2, cb) {
+ },
+
+ openNotes: function (p1, p2, cb) {
this.fluidbook.notes.openMenu(cb);
- }, openSearch: function (q, cb) {
+ },
+
+ openSearch: function (q, cb) {
this.fluidbook.nav.openSearch(q, cb);
},
+ openPDF: function (uid, callback) {
+ var infos = this.fluidbook.settings.pdfLinks[uid];
+ let c = this.getCaption('', 'nocaption', 'nocaption');
+ c += '<div class="content"><div class="pdf-holder"><iframe class="pdf view ' + infos.interface + '" data-width="' + infos.width + '" data-height="' + infos.height + '" data-total-height="' + infos.totalHeight + '" frameborder="0" scrolling="no" src="pdfjs/web/viewer.html?&file=../../data/links/' + infos.file + '#zoom=page-width"></iframe></div></div>';
+ this.viewWrap(c, 'pdf', '', 'pdf');
+ if (callback != undefined) {
+ callback();
+ }
+ this.fluidbook.displayLoader();
+ },
+
openingView: function (callback, view) {
var $this = this;
this.fluidbook.resize.resizeView();
var res = '<div class="caption ' + cls + '">';
if (close) {
- res += this.closeButton();
+ res += this.closeButton(close);
}
if (caption !== '') {
res += '<h2 id="mview-dialog-title">' + caption + '</h2>';
},
closeButton: function (c) {
- if (c == undefined) {
+ if (c == undefined || c === true) {
c = '';
} else {
c = ' ' + c;
if (callback != undefined) {
callback();
}
- }, openWebVideo: function (service, video, callback) {
+ },
+ openWebVideo: function (service, video, callback) {
var hash = '#/webvideo/' + service + '/' + video;
var a = $('a[href="' + hash + '"]');
var markup = decodeURIComponent($(a).attr('data-video'));
if (callback != undefined) {
callback();
}
- }, openLocales: function (p1, p2, callback) {
+ },
+ openLocales: function (p1, p2, callback) {
var view = this.getCaption('Select language');
view += '<div class="content">';
view += '<ul class="chapters localesList">';
openCart: function (p1, p2, callback) {
this.fluidbook.cart.instance.openMenu(p1, p2, callback);
- }, openShare: function (p1, p2, callback) {
+ },
+
+ openShare: function (p1, p2, callback) {
this.fluidbook.share.openShare(p1, p2, callback);
},
$('[role="radiogroup"]').AriaRadio();
callback();
}
- }, openChapters: function (submenu, callback) {
+ },
+
+ openChapters: function (submenu, callback) {
if (this.fluidbook.settings.externalChaptersHTML != '') {
this.openExternalChapters(callback);
return;
callback();
}
this.fluidbook.stats.track(14);
- }, openExternalChapters: function (callback) {
+ },
+ openExternalChapters: function (callback) {
var view = this.getCaption();
view += '<div class="content"><div class="multimediaHolder"><div class="multimediaScale">';
view += '<iframe data-width="' + this.fluidbook.settings.externalChaptersSize.width + '" data-height="' + this.fluidbook.settings.externalChaptersSize.height + '" width="' + this.fluidbook.settings.externalChaptersSize.width + '" height="' + this.fluidbook.settings.externalChaptersSize.height + '" src="data/chapters/index.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe>';
callback();
}
this.fluidbook.stats.track(14);
- }, openIndex: function (title, group, closeAll, callback) {
+ },
+
+ openIndex: function (title, group, closeAll, callback) {
this.index.openIndex(title, group, closeAll, callback);
- }, openArchives: function (title, callback) {
+ },
+
+ openArchives: function (title, callback) {
var archives = this.getCaption(title, true, title === undefined || title === '' ? 'h0' : '');
archives += '<div class="content"><div class="image" id="archivesview"><img src="data/images/' + this.fluidbook.settings.externalArchives + '" /><div class="links">' + this.fluidbook.loader.handleExtension(this.fluidbook.settings.links.archives) + '</div></div></div>';
this.viewWrap(archives, 'archives', '', 'archives');
if (callback != undefined) {
callback();
}
- }, openText: function (text, callback) {
+ },
+
+ openText: function (text, callback) {
var styleMatches = text.match(/\<style\>([^\<]*)<\/style>/);
var style = '';
w = Math.min(w, this.fluidbook.settings.filesInfos.archives.width / 1.5);
}
break;
+ case 'pdf':
+ this.initPDFViewer();
+ iframe = m.find('iframe');
+ let seamless = iframe.hasClass('seamless');
+ var pw = iframe.data('width') * 2;
+ var th = iframe.data('total-height') * 2;
+
+ w = Math.min(pw, ww)
+ fullscreen = (w === ww);
+ ratio = pw / th;
+ ih = w / ratio;
+ h = Math.min(ih, fullscreen ? hh : hh * 0.9);
+
+ let offsetw = seamless ? 40 : 0;
+
+ iframe.css('height', seamless ? ih : h).css('width', w + offsetw);
+ break;
default:
if (m.data('max-width') !== null) {
maxWidth = parseInt(m.data('max-width'));
setTimeout(function () {
$("#viewOverlay").css('opacity', 1);
}, 10);
- }
+ },
+
+ initPDFViewer: function () {
+ var menu = this;
+ $('iframe.pdf.view').each(function () {
+ var page = $(this).contents().find('div.page');
+ if (page.length === 0) {
+ setTimeout(function () {
+ menu.initPDFViewer();
+ }, 200);
+ return;
+ }
+ menu.fluidbook.hideLoader();
+ var body = $(this).contents().find('body');
+ if ($(this).hasClass('seamless')) {
+ $(body).addClass('seamless');
+ }
+ var $this = this;
+ setTimeout(function () {
+ $($this).closest('.pdf-holder').addClass('visible');
+ $($this).addClass('visible');
+ menu.fluidbook.hideLoader();
+ }, 500);
+
+ });
+ },
};