]> _ Git - fluidbook-html5.git/commitdiff
wait #2645 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Mar 2019 10:47:12 +0000 (11:47 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Mar 2019 10:47:12 +0000 (11:47 +0100)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.print.js

index 4579371454070bb794f888c42bc788e650712f6b..4f337e114bc941f910d95b039c2e49be84b588a2 100644 (file)
@@ -725,7 +725,6 @@ Fluidbook.prototype = {
     ,
 
     _openFile: function (url, e, type, localname, print) {
-
         if (print === undefined) {
             print = false;
         }
@@ -752,8 +751,22 @@ Fluidbook.prototype = {
                 w.print();
             }, 2000);
         }
-    }
-    ,
+    },
+
+    _openFilePreload: function (url, e, type, localname, print) {
+        var $this = this;
+        this.displayLoader();
+        $.ajax({
+            url: url,
+            type: 'HEAD',
+            success: function (data) {
+                $this._openFile(url, e, type, localname, print);
+                $this.hideLoader(1, true);
+            },
+        });
+
+    },
+
     _downloadFilePhonegap: function (url, localname, fs, callback, callbackArgs) {
         console.log('download file phonegap');
         var $this = this;
index 8427b39c7cd64048fb99bb412798f96cdad032c4..9491362ef4d445aa983dccdde6743ef9886a4b3a 100644 (file)
@@ -24,14 +24,14 @@ FluidbookPrint.prototype = {
 
             switch (choice) {
                 case 'left':
-                    $this.fluidbook._openFile(dynamicPDF + leftPageNumber, element, 'pdf', leftPageNumber + '.pdf', print);
+                    $this.fluidbook._openFilePreload(dynamicPDF + leftPageNumber, element, 'pdf', leftPageNumber + '.pdf', print);
                     break;
                 case 'right':
-                    $this.fluidbook._openFile(dynamicPDF + rightPageNumber, element, 'pdf', rightPageNumber + '.pdf', print);
+                    $this.fluidbook._openFilePreload(dynamicPDF + rightPageNumber, element, 'pdf', rightPageNumber + '.pdf', print);
                     break;
                 case 'double':
                     var pageRange = leftPageNumber + '-' + rightPageNumber;
-                    $this.fluidbook._openFile(dynamicPDF + pageRange, element, 'pdf', pageRange + '.pdf', print);
+                    $this.fluidbook._openFilePreload(dynamicPDF + pageRange, element, 'pdf', pageRange + '.pdf', print);
                     break;
                 case 'all':
                     $this.fluidbook.openPDF(element, print);
@@ -52,7 +52,7 @@ FluidbookPrint.prototype = {
                         return false;
                     }
                     var pageRange = rangeStart + '-' + rangeEnd;
-                    $this.fluidbook._openFile(dynamicPDF + pageRange, element, 'pdf', pageRange + '.pdf', print);
+                    $this.fluidbook._openFilePreload(dynamicPDF + pageRange, element, 'pdf', pageRange + '.pdf', print);
                     break;
                 default:
                     return false;