PageSourceSearch

https://gardenclub.org/modules/contrib/commerce/modules/cart/js/commerce_cart.js?tlq6l1

js gardenclub.org collected 2026-10-01 10:38:14 UTC 1,243 bytes, 37 lines download raw bytes

1/**
2 * @file
3 * Defines Javascript behaviors for the commerce cart module.
4 */
5
6(($, Drupal) => {
7  Drupal.behaviors.commerceCartBlock = {
8    attach: (context) => {
9      const $context = $(context);
10      const $cart = $context
11        .find('.cart--cart-block')
12        .addBack('.cart--cart-block');
13      const $cartContents = $cart.find('.cart-block--contents');
14
15      if ($cartContents.length > 0) {
16        // Expand the block when the link is clicked.
17        $(
18          once('cart-button-processed', '.cart-block--link__expand', context),
19        ).on('click', (e) => {
20          // Prevent it from going to the cart.
21          e.preventDefault();
22          // Get the shopping cart width + the offset to the left.
23          const windowWidth = $(window).width();
24          const cartWidth = $cartContents.width() + $cart.offset().left;
25          // If the cart goes out of the viewport we should align it right.
26          if (cartWidth > windowWidth) {
27            $cartContents.addClass('is-outside-horizontal');
28          }
29          // Toggle the expanded class.
30          $cartContents
31            .toggleClass('cart-block--contents__expanded')
32            .slideToggle();
33        });
34      }
35    },
36  };
37})(jQuery, Drupal);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.