From: Vincent Vanwaelscappel Date: Thu, 6 Nov 2025 10:35:09 +0000 (+0100) Subject: wip #7835 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c66ff99e7383da11c7867030638b56d15a414254;p=fluidbook-html5.git wip #7835 @1 --- diff --git a/js/libs/fluidbook/cart/fluidbook.cart.puma.js b/js/libs/fluidbook/cart/fluidbook.cart.puma.js index a8c433bc..db8d0384 100644 --- a/js/libs/fluidbook/cart/fluidbook.cart.puma.js +++ b/js/libs/fluidbook/cart/fluidbook.cart.puma.js @@ -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(); diff --git a/js/libs/fluidbook/fluidbook.cart.js b/js/libs/fluidbook/fluidbook.cart.js index 2af03334..2d89c32d 100644 --- a/js/libs/fluidbook/fluidbook.cart.js +++ b/js/libs/fluidbook/fluidbook.cart.js @@ -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); diff --git a/style/cart.less b/style/cart.less index 1a536ce2..69a0c862 100644 --- a/style/cart.less +++ b/style/cart.less @@ -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);