PageSourceSearch

https://a3kultur.de/modules/contrib/photoswipe/js/photoswipe.init.js?ti9h2x

js a3kultur.de collected 2026-10-02 10:48:37 UTC 2,401 bytes, 68 lines download raw bytes

1(function (Drupal, PhotoSwipeLightbox) {
2  /**
3   * Initialises photoswipe galleries.
4   *
5   * @type {Drupal~behavior}
6   */
7  Drupal.behaviors.photoswipe = {
8    attach(context, settings) {
9      once('photoswipe', '.photoswipe-gallery', context).forEach((gallery) => {
10        const lightbox = new PhotoSwipeLightbox({
11          // Select the gallery.
12          gallerySelector: '.photoswipe-gallery',
13          // Only trigger photoswipe on links with the photoswipe class:
14          childSelector: 'a.photoswipe',
15          // Initialize Photoswipe with our settings:
16          // eslint-disable-next-line
17          pswpModule: PhotoSwipe,
18          ...(settings?.photoswipe?.options || {}),
19        });
20
21        // Check if the gallery has the `data-show-download-button` data
22        // attribute, to show the download button:
23        if (gallery.hasAttribute('data-show-download-button')) {
24          // This is a straight copy of the code example from
25          // https://photoswipe.com/adding-ui-elements/#adding-download-button:
26          lightbox.on('uiRegister', () => {
27            lightbox.pswp.ui.registerElement({
28              name: 'download-button',
29              order: 8,
30              isButton: true,
31              title: settings?.photoswipe?.options?.downloadTitle,
32              tagName: 'a',
33              html: {
34                isCustomSVG: true,
35                inner:
36                  '<path d="M20.5 14.3 17.1 18V10h-2.2v7.9l-3.4-3.6L10 16l6 6.1 6-6.1ZM23 23H9v2h14Z" id="pswp__icn-download"/>',
37                outlineID: 'pswp__icn-download',
38              },
39              onInit: (el, pswp) => {
40                el.setAttribute('download', '');
41                el.setAttribute('target', '_blank');
42                // Added "noreferrer", for further safety:
43                el.setAttribute('rel', 'noopener noreferrer');
44
45                pswp.on('change', () => {
46                  el.href = pswp.currSlide.data.src;
47                });
48              },
49            });
50          });
51        }
52
53        // Adds ability to react on photoswipe initialization.
54        const event = new CustomEvent('photoswipeLightboxBuild', {
55          detail: {
56            lightbox,
57          },
58        });
59
60        gallery.dispatchEvent(event);
61
62        // Initialize.
63        lightbox.init();
64      });
65    },
66  };
67  // eslint-disable-next-line
68})(Drupal, PhotoSwipeLightbox);

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.