if (!this.isEnabled()) {
return;
}
+
+ var $this = this;
+ $(this.fluidbook).on('fluidbook.resize', function () {
+ console.log('resize');
+ $this.resize();
+ });
+
+ $(document).on('click', '.mview[data-menu="article"] .print', function () {
+ var a = $(this).closest('article').attr('data-id');
+ var print_window = window.open('', 'print_article', 'height=400,width=600');
+ print_window.document.write($this.fluidbook.settings.articlesList[a].print);
+ setTimeout(function () {
+ print_window.focus();
+ print_window.print();
+ print_window.close();
+ }, 1000);
+ return false;
+ });
+ },
+
+ openArticle: function (url, callback) {
+ var article = this.findArticleByURL(url);
+ if (article === null) {
+ callback();
+ }
+
+ var footer = '<div class="footer fixed"><a href="#/article/' + article.prev + '" class="article-prev">' + getSpriteIcon('interface-previous-simple') + ' ' + this.fluidbook.l10n.__('previous article') + '</a><a href="#/article/' + article.next + '" class="article-next">' + this.fluidbook.l10n.__('next article') + ' ' + getSpriteIcon('interface-next-simple') + '</a></div>';
+ var view = '<div class="content">' + article.contents + '</div>' + footer;
+ $("#view").html('<div class="mview" data-menu="article">' + view + '</div>');
+
+ this.fluidbook.silentChangePage(article.page);
+ callback();
+ },
+
+ findArticleByURL: function (url) {
+ var res = null;
+ $.each(this.fluidbook.settings.articlesList, function (k, v) {
+ if (v.url === url) {
+ res = v;
+ return false;
+ }
+ });
+ return res;
},
isEnabled: function () {
- return this.fluidbook.settings.articlesList.length>0;
- }
+ return Object.keys(this.fluidbook.settings.articlesList).length > 0;
+ },
+
+ resize: function () {
+
+ },
}
\ No newline at end of file
this.openPrint(cb);
} else if (view === 'download') {
this.openDownload(cb);
+ } else if (view === 'article') {
+ this.fluidbook.articles.openArticle(param1, cb);
} else {
this['open' + camelView](param1, param2, cb);
}
var forceHeight = false;
var fullscreen = m.data('fullscreen') === '1';
var nw, nh;
- var hasCaption = true;
$("#viewOverlay").css({width: ww, height: hh});
switch (m.data('menu')) {
case 'chapters':
- hasCaption = this.fluidbook.settings.chaptersCaptionDisplay !== false;
this.fluidbook.settings.chaptersColumns = Math.max(1, Math.min(6, this.fluidbook.settings.chaptersColumns));
if (this.fluidbook.settings.chaptersCascade) {
this.fluidbook.settings.chaptersColumns = 1;
case 'locales':
w = 300;
break;
+ case 'article':
+ h = hh * 0.9;
+ w = Math.min(ww,1000);
+ if(ww<800){
+ w=ww;
+ h=hh;
+ fullscreen=true;
+ }
+ break;
case 'iframe':
w = ww * 0.8;
if (parseInt(this.fluidbook.settings.iframePopupMaxWidth) > 0) {
if (optimizeHeight) {
thumbnailsHeight = 0;
var contentHeight = h;
- hasCaption = false;
}
var slideMaxHeight = h - headerHeight - thumbnailsHeight; // Remaining height that main image + caption has to fit into
break;
}
- var captionHeight = m.find('.caption').outerHeight();
+ var captionHeight = 0;
+ m.find('.caption, .fixed').each(function () {
+ captionHeight += $(this).outerHeight();
+ })
+
css = {};
ccss = {};
if (fullscreen) {
} else {
m.removeClass('fs');
}
+
css.maxWidth = css.minWidth = css.width = w;
css.maxHeight = h;
- if (hasCaption) {
- ccss.maxHeight = h - captionHeight;
- } else {
- ccss.maxHeight = h;
- }
+
+ ccss.maxHeight = h - captionHeight;
if (forceHeight) {
css.minHeight = css.height = h;
if (contentHeight === undefined) {
- if (hasCaption) {
- ccss.minHeight = ccss.height = h - captionHeight;
- } else {
- ccss.minHeight = ccss.height = h;
- }
+ ccss.minHeight = ccss.height = h - captionHeight;
// if (m.find('.fonctions').length > 0) {
// ccss.height -= m.find('.fonctions').outerHeight();
} else {
ccss.minHeight = ccss.height = css.minHeight = css.height = '';
}
+
m.css(css);
m.find(".content").css(ccss).attr('data-height', ccss.height);
if (!fullscreen) {