]> _ Git - fluidbook-html5.git/commitdiff
wip #7835 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 6 Nov 2025 10:35:09 +0000 (11:35 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 6 Nov 2025 10:35:09 +0000 (11:35 +0100)
js/libs/fluidbook/cart/fluidbook.cart.puma.js
js/libs/fluidbook/fluidbook.cart.js
style/cart.less

index a8c433bcf20386b417f6de3dc4bcde6280bdbe0f..db8d03843640e6baa7e16fcc45a3475fcffb7ff9 100644 (file)
@@ -60,6 +60,10 @@ FluidbookCartPuma.prototype = {
             });
             return false;
         });
+
+        this.fluidbook.keyboard.keyShortcut('ctrl+shift+a', function () {
+            $this.addAllReferencesToCart();
+        });
     },
 
     emptyCart: function () {
@@ -83,6 +87,20 @@ FluidbookCartPuma.prototype = {
         }
     },
 
+    addAllReferencesToCart: function () {
+        let $this = this;
+        for (let i = 1; i <= this.fluidbook.settings.pages; i++) {
+            let l = this.fluidbook.settings.links[i].normal;
+            if (l === undefined) {
+                continue;
+            }
+            $(l.join('')).find('[data-cart-ref]').each(function () {
+                let r = $(this).data('cart-ref');
+                $this.addToCart(r, 1, true);
+            });
+        }
+    },
+
     removeFromCartByRef: function (ref) {
         var key = this.items.indexOf(ref);
         if (key >= 0) {
@@ -252,10 +270,10 @@ FluidbookCartPuma.prototype = {
         $.each(this.exportData, function (k, v) {
             GET[v.name] = v.value;
         });
-        if(GET.pa===undefined){
+        if (GET.pa === undefined) {
             GET.pa = 0;
         }
-        if(GET.pvp===undefined){
+        if (GET.pvp === undefined) {
             GET.pvp = 0;
         }
         this.fluidbook.displayLoader();
index 2af033343b89c205445a148d5b77f3642768c87d..2d89c32d42355dff5a813796927d376277012ad6 100644 (file)
@@ -130,34 +130,35 @@ FluidbookCart.prototype = {
 
                 }
                 var size = 2;
-                if ($(this).outerWidth() < 200) {
+                var r=0.5;
+                if ($(this).outerWidth() < 200*r) {
                     size = Math.min(size, 0);
                     c.push('small-w');
-                } else if ($(this).outerWidth() < 280) {
+                } else if ($(this).outerWidth() < 280*r) {
                     size = Math.min(size, 1);
                     c.push('medium-w');
                 }
-                if ($(this).outerHeight() < 100) {
+                if ($(this).outerHeight() < 100*r) {
                     size = Math.min(size, 0);
                     c.push('small-h');
-                } else if ($(this).outerHeight() < 130) {
+                } else if ($(this).outerHeight() < 130*r) {
                     size = Math.min(size, 1);
                     c.push('medium-h');
                 }
 
-                if ($(this).outerHeight() < 300) {
+                if ($(this).outerHeight() < 300*r) {
                     c.push('condensed-h');
                 }
 
-                var bw = 250;
-                var bh = 100;
+                var bw = 250*r;
+                var bh = 100*r;
                 if (size === 0) {
-                    bw = 130;
-                    bh = 60;
+                    bw = 130*r;
+                    bh = 60*r;
                     $(this).addClass('small');
                 } else if (size === 1) {
-                    bw = 170;
-                    bh = 80;
+                    bw = 170*r;
+                    bh = 80*r;
                     $(this).addClass('medium');
                 }
                 $(this).addClass(c);
index 1a536ce21524c74eff48e0bb66742d2841c2ad51..69a0c86209ec7950b64eed1573a36362f8203d29 100644 (file)
@@ -2,6 +2,8 @@
 
 a[data-cart-ref] {
   &.overlay {
+    @r: 0.5;
+
     white-space: nowrap;
     overflow: hidden;
     color: #fff;
@@ -21,8 +23,8 @@ a[data-cart-ref] {
     &.condensed-h {
       div {
         &.infos {
-          bottom: 15px;
-          right: 15px;
+          bottom: unit(15*@r,px);
+          right: unit(15*@r,px);
         }
       }
     }
@@ -30,14 +32,14 @@ a[data-cart-ref] {
     &.medium {
       div {
         &.infos {
-          bottom: 15px;
-          right: 15px;
+          bottom: unit(15*@r,px);
+          right: unit(15*@r,px);
         }
 
-        @w: 80px;
+        @w: unit(80*@r,px);
 
         &.add {
-          margin-left: unit(10, px);
+          margin-left: unit(10*@r, px);
         }
 
         &.add, &.remove {
@@ -50,16 +52,16 @@ a[data-cart-ref] {
     &.small {
       div {
         &.infos {
-          width: 40px;
-          height: 40px;
-          bottom: 10px;
-          right: 10px;
+          width: unit(40*@r,px);
+          height: unit(40*@r,px);
+          bottom: unit(10*@r, px);
+          right: unit(10*@r, px);
         }
 
-        @w: 60px;
+        @w: unit(60*@r, px);
 
         &.add {
-          margin-left: unit(10, px);
+          margin-left: unit(10*@r, px);
         }
 
         &.add, &.remove {
@@ -72,17 +74,17 @@ a[data-cart-ref] {
 
     div {
       &.infos {
-        @w: 50px;
+        @w: unit(50*@r, px);
         width: @w;
         height: @w;
         position: absolute;
-        bottom: 50px;
-        right: 50px;
+        bottom: @w;
+        right: @w;
         pointer-events: none;
         display: none;
       }
 
-      @w: 100px;
+      @w: unit(100*@r, px);
 
       &.add {
         margin-left: unit(@w*0.5, px);