]> _ Git - fluidbook-html5.git/commitdiff
done #1090 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Oct 2020 17:04:07 +0000 (19:04 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Oct 2020 17:04:07 +0000 (19:04 +0200)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.posad.js [new file with mode: 0644]
style/fluidbook.less
style/posad.less [new file with mode: 0644]

index 2f15295418bdc4e93a24f51fdcd4afff3970ae5c..47f2d95a95bbfa4297b62ffbd92837e47851b9d8 100644 (file)
@@ -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 (file)
index 0000000..23a68fd
--- /dev/null
@@ -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
index 157092f06646f0adacc50ea8bb849709ed8e2695..3bae7277ba4b32c66c3847fcf80564c24e08a622 100644 (file)
@@ -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 (file)
index 0000000..205de87
--- /dev/null
@@ -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