]> _ Git - fluidbook-html5.git/commitdiff
wip #2303 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Dec 2018 19:25:34 +0000 (20:25 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Dec 2018 19:25:34 +0000 (20:25 +0100)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.links.js
js/libs/fluidbook/fluidbook.nav.js

index ef219dd1b352bc447d188767f36cf65773a69fd5..24e999224f0ee3e5b149b1db90e5aa62f1136336 100644 (file)
@@ -626,11 +626,9 @@ Fluidbook.prototype = {
         var pdf;
         var pdfName;
 
-        console.log('open PDF : ' + this.datas.pages + " || " + this.contentlock.getMaxPage());
-
         if (this.datas.pages != this.contentlock.getMaxPage()) {
             pdf = 'https://workshop.fluidbook.com/s/e/' + this.datas.cid + '/1-' + this.contentlock.getMaxPage();
-        } else if (this.datas.pdfName.substr(0, 4) == 'http') {
+        } else if (this.datas.pdfName.substr(0, 4) === 'http') {
             pdf = this.datas.pdfName;
         } else {
             pdf = this.relativeToAbsolute('data/' + this.datas.pdfName);
@@ -654,7 +652,7 @@ Fluidbook.prototype = {
                 type = e.pop();
             }
 
-            if (url.indexOf('http') == 0) {
+            if (url.indexOf('http') === 0) {
                 return this._downloadFilePhonegap(url, localname, window.TEMPORARY, this._openFilePhonegap, [url, e, type]);
             } else {
                 if (this._openFilePhonegap(url, e, type)) {
@@ -717,7 +715,7 @@ Fluidbook.prototype = {
         if (this.datas.phonegap === 'ios') {
             console.log('open download on ios ' + type + ' -> ' + types_ios[type]);
             this.displayLoader();
-            if (types_ios[type] != undefined) {
+            if (types_ios[type] !== undefined) {
                 console.log('intro to open with External file util');
 
                 try {
index 6f0ccec0e69045e2a4f2d530bf5b3c195147965f..0d5fee710af0bfb00a099b9ac2870a51ab7a55b6 100644 (file)
@@ -80,8 +80,8 @@ FluidbookLinks.prototype = {
                 target = '_self';
             }
             var href = $(this).attr('href');
-            var external = href.substr(0, 4) == 'http';
-            if (href == '#') {
+            var external = href.substr(0, 4) === 'http';
+            if (href === '#') {
                 return true;
             }
 
@@ -93,11 +93,17 @@ FluidbookLinks.prototype = {
                 return false;
             }
 
-            if ($(this).data('type') == 16 && external) {
+            if ($(this).data('type') === 16 && external) {
                 target = '_system';
             }
 
-            if (target == '_self') {
+            if ($this.fluidbook.datas.phonegap === 'android' && $(this).data('type') === 16 && !external) {
+                var url = $(this).attr('href')
+                $this.fluidbook._openFile($this.fluidbook.relativeToAbsolute(url), $("body"), 'pdf');
+                return;
+            }
+
+            if (target === '_self') {
                 return true;
             }
             fluidbook.wopen($(this).attr('href'), target);
index ac7110718331bc2f76c4eafe6bb31370e2eb06bb..ebbcdccc6a7ede5c80926158935ebc2f96e8ea5c 100644 (file)
@@ -414,7 +414,7 @@ FluidbookNav.prototype = {
             } else if (icon == 'pdf' && this.fluidbook.datas.pdf) {
                 link = this.addLink(navType, 'nav-download', '#', 'download', 'download', 'download');
             } else if (icon == 'print' && this.fluidbook.datas.print) {
-                link = this.addLink(navType, 'nav-print', '#/print', 'print', 'print', 'print');
+                link = this.addLink(navType, 'nav-print', '#', 'print', 'print', 'print');
             } else if (icon == 'basket' && this.fluidbook.cart != undefined && this.fluidbook.cart.enabled) {
                 link = this.addLink(navType, 'nav-basket', '#/cart', 'cart', 'basket', 'basket');
                 $(this.fluidbook).on('fluidbook.cart.updateIcon', {link: $(link).attr('id')}, function (e, data) {
@@ -698,7 +698,7 @@ FluidbookNav.prototype = {
             event.preventDefault();
 
             // Should we show complex PDF download options? Or just give them the full PDF?
-            if ($this.fluidbook.datas.pdfComplex) {
+            if ($this.fluidbook.datas.pdfComplex && this.datas.phonegap === false) {
                 $this.fluidbook.menu.openView('download');
             } else {
                 $this.fluidbook.downloadPDF($(this));
@@ -708,10 +708,15 @@ FluidbookNav.prototype = {
         });
 
         // Print icon
-        // $(document).on('click', '.icon-print', function () {
-        //     $this.fluidbook.print($(this));
-        //     return false;
-        // });
+        $(document).on('click', '.icon-print', function () {
+            if ($this.fluidbook.datas.phonegap !== false) {
+                $this.fluidbook.print($(this));
+                return false;
+            } else {
+                $this.fluidbook.menu.openView('print');
+            }
+            return false;
+        });
 
         // Bookmarks icon
         $(document).on('click', '.icon-bookmarks', function () {