]> _ Git - fluidbook-html5.git/commitdiff
fix #2505 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Jan 2019 18:02:27 +0000 (19:02 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Jan 2019 18:02:27 +0000 (19:02 +0100)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.links.js
js/libs/fluidbook/fluidbook.menu.js

index d0b1c0dcccbf58d5d0e4fc01f056c6fb6d779edb..9e0e70c6c11a7a5691187c54b61ab82ff5f2d265 100644 (file)
@@ -425,9 +425,8 @@ Fluidbook.prototype = {
             }
         } else {
             var view = args[1];
-            if (this.currentPage == -1) {
-                if (view == 'multimedia' || view == 'video') {
-                    var $this = this;
+            if (this.currentPage === -1) {
+                if (view === 'multimedia' || view === 'video' || view === 'iframe') {
                     var searchURL = args.join('/');
                     $.each(this.datas.links, function (pageNr, links) {
                         var hl = $('<root>' + links + '</root>');
@@ -436,13 +435,13 @@ Fluidbook.prototype = {
                             return false;
                         }
                     });
-                    if (this.currentPage == -1) {
+                    if (this.currentPage === -1) {
                         this.currentPage = 0;
                     }
                 } else {
                     this.currentPage = 0;
                 }
-                $this.pageTransition(this.currentPage);
+                $this.pagetransitions.pageTransition(this.currentPage);
             }
             this.menu.openView(view, args[2], args[3], function () {
                 $this.hideSplash();
index 0d5fee710af0bfb00a099b9ac2870a51ab7a55b6..0f2ead8eb71d20c7291fbae8a53851ff7da84129 100644 (file)
@@ -222,6 +222,16 @@ FluidbookLinks.prototype = {
         return this.fluidbook.datas.linksData[uid];
     },
 
+    getLinkByHref: function (href) {
+        for (var i = 1; i <= this.fluidbook.datas.pages; i++) {
+            var res = $(this.fluidbook.datas.links[i]).find('a[href="' + href + '"]');
+            if (res.length > 0) {
+                return res.eq('0');
+            }
+        }
+        return null;
+    },
+
     animateLinks: function (linksContainer, additionalDelay) {
         var container = $(document);
         if (linksContainer !== undefined) {
index bc2b47cfe52fd62205ec6819989dd4af7d73766c..5a60fa7a738b1e2f165ff04ee17091a12f95f808 100644 (file)
@@ -179,7 +179,11 @@ FluidbookMenu.prototype = {
 
     openIframe: function (iframe, callback) {
         var $this = this;
-        var a = $('a[href="#/iframe/' + iframe + '"]');
+        var href = '#/iframe/' + iframe;
+        var a = $('a[href="' + href + '"]');
+        if ($(a).length === 0) {
+            a = this.fluidbook.links.getLinkByHref(href);
+        }
         var markup = decodeURIComponent($(a).attr('data-iframe'));
         var view = '<div class="caption">' + this.closeButton() + '</div>';
         view += '<div class="content noscroll"><div class="iframeHolder">';
@@ -631,7 +635,7 @@ FluidbookMenu.prototype = {
                 if (!fullscreen) {
                     var ih = -1;
                     try {
-                        ih = $(iframe).get(0).contentWindow.document.body.offsetHeight;
+                        ih = $(iframe).get(0).contentWindow.document.body.getBoundingClientRect().bottom;
                     } catch (e) {
                         ih = -1;
                     }
@@ -640,7 +644,6 @@ FluidbookMenu.prototype = {
                         h = Math.min(ih, h);
                     }
                 }
-
                 break;
             case 'cart':
                 w = 1024;