From db86ced1c47ee481e9a53e3c2cdb324c784105d0 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 20 Dec 2023 09:39:43 +0100 Subject: [PATCH] wip #6554 @0.5 --- js/libs/fluidbook/fluidbook.cart.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.cart.js b/js/libs/fluidbook/fluidbook.cart.js index 34970f72..30f1ce6b 100644 --- a/js/libs/fluidbook/fluidbook.cart.js +++ b/js/libs/fluidbook/fluidbook.cart.js @@ -40,6 +40,7 @@ FluidbookCart.prototype = { var ref = $(this).data('cart-ref'); let refs = []; + let force = false; if (ref === 'auto:all_in_page') { $('#links [data-cart-ref]').each(function () { let r = $(this).data('cart-ref'); @@ -48,13 +49,16 @@ FluidbookCart.prototype = { } if (refs.indexOf(r) === -1) { refs.push(r); + if ($this.instance.getItems().indexOf(r) === -1) { + force = true; + } } }); } else { + force = $this.instance.getItems().indexOf(ref) === -1; refs = [ref]; } - let force = $this.instance.getItems().indexOf(refs[0]) === -1; var tooltip; $.each(refs, function (k, ref) { @@ -112,7 +116,7 @@ FluidbookCart.prototype = { } catch (err) { } - if ($("#links a[data-cart-ref]").not('[data-cart-ref="auto:all_in_page"]').eq(0).hasClass('active')) { + if ($("#links a[data-cart-ref]").not('[data-cart-ref="auto:all_in_page"]').not('.active').length === 0) { $('[data-cart-ref="auto:all_in_page"]').addClass('active'); } -- 2.39.5