PageSourceSearch

https://www.armagnac-domainedupeto.com/wp-content/plugins/UltraSimpleGallery/js/gallery.js

js armagnac-domainedupeto.com collected 2026-09-25 09:28:50 UTC 10,033 bytes, 339 lines download raw bytes

1function fInit6tem9Gallery(){
2
3    // Carousel
4    jQuery(".carousel6tem9Gallery").each(function() {
5        
6        var oneItemSlide = jQuery(this).data('oneitemslide');
7        var nbItem = jQuery(this).find('.galleryItem').length;
8        var autoplay = jQuery(this).data('autoplay');
9        var nbSlide = jQuery(this).data('nbslide');
10        var action = jQuery(this).data('action');
11
12        if ( action == 'linkUrl' || action == 'none' )
13            noZoomGallery = true;
14        else 
15            noZoomGallery = false;
16
17        // if ( nbSlide > 1 )
18        // {
19            var owl = jQuery(this).on('initialized.owl.carousel changed.owl.carousel resized.owl.carousel', function(e) {
20                //console.log(e);
21                if (!e.namespace ) return
22                if ( e.page.count > 1 )
23                //if ( e.item.count > 1 )
24                {
25                    jQuery(this).parent().find('.navContainer6tem9Gallery').show();
26                    jQuery(this).parent().find('.paginationNumber').html(e.page.index + 1 + ' / ' + e.page.count);
27                    //jQuery(this).parent().find('.paginationNumber').html(e.item.index-e.item.count + 1 + ' / ' + e.item.count);
28                }
29                else
30                    jQuery(this).parent().find('.navContainer6tem9Gallery').hide();
31                }).owlCarousel({
32                dots: true,
33                margin: 10,
34                autoplay: autoplay,
35                autoplayHoverPause: true,
36                smartSpeed: oneItemSlide?700:300,
37                loop: true,
38                items: oneItemSlide?1:(nbItem<4?nbItem:4),
39                nav:false,
40                slideBy: 'page',
41                lazyLoad: false,
42                responsiveClass:true,
43                responsiveBaseElement: '#'+jQuery(this).parent().attr('id'),
44                responsive:{
45                    240:{
46                        items: oneItemSlide?1:(nbItem<2?nbItem:2),
47                        slideBy: 'page'
48                    },
49                    300:{
50                        items: oneItemSlide?1:(nbItem<3?nbItem:3),
51                        slideBy: 'page'
52                    },
53                    500:{
54                        items: oneItemSlide?1:(nbItem<4?nbItem:4),
55                        slideBy: 'page'
56                    },
57                    800:{
58                        items: oneItemSlide?1:(nbItem<5?nbItem:5),
59                        slideBy: 'page'
60                    },
61                    1000:{
62                        items: oneItemSlide?1:(nbItem<6?nbItem:6),
63                        slideBy: 'page'
64                    }
65                }
66            });
67
68            jQuery('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
69                window.dispatchEvent(new Event('resize'));
70            });
71
72            // Next and Previous buttons listeners
73            jQuery(this).parent().find('.btnPrev').click(function(){
74                owl.trigger('prev.owl.carousel');
75            });
76
77            jQuery(this).parent().find('.btnNext').click(function(){
78                owl.trigger('next.owl.carousel');
79            });
80
81
82        // }
83
84        if ( !noZoomGallery )
85            fInitPhotoSwipeFromDOM(jQuery(this));
86
87
88    });
89
90    // Justified gallery
91
92    jQuery(".justified6tem9Gallery").each(function() {
93        
94        var size = jQuery(this).data('size');
95        var action = jQuery(this).data('action');
96
97        if ( action == 'linkUrl' || action == 'none' )
98            noZoomJustified = true;
99        else 
100            noZoomJustified = false;
101
102        jQuery(this).justifiedGallery({
103            lastRow : 'nojustify',
104            margins: 5,
105            sizeRangeSuffixes : {
106                lt100 : '', 
107                lt240 : '', 
108                lt320 : '', 
109                lt500 : '', 
110                lt640 : '', 
111                lt1024 : ''
112            },
113            cssAnimation: true,
114            captions: noZoomJustified,
115            rowHeight: size
116        });
117
118        if ( !noZoomJustified )
119            fInitPhotoSwipeFromDOM(this);
120
121    });
122
123}
124
125// Init 6tem9Gallery 
126jQuery(document).ready(function(){
127
128    fInit6tem9Gallery();
129
130    jQuery('a.galleryItem').hover(function() {
131            jQuery(this).find('.galleryOverlay').stop().animate({ opacity: 1.0 }, "fast");
132    },
133    function() {
134        jQuery(this).find('.galleryOverlay').stop().animate({ opacity: 0 }, "fast");
135    });
136});
137
138/* # ------------------------------------------------------------------------------------------ */
139/* # PhotoSwipe function */
140
141
142
143function fInitPhotoSwipeFromDOM(gallerySelector)
144{   
145
146    var i = 0;
147    var galleryElements = [];
148
149    jQuery(gallerySelector).each(function(){
150        jQuery(this).attr('data-pswp-uid', i+1);
151        jQuery(this).click(function(e)
152        {
153            fOnThumbnailsClick(e);
154        });
155        galleryElements.push(jQuery(this));
156        i++;
157    });
158
159    // Parse URL and open gallery if it contains #&pid=3&gid=1
160    var hashData = fPhotoSwipeParseHash();
161
162    if(hashData.pid > 0 && hashData.gid > 0) {
163        fOpenPhotoSwipe( hashData.pid - 1 ,  galleryElements[ hashData.gid - 1 ], true );
164    }
165}
166
167function fParseThumbnailElements(el)
168{
169    var thumbElements = el.find('.owl-item:not(.cloned)').find('a'),
170        numNodes = thumbElements.length,
171        items = [],
172        figureEl,
173        linkEl,
174        size,
175        item;
176
177    if ( !thumbElements.length )
178        thumbElements = el.find('a');
179
180    jQuery(thumbElements).each(function(){
181
182        if ( !jQuery(this).parent().hasClass('cloned') || jQuery(this).parent().hasClass('active') )
183        {
184            // Size
185            size = jQuery(this).data('size').split('x');
186
187            // Item
188            item = {
189                src: jQuery(this).attr('href'),
190                w: parseInt(size[0], 10),
191                h: parseInt(size[1], 10)
192            };
193
194            // Caption
195            if( typeof jQuery(this).attr('title') !== typeof undefined && jQuery(this).attr('title') !== false )
196                item.title = "<strong>"+jQuery(this).attr('title')+"</strong><br />"+jQuery(this).data('legend');
197
198            // Caption
199
200            // Source
201            if( typeof jQuery(this).find('img').attr('src') !== typeof undefined && jQuery(this).find('img').attr('src') !== false )           
202                item.msrc = jQuery(this).find('img').attr('src');
203
204            item.el = jQuery(this); // save link to element for getThumbBoundsFn
205            items.push(item);
206        }
207    });
208
209    return items;
210}
211
212
213function fClosest(el, fn)
214{
215    return el && ( fn(el) ? el : fClosest(el.parentNode, fn) );
216}
217
218function fOnThumbnailsClick(e)
219{
220    e = e || window.event;
221    e.preventDefault ? e.preventDefault() : e.returnValue = false;
222
223    var eTarget = jQuery(e.target) || e.val();
224    // find root element of slide
225    var clickedListItem = jQuery(eTarget).parent();
226
227    if(!clickedListItem) {
228        return;
229    }
230
231    // find index of clicked item by looping through all child nodes
232    // alternatively, you may define index via data- attribute
233    var clickedGallery = jQuery(clickedListItem).parents('.galleryContainer'),
234        childNodes = clickedListItem.parents('.galleryContainer').find('a'),
235        numChildNodes = clickedListItem.parents('.galleryContainer').find('.owl-item:not(.cloned)').length,
236        nodeIndex = 0,
237        index;
238
239     jQuery(childNodes).each(function(){
240
241        if ( !jQuery(this).parent().hasClass('cloned') || jQuery(this).parent().hasClass('active') )
242        {
243
244            if(jQuery(this)[0] === clickedListItem[0]) {
245                if ( nodeIndex >= numChildNodes )
246                {
247                    index = nodeIndex - numChildNodes;
248                    nodeIndex = index;
249                }
250                else
251                    index = nodeIndex;
252
253                return false;
254            }
255            nodeIndex++;
256        }
257    });
258
259    if(index >= 0) {
260        // open PhotoSwipe if valid index found
261        fOpenPhotoSwipe( index, clickedGallery, clickedGallery.hasClass('carousel6tem9Gallery') );
262    }
263    return false;
264}
265
266
267
268function fPhotoSwipeParseHash()
269{
270    var hash = window.location.hash.substring(1),
271    params = {};
272
273    if(hash.length < 5) {
274        return params;
275    }
276
277    var vars = hash.split('&');
278    for (var i = 0; i < vars.length; i++) {
279        if(!vars[i]) {
280            continue;
281        }
282        var pair = vars[i].split('=');  
283        if(pair.length < 2) {
284            continue;
285        }           
286        params[pair[0]] = pair[1];
287    }
288
289    if(params.gid) {
290        params.gid = parseInt(params.gid, 10);
291    }
292
293    if(!params.hasOwnProperty('pid')) {
294        return params;
295    }
296    params.pid = parseInt(params.pid, 10);
297
298    return params;
299}
300
301function fOpenPhotoSwipe(index, galleryElement, disableAnimation)
302{
303    var pswpElement = document.querySelectorAll('.pswp')[0],
304    gallery,
305    options,
306    items;
307
308    items = fParseThumbnailElements(galleryElement);
309    
310    // define options (if needed)
311    options = {
312        index: index,
313
314        // define gallery index (for URL)
315        galleryUID: jQuery(galleryElement).attr('data-pswp-uid'),
316
317        getThumbBoundsFn: function(index) {
318            // See Options -> getThumbBoundsFn section of documentation for more info
319            var thumbnail = items[index].el.find('img')[0], // find thumbnail
320                pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
321                rect = thumbnail.getBoundingClientRect(); 
322
323            return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};
324        }
325
326    };
327
328/*          if(disableAnimation) {*/
329        options.hideAnimationDuration = 0;
330        options.showAnimationDuration = 0;
331        options.history = 0;
332/*          }*/
333    
334    options.showHideOpacity = 1;
335
336    // Pass data to PhotoSwipe and initialize it
337    gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
338    gallery.init();
339}   

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.