PageSourceSearch

https://www.thesummitchurch.net/wp-content/plugins/oxyextras/components/assets/fancybox-init-4.js?ver=1.5.4

js thesummitchurch.net collected 2026-10-01 14:10:54 UTC 22,767 bytes, 558 lines download raw bytes

1jQuery(document).ready(oxygen_lightbox);
2function oxygen_lightbox($) {
3    
4   let extrasLightbox = function ( container ) {
5
6        $(container).find('.oxy-lightbox').each(function(loopIndex, OxyLightBox) {
7
8        // Stable index stored on the element, so a re-init on appended content does not restart at 0.
9        let i = $(OxyLightBox).attr('data-oxy-lb-index');
10        if (undefined === i) {
11            window.oxyExtrasLightboxCount = (window.oxyExtrasLightboxCount || 0) + 1;
12            i = window.oxyExtrasLightboxCount - 1;
13            $(OxyLightBox).attr('data-oxy-lb-index', i);
14        } else {
15            i = parseInt(i, 10);
16        }
17
18        let lightboxID = $(OxyLightBox).attr('ID'),
19            lightboxIDgroup = lightboxID,
20            lightboxInner = $(OxyLightBox).children('.oxy-lightbox_inner'),
21            lightboxType = lightboxInner.data('type'),
22            lightboxLink = $(OxyLightBox).children('.oxy-lightbox_link'),
23            lightboxSrc = $(OxyLightBox).children('.oxy-lightbox_inner').html(),
24            lightboxClick = lightboxInner.data('click-selector'),
25            lightboxFilter = lightboxInner.data('filter'),
26            inlineSelector = lightboxInner.data('inline-selector'),
27            inlineContent = lightboxInner.data('inner-content'),
28            maybeMultiple = lightboxInner.data('multiple'),
29            maybeLoop = lightboxInner.data('loop'),
30            lightboxCaption = lightboxInner.data('caption'),
31            fancyboxOpt = '',
32            fancyboxOpts = '',
33            clickSelector = '',
34            lbSmallBtn = lightboxInner.data('small-btn'),
35            lbPreload = lightboxInner.data('iframe-preload'),
36            lbToolbar = lightboxInner.data('toolbar'),
37            lbThumbs = lightboxInner.data('thumbs'),
38            lbFullscreen = lightboxInner.data('fullscreen'),
39            lbSlideshow = lightboxInner.data('slideshow'),
40            lbautofocus = lightboxInner.data('autofocus'),
41            lbbackfocus = lightboxInner.data('backfocus'),
42            lbtrapfocus = lightboxInner.data('trapfocus'),
43            lbcss = lightboxInner.data('lightbox-css'),
44            //lbeffect = lightboxInner.data('effect'),
45            lbforcetype = lightboxInner.data('force-type'),
46            lbCloseIcon = lightboxInner.data('close-icon'),
47            lbSmallCloseIcon = lightboxInner.data('small-close-icon'),
48            lbNavIcon = lightboxInner.data('nav-icon'),
49            lbZoomIcon = lightboxInner.data('zoom-icon'),
50            lbDownloadIcon = lightboxInner.data('download-icon'),
51            lbIframeSelector = lightboxInner.data('iframe-selector'),
52            lbDuration = lightboxInner.data('duration'),
53            lbclassList = $(OxyLightBox).attr("class").split(/\s+/),
54            lightboxparentEl = '[data-lightbox-id="' + lightboxIDgroup + '"]',
55            maybeSwipe = lightboxInner.data('swipe'),
56            mobileCloseBehavior = lightboxInner.data('mobile-close');
57
58        $(OxyLightBox).attr('data-lightbox-id', lightboxID); 
59        lightboxInner.attr('id', '' + lightboxID + '-inner');
60        lightboxInner.attr('data-idx', '' + lightboxID);      
61
62        if ($(OxyLightBox).closest('.oxy-dynamic-list').length) {
63
64            lightboxIDgroup = $(OxyLightBox).attr('data-id');
65            lightboxparentEl = '[data-lightbox-id="' + lightboxIDgroup + '-' + i + '"]';
66
67            var elem = $(OxyLightBox).closest('.oxy-dynamic-list > .ct-div-block').find(lightboxClick);
68
69                elem.attr('data-link', 'link' + lightboxIDgroup + '-' + i);
70
71                $(OxyLightBox).attr('data-lightbox-id', lightboxIDgroup + '-' + i); 
72                lightboxInner.attr('id', '' + lightboxIDgroup + '-' + i + '-inner' );
73                lightboxInner.attr('data-idx', '' + lightboxIDgroup + '-' + i);
74
75        } else {
76
77            if ('custom' !== lightboxType) {
78
79                $(container).find(lightboxClick).attr('data-link', 'link' + lightboxIDgroup + '-' + i);
80
81            }
82
83        }
84        
85        
86        
87        // If we're doing modal functionality, no need for the link
88        if (('inline' === lightboxType) && (true === inlineContent)) {
89           // nothing
90        } else {
91             lightboxLink.attr('data-link', 'link' + lightboxIDgroup + '-' + i);
92        }
93
94        if ('inline' === lightboxType) {
95            
96            if ($(OxyLightBox).closest('.oxy-dynamic-list').length) {
97                lightboxSrc = (true !== inlineContent) ? inlineSelector : '[data-id
97x="' + lightboxIDgroup + '-' + i + '"]';
98            } else {
99                lightboxSrc = (true !== inlineContent) ? inlineSelector : '[data-idx="' + lightboxIDgroup + '"]';
100            }
101            
102        } else if ('ajax' === lightboxType) {
103
104            lightboxSrc = lightboxInner.data('src') + ' ' + lightboxFilter;
105
106        } else {
107
108            lightboxSrc = lightboxInner.data('src');
109
110        }
111        
112        clickSelector = ('custom' === lightboxType) ? lightboxClick : '[data-link="link' + lightboxIDgroup + '-' + i + '"]';
113        
114        let fancyclickSelector = ('custom' === lightboxType) ? clickSelector : '';
115
116        lbprepend = (false == lightboxInner.data('prepend')) ? lightboxparentEl : 'body';
117        lbbaseClass = (true == lightboxInner.data('prepend')) ? lbclassList : '';
118        
119        fancyboxOpts = {
120            parentEl: lbprepend,
121            selector : fancyclickSelector,
122            autoSize: false,
123            "iframe": {
124                preload: lbPreload,
125            },
126            baseClass: lbbaseClass,
127            hash: false,
128            touch: 0,
129            caption : lightboxCaption,
130            preventCaptionOverlap: false,
131            infobar: true,
132            wheel: "auto",
133            btnTpl: {
134                
135            download:
136              '<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;">' +
137              '<svg viewBox="0 0 40 40">' +
138              '<use xlink:href="#' + lbDownloadIcon + '"></use>' +
139              "</svg>" +
140              "</a>",
141
142            zoom:
143              '<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' +
144              '<svg viewBox="0 0 40 40">' +
145              '<use xlink:href="#' + lbZoomIcon + '"></use>' +
146              "</svg>" +
147              "</button>",    
148                
149            arrowLeft:
150              '<button data-fancybox-prev class="fancybox-button yes fancybox-button--arrow_left" title="{{PREV}}">' +
151              '<svg viewBox="0 0 40 40">' +
152              '<use xlink:href="#' + lbNavIcon + '"></use>' +
153              "</svg>" +   
154              "</button>",
155
156            arrowRight:
157              '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' +
158              '<svg viewBox="0 0 40 40">' +
159              '<use xlink:href="#' + lbNavIcon + '"></use>' +
160              "</svg>" +
161              "</button>",
162                
163            close:
164              '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
165              '<svg viewBox="0 0 24 24">' +
166              '<use xlink:href="#' + lbCloseIcon + '"></use>' +
167              "</svg>" +
168              "</button>", 
169
170              smallBtn:
171                '<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}">' +
172                '<svg viewBox="0 0 24 24">' +
173                '<use xlink:href="#' + lbSmallCloseIcon + '"></use>' +
174                "</svg>" +
175                "</button>",
176            },
177            
178            autoFocus: lbautofocus,
179            backFocus: lbbackfocus,
180            trapFocus: lbtrapfocus,
181            thumbs: false,
182            fullScreen: false,
183            slideShow: lbSlideshow,
184            animationEffect: 'extras',
185            transitionEffect: 'slide',
186            animationDuration: lbDuration,
187            loop: maybeLoop,
188
189            afterLoad: function( instance, slide, current ){
190                
191                
192                if (current.type === 'video') {
193                
194                    slide.$slide.find(".fancybox-iframe")
195                    
196                }
197                
198                
199                if (current.type === 'iframe') {
200                
201                    $(".fancybox-slide--video > .fancybox-content .fancybox-iframe").wrap('<div class=fancybox-content_wrapper></div>');
202
203                    // iframe
204                    slide.$slide.find(".fancybox-iframe").contents().find("#wpadminbar").hide();
205                    slide.$slide.find(".fancybox-iframe").contents().find("html").append('<style type="text/css">html { margin-top: 0!important; } </style>'); 
206                    slide.$slide.find(".fancybox-iframe").contents().find("html").addClass('extras-inside-lightbox');
207                
208                    if (typeof lbIframeSelector !== "undefined") {
209                
210                        let slideBody = slide.$slide.find(".fancybox-iframe").contents().find('body');
211
212                        slideBody.find(lbIframeSelector).prependTo(slideBody);
213
214                        slideBody.find(' > *:not(script):not(style):not(svg):not(' + lbIframeSelector + ')').hide(); 
215                        
216                    } 
217                
218                }
219                
220                if ((current.type === 'ajax') && (lbcss)) {
221                    
222                    slide.$slide.append('<link rel="stylesheet" type="text/css" href="'+ localize_extras_plugin.oxygen_directory + lbcss +' ">');
223                    
224                }
225
226                $(OxyLightBox).trigger('extras_lightbox:after_load');
227                
228            },
229           
230            beforeShow: function( instance, slide, current ) {
231                if (typeof(Event) === 'function') {
232                     window.dispatchEvent(new Event('resize'));
233                } else {
234                    $(window).trigger('resize');
235                }
236                $(OxyLightBox).trigger('extras_lightbox:visible');
237                if (typeof doExtrasReadmore == 'function') {
238                    
239                    setTimeout(function(){ 
240                        if (slide.$slide.find(".oxy-read-more-less").length) {
241                            slide.$slide.find(".oxy-read-more-inner").removeAttr("style");
242                            doExtrasReadmore(slide.$slide);
243                        }
244                        $('.oxy-read-more-link:not(:nth-child(2)').remove();
245                    }, 50);
246                    
247                }
248            },
249
250            beforeClose : function( instance, current, e ) {
251                $(OxyLightBox).trigger('extras_lightbox:close');
252                
253                if ( ( 'custom' === lightboxType ) && ( lightboxInner.attr('data-click-selector').indexOf('.oxy-carousel-builder_gallery-image') > -1 ) ) {
254                   
255                    let $carousel = $(lightboxInner.attr('data-click-selector')).closest('.oxy-carousel-builder_gallery-images');
256                    if (typeof Flickity == 'function') {
257                        $carousel.flickity( 'selectCell', $.fancybox.getInstance().currIndex );	
258                    }
259                }
260
261                setTimeout(function() {
262                    $(clickSelector + ' .oxy-lightbox_trigger').focus();
263                }, 30);
264                
265            },
266
267            toolbar: lbToolbar,
268            smallBtn: lbSmallBtn,
269            
270            buttons: [
271                "zoom",
272                "slideShow",
273                "download",
274                "close"
275              ],
276            
277            
278            tpl: {
279                closeBtn: '<a title="Close" class="fancybox-item fancybox-close myClose" href="javascript:;"></a>'
280            },
281            
282        };
283
284        if ( true === maybeSwipe ) {
285            
286            fancyboxOpts.touch = {
287                vertical: false,
288                momentum: true
289            };
290        }
291
292        if ( mobileCloseBehavior && 'close' !== mobileCloseBehavior ) {
293            
294            fancyboxOpts.mobile = {};
295
296            if ( 'backdrop' === mobileCloseBehavior ) {
297                fancyboxOpts.mobile.clickSlide = function(current, event) {
298                    return 'close';
299                };
300            }
301            
302            if ( 'content' === mobileCloseBehavior ) {
303                fancyboxOpts.mobile.clickContent = function(current, event) {
304                    return current.type === 'image' ? 'close' : false;
305                };
306                fancyboxOpts.mobile.clickSlide = function(current, event) {
307                    return current.type === 'image' ? 'toggleControls' : 'close';
308                };
309            }
310            
311            if ( 'both' === mobileCloseBehavior ) {
312                fancyboxOpts.mobile.clickSlide = function(current, event) {
313                    return 'close';
314                };
315                fancyboxOpts.mobile.clickContent = function(current, event) {
316                    return 'close';
317                };
318            }
319        } 
320
321        if ( true  === lbThumbs ) {
322
323            fancyboxOpts.thumbs = {
324                autoStart : true,
325                axis      : 'x'
326            };
327
328        }
329
330        let lightboxTypeFinal = ('video' === lightboxType) ? '' : lightboxType;
331
332        fancyboxOpt = [{
333            src: lightboxSrc,
334            type: lightboxTypeFinal,
335            opts: fancyboxOpts,
336        }];
337            
338        if ('custom' !== lightboxType) {
339            
340            //not grouping
341            if (true !== maybeMultiple) {
342                
343                $(container).find(clickSelector).off('click');
344                $(container).find(clickSelector).on('click', function(e) {
345                        if (e.target === this) {
346                            e.stopPropagation();
347                            e.preventDefault();
348                        }
349
350                        if (e.target !== this) {
351                            e.preventDefault();
352                        }
353                        
354                        $.fancybox.open(fancyboxOpt);
355
356                        $(e.target).addClass('oxy-lightbox_trigger')
357
358                });
359                
360            } else { // grouped
361                
362                let uniiiq = '[data-link="link' + lightboxIDgroup + '-' + i + '"]';
363                
364                if ('inline' === lightboxType) {
365                    
366                    $(uniiiq).attr('data-fancybox', lightboxIDgroup );
367
368                    if (true === inlineContent) {
369
370                        if ( $(OxyLightBox).closest('.oxy-dynamic-list').length) {
371
372                            $(container).find(clickSelector).attr('data-src', '#' + lightboxIDgroup + '-' + i + '-inner' );
373                            $(container).find(clickSelector).attr('data-fancybox', lightboxIDgroup );
374                            $(container).find(clickSelector).data('src', '#' + lightboxIDgroup + '-' + i + '-inner' );
375                            $(container).find(clickSelector).data('fancybox', lightboxIDgroup );
376
377                        } else {
378                            $(container).find(clickSelector).attr('data-src', '#' + lightboxIDgroup + '-inner' );
379                            $(container).find(clickSelector).attr('data-fancybox', lightboxIDgroup );
380                            $(container).find(clickSelector).data('src', '#' + lightboxIDgroup + '-inner' );
381                            $(container).find(clickSelector).data('fancybox', lightboxIDgroup );
382                        }
383
384                        // Delegated by group selector so items appended later join the gallery.
385                        fancyboxOpts.selector = '[data-fancybox="' + lightboxIDgroup + '"]';
386                        $(container).find(lightboxClick).fancybox(fancyboxOpts);
387
388                    } else {
389                        console.log('OxyExtras | Not yet support for grouping multiple inline elements');
390                    }
391                    
392                } else if ('ajax' === lightboxType) {
393
394                    if (lightboxInner.data('src')) {    
395                       $(uniiiq).attr('data-fancybox', lightboxIDgroup );
396                       $(uniiiq).data('fancybox', lightboxIDgroup );
397                       $('.oxy-lightbox_link[data-fancybox="' + lightboxIDgroup + '"]').fancybox(fancyboxOpts);
398                    }
399                    
400                } else if ('iframe' === lightboxType) {
401                    
402                    if (lightboxSrc) {
403                        $(uniiiq).attr('data-fancybox', lightboxIDgroup );
404                        $('.oxy-lightbox_link[data-fancybox="' + lightboxIDgroup + '"]').fancybox(fancyboxOpts);
405                    }
406                    
407                } else if ('video' === lightboxType) {
408                    
409                    if (lightboxSrc) {
410                        $(uniiiq).attr('data-fancybox', lightboxIDgroup );
411                        $(uniiiq).attr('data-src', lightboxSrc);
412                        $('.oxy-lightbox_link[data-fancybox="' + lightboxIDgroup + '"]').fancybox(fancyboxOpts);
413                    }
414                    
415                } else {
416                    if (lightboxSrc) {
417                        $(uniiiq).attr('data-fancybox', lightboxIDgroup );
418                        $(uniiiq).attr('data-type', lightboxType); 
419                        $(uniiiq).attr('data-src', lightboxSrc);
420                        $('.oxy-lightbox_link[data-fancybox="' + lightboxIDgroup + '"]').fancybox(fancyboxOpts);
421                    }
422                    
423                }
424               
425                
426            }
427            
428            
429        } else { // going manual
430            
431            $(container).find(clickSelector).each(function(i, OxyLightBoxClick) {
432                    
433                    var attr = $(OxyLightBoxClick).attr('href');
434                    
435                    if (typeof attr !== typeof undefined && attr !== false) {
436                        
437                        
438                        let src = $(OxyLightBoxClick).data('src');
439                        
440                        if (typeof src !== typeof undefined && src !== false) { // we have a data-src, it's a custom link
441                            
442                            let filter = $(OxyLightBoxClick).data('filter');
443                            if (filter) {
444                                $(OxyLightBoxClick).data('type', 'ajax');
445                            } else {
446                                $(OxyLightBoxClick).data('type', 'iframe');
447                            }
448                            
449                        } else { // we don't have a src. ie it's from another component
450                            
451                            if ('auto' !== lbforcetype) {
452                                
453                                $(OxyLightBoxClick).data('type', lbforcetype);
454                                
455                                $(OxyLightBoxClick).data('src', attr);
456                                
457                                if ('ajax' === lbforcetype) {
458                                    
459                                    $(OxyLightBoxClick).data('filter', lightboxFilter);
460                                }
461                                
462                            } 
463                            
464                        }
465                        
466                    }
467                    
468                });
469            
470            
471            if (true === maybeMultiple) {
472                
473                var attr = $(container).find(clickSelector).attr('href');
474                if (typeof attr !== typeof undefined && attr !== false) {
475
476                    $(container).find(clickSelector).attr('data-fancybox', lightboxID );
477
478                    $(container).find(clickSelector).fancybox(fancyboxOpts);
479                    
480                } else {
481                    // Give user error
482                    console.log('OxyExtras | Selector needs to be a link');
483                }
484                
485            } else {
486                
487                var attr = $(container).find(clickSelector).attr('href');
488                if (typeof attr !== typeof undefined && attr !== false) {
489
490                    // it's a link
491                    $(container).find(clickSelector).on('click', function(event) {
492                        
493                        let linksrc = $(this).attr('href');
494                        let linktype = '';
495                        
496                        let src = $(this).data('src');
497                        if (src) {
498                            
499                            linksrc = src;
500                            
501                            let filter = $(this).data('filter');
502                            
503                            if (filter) {
504                                linktype = 'ajax';
505                            } else {
506                                linktype = 'iframe';
507                            }
508                            
509                            linksrc = src;
510                            
511                        
512                        event.preventDefault();    
513                        event.stopPropagation();  
514                            
515                          // Has it been forced?    
516                          let fancylinksrc = ('ajax' === linktype) ? linksrc + ' ' + filter : linksrc;
517                            
518                           $.fancybox.open({
519                                src  : fancylinksrc,
520                                type  : linktype,
521                                opts : fancyboxOpts
522                            });
523                            
524                        } else {
525
526                            event.preventDefault();    
527                            event.stopPropagation(); 
528                            
529                            $.fancybox.open({
530                                src  : linksrc,
531                                opts : fancyboxOpts
532                            });
533                        }
534
535                    });
536                
537                } 
538                
539                else { // Element isnt link
540                    
541                    console.log('OxyExtras | Selector needs to be a link');
542                    
543               }     
544                
545            }
546
547        }
548
549    });
550       
551   }
552   
553   extrasLightbox('body');
554                
555    // Expose function
556    window.doExtrasLightbox = extrasLightbox;
557
558}

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.