PageSourceSearch

https://www.dambenois.fr/_assets/45f48b3f522541d56a70aadffc9d15f6/JavaScript/photoswipe-init.js?1739102842

js dambenois.fr collected 2026-10-03 02:46:23 UTC 3,716 bytes, 108 lines download raw bytes

1import PhotoSwipeLightbox from './photoswipe-lightbox.esm.js';
2
3/**
4 * lightbox for linkWizard
5 * @type {PhotoSwipeLightbox}
6 */
7const linkHandlerLightbox = new PhotoSwipeLightbox({
8    gallery: 'body',
9    mainClass: 'pswp--layer-wrapper',
10    children: '[data-ispsw-layer]',
11    pswpModule: () => import('./photoswipe.esm.js')
12    // arrowKeys: false
13});
14linkHandlerLightbox.addFilter('itemData', (itemData, index) => {
15    const iframeUrl = itemData.element.dataset.iframeUrl;
16    if (iframeUrl) {
17        itemData.iframeUrl = iframeUrl;
18    }
19    return itemData;
20});
21linkHandlerLightbox.on('contentLoad', (e) => {
22    const { content } = e;
23    if (content.type === 'iframe') {
24        e.preventDefault();
25        content.element = document.createElement('div');
26        content.element.className = 'pswp__iframe-container';
27
28        const iframe = document.createElement('iframe');
29        iframe.setAttribute('allowfullscreen', '');
30        iframe.src = content.data.iframeUrl;
31        content.element.appendChild(iframe);
32    }
33    if (content.type === 'html') {
34        e.preventDefault();
35        content.element = document.createElement('div');
36        content.element.className = 'pswp__html-container';
37
38        console.log([content.data.element.dataset.html]);
39
40        const html = document.createElement('div');
41        html.setAttribute('class', 'wrapper');
42        html.innerHTML = decodeURIComponent(content.data.element.dataset.html);
43        content.element.appendChild(html);
44    }
45});
46linkHandlerLightbox.init();
47
48/**
49 * lightbox for click-enlarge content elements
50 * @type {PhotoSwipeLightbox}
51 */
52const imageLightbox = new PhotoSwipeLightbox({
53    gallery: '.ce-gallery',
54    children: '[data-ispsw-img]',
55    pswpModule: () => import('./photoswipe.esm.js')
56});
57imageLightbox.init();
58
59/**
60 * Base 64 image preview and lazy load
61 */
62document.addEventListener('DOMContentLoaded', function () {
63    let lazyImages = [].slice.call(document.querySelectorAll('img.lazy64'));
64    let lazyBgImages = [].slice.call(document.querySelectorAll('.lazy64bg'));
65
66    if ('IntersectionObserver' in window) {
67
68        // images
69        let lazyImageObserver = new IntersectionObserver(
70            function (entries, observer) {
71                entries.forEach(function (entry) {
72                    if (entry.isIntersecting) {
73                        let lazyImage = entry.target;
74                        lazyImage.src = lazyImage.dataset.src;
75                        lazyImageObserver.unobserve(lazyImage);
76                    }
77                });
78            });
79        lazyImages.forEach(function (lazyImage) {
80            lazyImageObserver.observe(lazyImage);
81        });
82
83        // bg-images
84        let lazyBgImageObserver = new IntersectionObserver(
85            function (entries, observer) {
86                entries.forEach(function (entry) {
87                    if (entry.isIntersecting) {
88                        let lazyBgImage = entry.target;
89                        lazyBgImage.style.backgroundImage = 'url(\'' + lazyBgImage.dataset.src + '\')';
90                        lazyBgImageObserver.unobserve(lazyBgImage);
91                    }
92                });
93            });
94        lazyBgImages.forEach(function (lazyBgImage) {
95            lazyBgImageObserver.observe(lazyBgImage);
96        });
97    } else {
98        // For browsers that don't support IntersectionObserver yet,
99        // load all the images now:
100        lazyImages.forEach(function (lazyImage) {
101            lazyImage.src = lazyImage.dataset.src;
102        });
103        lazyBgImages.forEach(function (lazyBgImage) {
104            lazyBgImage.style.backgroundImage = 'url(\'' + lazyBgImage.dataset.src + '\')';
105        });
106
107    }
108});

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.