From df481696be04c6760b868fda2b37c289b3355c51 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 5 Jun 2020 14:42:06 +0200 Subject: [PATCH] wait #3679 @1.5 --- images/interface.svg | 27 +++++++ js/libs/clipboard.min.js | 7 ++ js/libs/fluidbook/fluidbook.links.js | 5 ++ .../fluidbook/links/fluidbook.links.zoom.js | 79 ++++++++++++++----- style/fluidbook.less | 4 + 5 files changed, 103 insertions(+), 19 deletions(-) create mode 100644 js/libs/clipboard.min.js diff --git a/images/interface.svg b/images/interface.svg index c8bfc203..d14f49a0 100644 --- a/images/interface.svg +++ b/images/interface.svg @@ -66,6 +66,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/js/libs/clipboard.min.js b/js/libs/clipboard.min.js new file mode 100644 index 00000000..28650f3c --- /dev/null +++ b/js/libs/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v2.0.6 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return o={},r.m=n=[function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o'); if ($groupWrapper.find('.zoomPopupClose').length === 0) { var menu = '
'; - if (zoomLink.data('shareurl') !== undefined && zoomLink.data('shareurl') !== '') { + var share = ''; + if ($this.fluidbook.settings.product_share_enabled && zoomLink.data('shareurl') !== undefined && zoomLink.data('shareurl') !== '') { var shareURL; - if (this.fluidbook.settings.product_share_link === 'product') { + if ($this.fluidbook.settings.product_share_link === 'product') { shareURL = zoomLink.data('shareurl'); - } else if (this.fluidbook.settings.product_share_link === 'page') { - shareURL = this.fluidbook.share.getFluidbookURL(true); + } else if ($this.fluidbook.settings.product_share_link === 'page') { + shareURL = $this.fluidbook.share.getFluidbookURL(true); } - menu += '' + getSpriteIcon('nav-share') + ''; + share = '' + getSpriteIcon('nav-share') + ''; } - if (zoomLink.data('extra-1') !== undefined) { - var label = this.fluidbook.settings.product_zoom_label_2; - var icon = getSpriteIcon(this.fluidbook.settings.product_zoom_icon_2) !== 'none' ? getSpriteIcon(this.fluidbook.settings.product_zoom_icon_2) : ''; - var linkClass = ""; - if (label !== '') { - label = '' + label + ''; - } else { - linkClass = " nolabel"; + + var from, to, increment; + if ($this.fluidbook.settings.product_zoom_buttons_order === 'right') { + from = 10; + to = 0; + increment = -1; + menu += share; + } else { + from = 0; + to = 10; + increment = 1; + } + + for (var i = from; increment === 1 ? i <= to : i >= to; i += increment) { + var data = zoomLink.data('d-' + i); + console.log(i, data); + if (data !== undefined) { + var j = i + 1; + var label = $this.fluidbook.settings['product_zoom_label_' + j]; + var icon = getSpriteIcon($this.fluidbook.settings['product_zoom_icon_' + j]) !== 'none' ? getSpriteIcon($this.fluidbook.settings['product_zoom_icon_' + j]) : ''; + var linkClass = ""; + if (label !== '') { + label = '' + label + ''; + } else { + linkClass = " nolabel"; + } + + var action = $this.fluidbook.settings['product_zoom_action_' + j]; + if (!action) { + action = 'link'; + } + + if (!data) { + continue; + } + + menu += '' + icon + label + ''; } - menu += '' + icon + label + ''; } - if (zoomLink.data('producturl') !== undefined && zoomLink.data('producturl') !== '') { - var label = this.fluidbook.settings.product_zoom_label_1 !== '' ? this.fluidbook.settings.product_zoom_label_1 : this.fluidbook.l10n.__('see on the website'); - var icon = getSpriteIcon(this.fluidbook.settings.product_zoom_icon_1) !== 'none' ? getSpriteIcon(this.fluidbook.settings.product_zoom_icon_1) : ''; - menu += '' + icon + '' + label + ''; + + if ($this.fluidbook.settings.product_zoom_buttons_order === 'left') { + menu += share; } menu += '
'; $groupWrapper.append('
' + menu + '
'); @@ -277,7 +318,7 @@ FluidbookLinksZoom.prototype = { }); // Load image before running zoom up animation - this.fluidbook.displayLoader(); + $this.fluidbook.displayLoader(); loadImage(zoomImage, function (img) { // Image is set as a background for better scaling / fitting via CSS diff --git a/style/fluidbook.less b/style/fluidbook.less index 6d492b81..e17748e8 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -92,6 +92,10 @@ img { user-select: none; } +[data-clipboard-text] { + cursor: pointer; +} + b, strong, h1, h2, h3, h4, h5, h6 { font-weight: 600; } -- 2.39.5