From 4eaa91ff7ca05c6128704ae2aec13d92e68bfbe1 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 1 Oct 2020 19:04:07 +0200 Subject: [PATCH] done #1090 @2 --- js/libs/fluidbook/fluidbook.js | 3 +- js/libs/fluidbook/fluidbook.posad.js | 61 ++++++++++++++++++++++++++++ style/fluidbook.less | 1 + style/posad.less | 12 ++++++ 4 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 js/libs/fluidbook/fluidbook.posad.js create mode 100644 style/posad.less diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 2f152954..47f2d95a 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -84,6 +84,7 @@ Fluidbook.prototype = { this.sound = new FluidbookSound(this); this.slideshow = new FluidbookSlideshow(this); this.printing = new FluidbookPrint(this); + this.posad = new FluidbookPOSAd(this); if (this.settings.basket) { this.cart = new FluidbookCart(this); @@ -1002,7 +1003,7 @@ Fluidbook.prototype = { } // fix #3407 - if (target==='_popupiframe' && Modernizr.ios && url.search(/\.pdf$/) >= 0) { + if (target === '_popupiframe' && Modernizr.ios && url.search(/\.pdf$/) >= 0) { target = '_blank'; } diff --git a/js/libs/fluidbook/fluidbook.posad.js b/js/libs/fluidbook/fluidbook.posad.js new file mode 100644 index 00000000..23a68fd9 --- /dev/null +++ b/js/libs/fluidbook/fluidbook.posad.js @@ -0,0 +1,61 @@ +function FluidbookPOSAd(fluidbook) { + this.fluidbook = fluidbook; + this.enabled = this.fluidbook.settings.plv; + this.direction = 1; + if (this.enabled) { + this.init(); + } +} + +FluidbookPOSAd.prototype = { + init: function () { + // Apply styles (hide mouse, menus, interface) + $('body').addClass('posad'); + // Disable links blinking + this.fluidbook.settings.bookmarkBlinkOnPageChange = this.fluidbook.settings.mobileLinksRevealAnim = false; + // Go to fullscreen in nwjs + if (this.fluidbook.support.nwjs) { + win = nw.Window.get(); + win.enterFullscreen(); + } + // Launch automatic pages turning + var $this = this; + $(this.fluidbook).one('fluidbook.splash.hide', function () { + $this.launch(); + }); + }, + + launch: function () { + var $this = this; + setTimeout(function () { + $this.nextPage(); + }, this.fluidbook.settings.plvTimer * 1000); + }, + + nextPage: function () { + var bv = this.fluidbook.getButtonsVisibility(); + if (this.direction === 1) { + if (bv.next) { + this.fluidbook.goNextPage(); + } else { + if (this.fluidbook.settings.plvMode === 'first') { + this.fluidbook.goFirstPage(); + } else { + this.fluidbook.goPreviousPage(); + this.direction = -1; + } + } + } else { + if (bv.previous) { + this.fluidbook.goPreviousPage(); + } else { + this.fluidbook.goNextPage(); + this.direction = 1; + } + } + var $this = this; + $(this.fluidbook).one('fluidbook.page.change.end', function () { + $this.launch(); + }); + }, +}; \ No newline at end of file diff --git a/style/fluidbook.less b/style/fluidbook.less index 157092f0..3bae7277 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -2930,3 +2930,4 @@ body > input { @import "widget.less"; @import "menu-articles.less"; @import "nointerface.less"; +@import "posad.less"; diff --git a/style/posad.less b/style/posad.less new file mode 100644 index 00000000..205de87b --- /dev/null +++ b/style/posad.less @@ -0,0 +1,12 @@ +body.posad { + cursor: none !important; + + #links .container { + cursor: none !important; + } + + footer, #interface, header, #pagesnumbers { + visibility: hidden; + pointer-events: none; + } +} \ No newline at end of file -- 2.39.5