]> _ Git - fluidbook-html5.git/commitdiff
wip #3827 @4
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 29 Jul 2020 14:24:20 +0000 (16:24 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 29 Jul 2020 14:24:20 +0000 (16:24 +0200)
images/interface.svg
js/libs/fluidbook/fluidbook.articles.js
js/libs/fluidbook/links/fluidbook.links.zoom.js
style/fluidbook.less

index c53dcee2a3bade4f8e6e413f3e35c52465e6eb69..456143ff3c4815007f2fba7c1bb242360e47fca6 100644 (file)
        c0.524-0.446,1.112-0.53,1.678-0.242c0.565,0.288,0.871,0.919,0.773,1.546l-1.094,7.029l6.313,3.243
        C29.863,18.278,30.176,18.903,30.074,19.532z"/>
     </symbol>
-
+    <symbol id="icon-article" viewBox="0 0 25 25">
+        <path d="M19.2,11.7H5.8c-0.4,0-0.7-0.3-0.7-0.7V6.1c0-0.4,0.3-0.7,0.7-0.7h13.3c0.4,0,0.7,0.3,0.7,0.7V11
+                       C19.9,11.4,19.6,11.7,19.2,11.7z M6.5,10.3h11.9V6.8H6.5V10.3z"/>
+        <path d="M19.2,14.6H5.8c-0.4,0-0.7-0.3-0.7-0.7s0.3-0.7,0.7-0.7h13.3c0.4,0,0.7,0.3,0.7,0.7S19.6,14.6,19.2,14.6z"/>
+        <path d="M19.2,17.2H5.8c-0.4,0-0.7-0.3-0.7-0.7s0.3-0.7,0.7-0.7h13.3c0.4,0,0.7,0.3,0.7,0.7S19.6,17.2,19.2,17.2z"/>
+        <path d="M13.1,19.7H5.8c-0.4,0-0.7-0.3-0.7-0.7s0.3-0.7,0.7-0.7h7.2c0.4,0,0.7,0.3,0.7,0.7S13.5,19.7,13.1,19.7z"/>
+        <path d="M21.1,22.6H3.9c-0.9,0-1.6-0.7-1.6-1.6V4.1c0-0.9,0.7-1.6,1.6-1.6h17.2c0.9,0,1.6,0.7,1.6,1.6v16.9
+               C22.7,21.8,22,22.6,21.1,22.6z M3.9,3.9c-0.1,0-0.2,0.1-0.2,0.2v16.9c0,0.1,0.1,0.2,0.2,0.2h17.2c0.1,0,0.2-0.1,0.2-0.2V4.1
+               c0-0.1-0.1-0.2-0.2-0.2H3.9z"/>
+    </symbol>
 </svg>
index 93c018860a82af846b482fb75a881bec467cf669..45a28c7c5a4ceca001515b1f589812a124af0ae5 100644 (file)
@@ -60,6 +60,10 @@ FluidbookArticles.prototype = {
         return res;
     },
 
+    findArticleById: function (id) {
+        return this.fluidbook.settings.articlesList[id];
+    },
+
     isEnabled: function () {
         return Object.keys(this.fluidbook.settings.articlesList).length > 0;
     },
index f8b02dcbed28c15c0b6490efcd508ce3c28d94cd..0444bcd651fc4c72db8f9cb2db4504752ddf94ca 100644 (file)
@@ -18,7 +18,7 @@ FluidbookLinksZoom.prototype = {
         });
 
         $(this.fluidbook).on('fluidbook.zoom.in.end', function () {
-            $this.zoomLinkReset(true);
+            $this.zoomLinkReset(false);
             return true;
         });
 
@@ -197,8 +197,11 @@ FluidbookLinksZoom.prototype = {
                         }
 
                         if (action === 'link') {
-                            menu += 'href="' + data + '"  target="_blank"';
-                            linkClass += ' ext';
+                            var l = $this.getLink(data);
+                            if (l !== undefined) {
+                                menu += 'href="' + l.url + '"  target="' + l.target + '"';
+                                linkClass += ' ext';
+                            }
                         } else if (action === 'copy') {
                             menu += 'data-clipboard-text="' + escapeHtml(data) + '" ';
                         } else if (action === 'video') {
@@ -320,7 +323,6 @@ FluidbookLinksZoom.prototype = {
             // Load image before running zoom up animation
             $this.fluidbook.displayLoader();
             loadImage(zoomImage, function (img) {
-
                 // Image is set as a background for better scaling / fitting via CSS
                 z.css('background-image', 'url(' + img.src + ')');
                 $this.fluidbook.hideLoader();
@@ -333,20 +335,31 @@ FluidbookLinksZoom.prototype = {
                         boxShadow: '0 0 100px rgba(0,0,0,0.3)',
                         transform: 'translateX(' + zoomX + 'px) translateY(' + zoomY + 'px) scale(1)'
                     });
-
                     setTimeout(function () {
                         $this.resizeZoomLinkBackground(true);
                     }, 600);
-
                 }, 50);
 
-
                 $this.fluidbook.stats.track(2, $this.fluidbook.currentPage);
             });
 
         });
     },
 
