]> _ Git - fluidbook-html5.git/commitdiff
wait #4299 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 24 Feb 2021 12:31:37 +0000 (13:31 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 24 Feb 2021 12:31:37 +0000 (13:31 +0100)
js/libs/fluidbook/fluidbook.cart.js
js/libs/fluidbook/fluidbook.tooltip.js
js/libs/modernizr/tests.js
style/tooltip.less

index 007ee9f5a8fe27913f5cbbca7774cbec9f703bf8..76aa28e50137b05c6cb513d8764148dea0410d90 100644 (file)
@@ -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;
         });
index a53a7bb9a1c2978ba566ac0848226cc48c0f86a5..50bdba0de793a42d71488f1fbe310930142ad3d2 100644 (file)
@@ -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();
 
index 35cca3c38adfd90bf36bf18e97708131d8aa74e2..78b9ddc94bc7023e380c8a03f1bc0f81b00d739f 100644 (file)
@@ -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
index 29b31e1fb003840818e17de7facf08d1a3e52a63..8f58fdbdc2f6494d12e432595ff14a58a8cd9624 100644 (file)
@@ -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"] {