From: Vincent Vanwaelscappel Date: Wed, 24 Feb 2021 12:31:37 +0000 (+0100) Subject: wait #4299 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=bd4272ded868682d811377c5210de794b579b914;p=fluidbook-html5.git wait #4299 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.cart.js b/js/libs/fluidbook/fluidbook.cart.js index 007ee9f5..76aa28e5 100644 --- a/js/libs/fluidbook/fluidbook.cart.js +++ b/js/libs/fluidbook/fluidbook.cart.js @@ -26,29 +26,33 @@ FluidbookCart.prototype = { }); $(document).on('click', '[data-cart-ref]', function () { - var qty = 1; - if ($(this).data('cart-qty') !== null) { - qty = parseInt($(this).attr('data-cart-qty')); - } + try { + var qty = 1; + if ($(this).data('cart-qty') !== null) { + qty = parseInt($(this).attr('data-cart-qty')); + } - var ref = $(this).data('cart-ref'); - console.log(ref); - $this.fluidbook.stats.track(15, $this.fluidbook.currentPage, ref); + var ref = $(this).data('cart-ref'); - var tooltipStyle = ''; - try { - tooltipStyle = $this.instance.getTooltipStyle(); - } catch (e) { + $this.fluidbook.stats.track(15, $this.fluidbook.currentPage, ref); + + var tooltipStyle = ''; + try { + tooltipStyle = $this.instance.getTooltipStyle(); + } catch (e) { + + } + var tooltip = $this.instance.addToCart(ref, qty); + if (tooltip === undefined || tooltip === null || !tooltip || tooltip === true || tooltip === false || tooltip === 'true' || tooltip === 'false') { + tooltip = $this.fluidbook.l10n.__("the item has been added to your cart"); + } + $this.fluidbook.tooltip.displayTooltip(tooltip, tooltipStyle); + setTimeout(function () { + $this.fluidbook.tooltip.hideTooltip(); + }, 2500); + }catch (e){ } - var tooltip = $this.instance.addToCart(ref, qty); - if (tooltip === undefined || tooltip === null || !tooltip || tooltip === true || tooltip === false || tooltip === 'true' || tooltip === 'false') { - tooltip = $this.fluidbook.l10n.__("the item has been added to your cart"); - } - $this.fluidbook.tooltip.displayTooltip(tooltip, tooltipStyle); - setTimeout(function () { - $this.fluidbook.tooltip.hideTooltip(); - }, 2500) return false; }); diff --git a/js/libs/fluidbook/fluidbook.tooltip.js b/js/libs/fluidbook/fluidbook.tooltip.js index a53a7bb9..50bdba0d 100644 --- a/js/libs/fluidbook/fluidbook.tooltip.js +++ b/js/libs/fluidbook/fluidbook.tooltip.js @@ -171,16 +171,18 @@ FluidbookTooltip.prototype = { } t.attr('data-style', style); css.maxWidth = 250; - if(css.backgroundColor) { - t.get(0).style.setProperty('--background-color', css.backgroundColor); - }else{ - css.backgroundColor=''; - t.get(0).style.setProperty('--background-color', null); + if (Modernizr.cssvars) { + if (css.backgroundColor) { + t.get(0).style.setProperty('--background-color', css.backgroundColor); + } else { + css.backgroundColor = ''; + t.get(0).style.setProperty('--background-color', null); + } } - if(css.color){ + if (css.color) { - }else{ - css.color=''; + } else { + css.color = ''; } t.css(css).html(text).show(); diff --git a/js/libs/modernizr/tests.js b/js/libs/modernizr/tests.js index 35cca3c3..78b9ddc9 100644 --- a/js/libs/modernizr/tests.js +++ b/js/libs/modernizr/tests.js @@ -64,4 +64,8 @@ Modernizr.addTest('msie', function () { Modernizr.addTest('mozrotation', function () { return Modernizr.firefox || Modernizr.edge || Modernizr.msie; +}); + +Modernizr.addTest('cssvars', function () { + return (window.CSS && window.CSS.supports && window.CSS.supports('--fake-var', "0")); }); \ No newline at end of file diff --git a/style/tooltip.less b/style/tooltip.less index 29b31e1f..8f58fdbd 100644 --- a/style/tooltip.less +++ b/style/tooltip.less @@ -29,6 +29,7 @@ &[data-style="invert"] { font-weight: 700; --background-color: @tooltip-color; + background-color: @tooltip-color; color: @tooltip-background; &[data-pos-y="n"] {