]> _ Git - fluidbook-html5.git/commitdiff
wait #6876 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 24 Apr 2024 10:53:41 +0000 (12:53 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 24 Apr 2024 10:53:41 +0000 (12:53 +0200)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.links.js
js/libs/fluidbook/fluidbook.loader.js
js/libs/fluidbook/fluidbook.nav.js

index 55e9b168073e456d859d45566611e7b15a9f7000..a47552f4caa1073a51f88ee256cbf15840626fa5 100644 (file)
@@ -803,13 +803,18 @@ Fluidbook.prototype = {
         var rand = Math.round(Math.random() * 100000);
         this.waiters.push(rand);
         return rand;
-    }, waiterActive: function (id) {
+    },
+    waiterActive: function (id) {
         return this.waiters.indexOf(id) > -1;
-    }, resetWaiters: function () {
+    },
+    resetWaiters: function () {
         this.waiters = [];
-    }, physicalToVirtual: function (page) {
+    },
+    physicalToVirtual: function (page) {
         return this.settings.numerotation[page - 1];
-    }, virtualToPhysical: function (page) {
+    },
+
+    virtualToPhysical: function (page) {
         if (page === undefined) {
             return false;
         }
index 9ce35480f0ef647abffceb00b4e1c146545f62c6..1de7647464e85f30b1ac15d7e7c2fa736cc94ef8 100644 (file)
@@ -469,7 +469,7 @@ FluidbookLinks.prototype = {
         });
 
         $(document).on(this.fluidbook.input.clickEvent, '[data-action]', function () {
-            var map = {'pdf': 'print', 'fullScreen': "fullscreen", 'locales': 'localesContainers', 'basket': 'cart'};
+            var map = {'fullScreen': "fullscreen", 'locales': 'localesContainers', 'basket': 'cart'};
             var action = $(this).data('action');
             var extra = $(this).data('extra');
 
@@ -481,6 +481,15 @@ FluidbookLinks.prototype = {
                 return true;
             }
 
+            if (action === 'pdf') {
+                $this.fluidbook.nav.clickDownloadIcon();
+                return false;
+            }
+            if (action === 'print') {
+                $this.fluidbook.nav.clickPrintIcon();
+                return false;
+            }
+
             if (map[action]) {
                 action = map[action];
             }
index 3aa8e863dc61fd3153dc2d7e27df08c733d1dd44..0d57815ed57a9f9354f6c4b28ea1ba3926b8bfda 100644 (file)
@@ -1071,8 +1071,6 @@ FluidbookLoader.prototype = {
                 $this.renderSVGToCanvas(page, ctx, cw, ch, callback);
             }, 500);
         }
-
-
         //
         // let textThickness = parseFloat($this.fluidbook.settings.textsThickness);
         //
index 5bc67bb78d9aaf5e28aca4097d4be9ae64d05b39..a2f5ec89460a290c26615e73d1c50599f5988aea 100644 (file)
@@ -170,6 +170,7 @@ FluidbookNav.prototype = {
         }
         return $("#" + elementID).get(0);
     },
+
     getLink: function (name, href, id, title, help, className, showIcon, navType, keyboardShortcut) {
         if (showIcon === undefined) {
             showIcon = true;
@@ -720,25 +721,13 @@ FluidbookNav.prototype = {
         // Download icon
         $(document).on(this.fluidbook.input.clickEvent, '.icon-download', function (event) {
             event.preventDefault();
-
-            // Should we show complex PDF download options? Or just give them the full PDF?
-            if ($this.fluidbook.settings.pdfComplex && $this.fluidbook.settings.phonegap === false) {
-                $this.fluidbook.menu.openView('download');
-            } else {
-                $this.fluidbook.downloadPDF($(this));
-            }
-
+            $this.clickDownloadIcon();
             return false;
         });
 
         // Print icon
         $(document).on(this.fluidbook.input.clickEvent, '.icon-print', function () {
-            if (!$this.fluidbook.printing.advancedPrint()) {
-                $this.fluidbook.print($(this));
-                return false;
-            } else {
-                $this.fluidbook.menu.openView('print');
-            }
+            $this.clickPrintIcon();
             return false;
         });
 
@@ -757,6 +746,24 @@ FluidbookNav.prototype = {
         }
     },
 
+    clickPrintIcon: function () {
+        if (!this.fluidbook.printing.advancedPrint()) {
+            this.fluidbook.print($(this));
+        } else {
+            this.fluidbook.menu.openView('print');
+        }
+    },
+
+    clickDownloadIcon: function () {
+        // Should we show complex PDF download options? Or just give them the full PDF?
+        if (this.fluidbook.settings.pdfComplex && this.fluidbook.settings.phonegap === false) {
+            this.fluidbook.menu.openView('download');
+        } else {
+            this.fluidbook.downloadPDF($(this));
+        }
+
+    },
+
     initFullScreen: function () {
         var $this = this;