+    getLink: function (url) {
+        var e = url.split(':', 2);
+        if (e.length === 1 || e[0] === 'http' || e[1] === 'https') {
+            return {url: url, target: '_blank'};
+        }
+
+        if (e[0] === 'article') {
+            var a = this.fluidbook.articles.findArticleById(e[1]);
+            if (a !== undefined) {
+                return {url: '#/article/' + a.url, target: '_self'};
+            }
+        }
+    },
+
     resizeZoomLinkBackground: function (show) {
         var top, left, bottom, right, width, height, hpadding, vpadding;
 
@@ -393,10 +406,6 @@ FluidbookLinksZoom.prototype = {
         $("#zoomPopupMenuWrapper").css({left: left, top: top + height, width: width, opacity: show ? 1 : 0});
     },
 
-    zoomLinkClose: function (immediate) {
-        return this.zoomLinkReset(immediate);
-    },
-
     zoomLinkReset: function (immediate) {
 
         var $this = this;
index fc3afa1df4711be21c0f87b21bd6a0676d3818b5..21c7b30f64b14b5aa1edf000c4e9ffd6afbfb11b 100644 (file)
@@ -1416,7 +1416,7 @@ html.ios body.portrait #interface {
   left: 0;
   width: 100%;
   height: 100%;
-  z-index: 21;
+  z-index: 41;
   cursor: pointer; // Needed or click events don't work on iOS (see: https://stackoverflow.com/a/16006333)
   .overlayBackground();
 }
@@ -1431,7 +1431,7 @@ html.ios body.portrait #interface {
   position: absolute;
   top: 0;
   left: 0;
-  z-index: 22;
+  z-index: 42;
   display: none;
   overflow: hidden;
   background-repeat: no-repeat;
@@ -2063,7 +2063,7 @@ ul.chapters.shareList a.level0 .svg-icon {
   position: absolute;
   top: 0px;
   left: 0px;
-  z-index: 30;
+  z-index: 40;
   display: none;
 
   > div {
@@ -2436,7 +2436,7 @@ ul.chapters.shareList a.level0 .svg-icon {
   position: absolute;
   top: 0;
   left: 0;
-  z-index: 40;
+  z-index: 140;
   width: 100%;
   height: 100%;
 
@@ -2528,7 +2528,7 @@ ul.chapters.shareList a.level0 .svg-icon {
   left: 0;
   width: 100%;
   height: 100%;
-  z-index: 100;
+  z-index: 30;
   display: none;
   .overlayBackground();
 }
@@ -2539,7 +2539,7 @@ ul.chapters.shareList a.level0 .svg-icon {
 
 #zoomPopupBackground {
   position: absolute;
-  z-index: 100;
+  z-index: 30;
   opacity: 0;
   transition: opacity 150ms;
 
@@ -2552,7 +2552,7 @@ ul.chapters.shareList a.level0 .svg-icon {
 
 #zoomPopupMenuWrapper {
   position: absolute;
-  z-index: 101;
+  z-index: 31;
   transition: opacity 150ms;
 
   #zoomPopupMenu {
@@ -2630,7 +2630,7 @@ ul.chapters.shareList a.level0 .svg-icon {
   width: @zoom-close-button-size;
   height: @zoom-close-button-size;
   padding: unit((@zoom-close-button-size/30)*11, px);
-  z-index: 103;
+  z-index: 33;
   .button-hover();
   color: @menu-text;
   opacity: 1;
@@ -2655,7 +2655,7 @@ ul.chapters.shareList a.level0 .svg-icon {
   transition: all 0.5s;
   transform-origin: 0 0;
   position: absolute;
-  z-index: 101;
+  z-index: 31;
 
   img {
     position: absolute;
@@ -2664,7 +2664,7 @@ ul.chapters.shareList a.level0 .svg-icon {
     width: 100%;
     height: 100%;
     display: block;
-    z-index: 102;
+    z-index: 32;
   }
 
 
@@ -2767,7 +2767,7 @@ body > input {
   opacity: 0;
   pointer-events: none;
   transition: opacity 0.3s ease-in;
-  z-index: 30;
+  z-index: 45;
   position: absolute;
   top: 0;
   left: 0;