]> _ Git - fluidbook-html5.git/commitdiff
wip #1388 @4
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Jun 2017 14:05:11 +0000 (16:05 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Jun 2017 14:05:11 +0000 (16:05 +0200)
js/libs/fluidbook/fluidbook.bookmarks.js
js/libs/fluidbook/fluidbook.links.js
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/fluidbook.utils.js
js/main.js
style/fluidbook.less

index 13753a4ed51a5d0e0dd7f3fd8bd433e75b9d6f47..18b9fda7688de0019d1002699b0385699752c0d5 100644 (file)
@@ -442,11 +442,11 @@ FluidbookBookmarks.prototype = {
         index += '</div>';
         index += '<div class="fonctions">';
         if (this.fluidbook.datas.friend) {
-            index += '<a class="send miniOnPortrait" href="#"><span class="hideOnPortrait">' + this.fluidbook.l10n.__('send') + '</span></a>';
+            index += '<a class="send" href="#">' + this.fluidbook.l10n.__('send') + '</a>';
 
         }
         if (this.fluidbook.datas.print || this.fluidbook.datas.pdf) {
-            index += '<a class="print miniOnPortrait" href="#"><span class="hideOnPortrait">' + this.fluidbook.l10n.__('download') + '</span></a>';
+            index += '<a class="print" href="#">' + this.fluidbook.l10n.__('download') + '</a>';
         }
         index += '</div>';
         index += '</div>';
index 0613a3005b95f8b0e498feaab4d87335a91c140f..3374bcee313f04a9abc03080f335fc334ce7d152 100644 (file)
@@ -29,7 +29,7 @@ FluidbookLinks.prototype = {
         });
 
         $(document).on('click touchend', '#zoomPopupOverlay, #zoomPopupWrapper', function (e) {
-            console.log('closing zoomPopup...');
+
             $this.zoomLinkReset();
         });
 
@@ -109,15 +109,21 @@ FluidbookLinks.prototype = {
             $link = $(link),
             box = $link[0].getBoundingClientRect(),
             parent = $link.closest('.link'),
-            linkId = $(parent).attr('id').split('_', 2)[1],
             maxZoom = parseInt($link.data('maxzoom')) || 2,
-            zoomImage = 'data/links/zoom_' + linkId + '.jpg',
             x,
             y,
             zoomWidth,
             zoomHeight,
             zoomScale;
 
+        if ($(parent).length == 0) {
+            return;
+        }
+
+        var linkId = $(parent).attr('id').split('_', 2)[1];
+        var zoomImage = 'data/links/zoom_' + linkId + '.jpg';
+
+
         // Calculate best scale factor to fit and also to honour the maxZoom level
         zoomScale = Math.min((availableWidth / box.width), (availableHeight / box.height), maxZoom);
 
@@ -148,7 +154,7 @@ FluidbookLinks.prototype = {
             z.show();
 
             var s = (zoomWidth / box.width);
-            $(".zoomPopupClose").css('opacity', 1).transform({scale: 1 / s, origin: ['100%', '0', 0]});
+            $(".zoomPopupClose").css('opacity', 0).transform({scale: 1 / s, origin: ['100%', '0', 0]});
             setTimeout(function () {
                 z.css({
                     boxShadow: '0 0 100px rgba(0,0,0,0.3)',
@@ -156,6 +162,10 @@ FluidbookLinks.prototype = {
                 });
             }, 50);
 
+            setTimeout(function () {
+                $(".zoomPopupClose").css('opacity', '');
+            }, 500);
+
             z.data('scale', zoomScale);
             // Show overlay
             $('body').addClass('zoomPopup');
@@ -172,6 +182,8 @@ FluidbookLinks.prototype = {
         var z = $('#zoomPopupWrapper'),
             scale = z.data('scale');
 
+        $(".zoomPopupClose").css('opacity', '0');
+
         z.css({
             transform: 'translate(0,0) scale(1)',
             boxShadow: '0 0 0 rgba(0,0,0,0.3)',
@@ -186,7 +198,6 @@ FluidbookLinks.prototype = {
         // ToDo: see https://davidwalsh.name/css-animation-callback
         setTimeout(function () {
             $('#zoomPopupWrapper').hide();
-            $(".zoomPopupClose").css('opacity', 0);
             $('body').removeClass('zoomPopup');
         }, 500);
 
index cd2d92beadba71918c64e10b22af453633b4bbad..85c099ddb5abd7a243db920e64fab7c3d95dc243 100644 (file)
@@ -382,6 +382,7 @@ FluidbookMenu.prototype = {
     }
     ,
     closeView: function (callback, all, animate) {
+        blur();
         $("#viewOverlay").hide();
         var $this = this;
         if (all == undefined) {
@@ -467,6 +468,9 @@ FluidbookMenu.prototype = {
             case 'bookmarks':
                 var max = Math.floor((ww * 0.8) / 120) * 120 + 40;
                 w = Math.min(max, Math.max(m.find('.doubleThumb').length, 4) * 120 + 40);
+                if (ww < 520) {
+                    fullscreen = true;
+                }
                 break;
             case 'webvideo':
                 var w = Math.max(ww * 0.8, 600);
index 252996f45825be54b854fad649f07bdca92d4bbe..48b2301673af64e999d3db56c2be8e66a1a1a18a 100644 (file)
@@ -54,10 +54,19 @@ function getSpriteIcon(icon, attrs) {
         attrs = {};
     }
     if (attrs.viewBox == null) {
-        attrs.viewBox = $('svg symbol#'+icon).get(0).attributes.viewBox.value;
+        attrs.viewBox = $('svg symbol#' + icon).get(0).attributes.viewBox.value;
     }
     $.each(attrs, function (k, v) {
         a.push(k + '="' + v + '"');
     });
     return '<svg ' + a.join(' ') + '><use xlink:href="#' + icon + '" /></svg>';
+}
+
+function blur() {
+    if ($(":focus").length > 0) {
+        var tmp = document.createElement("input");
+        document.body.appendChild(tmp);
+        tmp.focus();
+        document.body.removeChild(tmp);
+    }
 }
\ No newline at end of file
index 88f805899417cdb1ecac9c52e3405b94b1452b9e..0d8dfe36c73c5010a1f3c91b5bd2a904b796142b 100644 (file)
@@ -414,8 +414,7 @@ try {
         $(document).on('click', '.share', function () {
             var f = 'send' + ucfirst($(this).data('service'));
             fluidbook[f]();
-            fluidbook.menu.closeView(function () {
-            }, false);
+            $(this).closest('.mview').find('.back').click();
             return false;
         });
 
index d1cd412a599f2d58257465c10291bdb51bc312e6..ad1837998011bcc5d2dade46a2fbdfd5670cd89e 100644 (file)
@@ -870,7 +870,7 @@ footer.hidden, header.hidden, #interface.hidden {
                }
        }
 
-       &[data-menu="video"] {
+       &[data-menu="webvideo"] {
                iframe {
                        width: 100%;
                        height: 100%;
@@ -893,6 +893,19 @@ footer.hidden, header.hidden, #interface.hidden {
                }
        }
 
+       &.fs {
+               .fonctions {
+                       padding: 0 @menu-padding @menu-padding @menu-padding;
+                       a {
+                               display: block;
+                               margin: 0 0 10px 0;
+                               &:last-child {
+                                       margin: 0;
+                               }
+                       }
+               }
+       }
+
        &[data-chapters] {
                max-width: 320px;
        }
@@ -1340,6 +1353,7 @@ ul.chapters.shareList a.level0 img {
 }
 
 /* Videos */
+
 .mview .videoContainer {
        width: 100%;
        height: 100%;
@@ -1829,6 +1843,12 @@ a.button {
        cursor: pointer;
        z-index: 101;
 
+       &:hover {
+               .zoomPopupClose {
+                       opacity: 1;
+               }
+       }
+
        img {
                position: absolute;
                top: 0;
@@ -1840,13 +1860,13 @@ a.button {
        }
        .zoomPopupClose {
                position: absolute;
-               top: 4px;
-               right: 4px;
-               width: 30px;
-               height: 30px;
+               top: 0px;
+               right: 0px;
+               width: 60px;
+               height: 60px;
                z-index: 103;
-               padding: 6px;
-               border-radius: 50%;
+               padding: 22px;
+               background-color: @menu-button-background;
                opacity: 0;
                transition: opacity 250ms;
        }