]> _ Git - fluidbook-html5.git/commitdiff
wait #4400 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 13 Apr 2021 10:30:32 +0000 (12:30 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 13 Apr 2021 10:30:32 +0000 (12:30 +0200)
js/libs/fluidbook/fluidbook.links.js

index b9cbaba5f4dfb330519615bb060c9a633f266dcb..7da4edadc9abc278bae6d2cca42f2b9fbdec0a2e 100644 (file)
@@ -49,7 +49,7 @@ FluidbookLinks.prototype = {
         });
 
         $(document).on('click touchend', '[data-id] a', function () {
-            var id=$(this).closest('[data-id]').attr('data-id');
+            var id = $(this).closest('[data-id]').attr('data-id');
             $this.fluidbook.contentlock.addAction(id, 'click');
             $this.fluidbook.gamify.linkClicked(id);
             return true;
@@ -198,7 +198,7 @@ FluidbookLinks.prototype = {
             var close = $(this).data('showclose');
             $('div.link[data-id$="' + showid + '"]').each(function () {
                 var l = this;
-                if(close!=='none') {
+                if (close !== 'none') {
                     $(l).append('<a href="#" class="linkshowclose ' + close + '"></a>');
                 }
                 $(l).show();
@@ -314,7 +314,7 @@ FluidbookLinks.prototype = {
         return u.href;
     },
 
-    showLinkById:function(id) {
+    showLinkById: function (id) {
         var s = $('div.link[data-id="' + id + '"]');
         s.show();
         setTimeout(function () {
@@ -323,7 +323,7 @@ FluidbookLinks.prototype = {
 
     },
 
-    hideLinkById:function(id) {
+    hideLinkById: function (id) {
         var s = $('div.link[data-id="' + id + '"]');
         if ($(s).attr('data-hidden') != '1') {
             $(s).attr('data-hidden', '1').addClass('show');
@@ -854,13 +854,20 @@ FluidbookLinks.prototype = {
     resize: function () {
         var $this = this;
         $("#links .link.iframe").each(function () {
+            var iframe = $(this).find("iframe");
+            var scale = $(iframe).data('scale');
             var w = $(this).outerWidth();
             var h = $(this).outerHeight();
             var iw = w * $this.fluidbook.resize.bookScale;
             var ih = h * $this.fluidbook.resize.bookScale;
-            $(this).find("iframe").attr("width", iw)
-                .attr('height', ih)
-                .css({width: iw, height: ih, transform: 'scale(' + (1 / $this.fluidbook.resize.bookScale) + ')'});
+            if (scale !== 'no') {
+                if(scale==='auto') {
+                    scale = (1 / $this.fluidbook.resize.bookScale);
+                }
+                $(iframe).attr("width", iw)
+                    .attr('height', ih)
+                    .css({width: iw, height: ih, transform: 'scale(' + scale + ')'});
+            }
         });
     },