PageSourceSearch

https://www.cpsanguido.it/wp/wp-content/themes/blessing/assets/js/blessing-custom.js?ver=1.0

js cpsanguido.it collected 2026-10-05 21:58:42 UTC 19,075 bytes, 535 lines download raw bytes

1// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
2// Blessing customize js
3// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
4(function($) { "use strict"; 
5
6    // mobile navigation
7    var mb;
8    jQuery('#menu-btn').on( "click", function() {
9        var iteration = $(this).data('iteration') || 1;
10        switch (iteration) {
11            case 1:
12                jQuery('#mainmenu').show();
13                jQuery('header').css("height", "auto");
14                mb = 1;
15                break;
16
17            case 2:
18                jQuery('#mainmenu').hide();
19                jQuery('header').css("height", "80px");
20                mb = 0;
21                break;
22        }
23        iteration++;
24        if (iteration > 2) iteration = 1;
25        $(this).data('iteration', iteration);
26    });
27
28    /* handle the adding of active class when clicked */
29    $("#menu-btn").on( "click", function(e) {
30        if (!$(this).hasClass("active")) {
31            $(this).addClass("active");
32        }else{
33            $(this).removeClass("active");
34        }
35    });
36
37    /* --------------------------------------------------
38     * Paralax Background
39     * --------------------------------------------------*/
40    var $window = $(window);
41    $('section[data-type="background"]').each(function () {
42        var $bgobj = $(this);
43        $(window).scroll(function () {
44            var yPos = -($window.scrollTop() / $bgobj.data('speed'));
45            var coords = '50% ' + yPos + 'px';
46            $bgobj.css({ backgroundPosition: coords });                
47        });
48        document.createElement("article");
49        document.createElement("section");
50    });
51
52    /* --------------------------------------------------
53     * OWL Carousel
54     * --------------------------------------------------*/  
55    $(".testi-carousel").owlCarousel({
56        singleItem: true,
57        lazyLoad: true,
58        navigation: false,
59        autoPlay : 10000, // 1 second = 1000
60        //transitionStyle : 'fade', // Remove this line, if not want using slider fade effect.
61    });
62
63    $(".custom-carousel-1").owlCarousel({
64        items: 3,
65        navigation: false,
66        pagination: false,
67    });
68
69    $(".custom-carousel-2").owlCarousel({
70        items: 3,
71        navigation: false,
72        pagination: false,
73    });
74
75    $(".post-slider").owlCarousel({
76        singleItem: true,
77        navigation: false,
78        pagination: true,
79        autoPlay : true,
80        transitionStyle : false,
81    });
82
83    /* --------------------------------------------------
84     * magnificPopup
85     * --------------------------------------------------*/    
86    // zoom gallery
87    $('.zoom-gallery').magnificPopup({
88        delegate: 'a',
89        type: 'image',
90        closeOnContentClick: false,
91        closeBtnInside: false,
92        mainClass: 'mfp-with-zoom mfp-img-mobile',
93        image: {
94            verticalFit: true,
95            titleSrc: function(item) {
96                return item.el.attr('title');
97                //return item.el.attr('title') + ' &middot; <a class="image-source-link" href="'+item.el.attr('data-source')+'" target="_blank">image source</a>';
98            }
99        },
100        gallery: {
101            enabled: true
102        },
103        zoom: {
104            enabled: true,
105            duration: 300, // don't foget to change the duration also in CSS
106            opener: function(element) {
107                return element.find('img');
108            }
109        }
110    });
111
112    $('.simple-ajax-popup-align-top').magnificPopup({
113        type: 'ajax',
114        alignTop: true,
115        overflowY: 'scroll',
116        fixedContentPos: true,
117        callbacks: {
118            beforeOpen: function() { $('html').addClass('mfp-helper'); },
119            close: function() { $('html').removeClass('mfp-helper'); }
120        },
121        gallery: {
122            enabled: true
123        },
124    });
125
126    /* Project popup content without next/previous button */
127    $('.single-ajax-popup').magnificPopup({
128        type: 'ajax',
129        alignTop: true,
130        overflowY: 'scroll',
131        fixedContentPos: true,
132        callbacks: {
133            beforeOpen: function() { $('html').addClass('mfp-helper'); },
134            close: function() { $('html').removeClass('mfp-helper'); }
135        }
136    });
137
138    // popup youtube, video, gmaps
139    $('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
140        disableOn: 700,
141        type: 'iframe',
142        mainClass: 'mfp-fade',
143        removalDelay: 160,
144        preloader: false,
145        fixedContentPos: true
146    });
147
148    // --------------------------------------------------
149    // Back To Top
150    // --------------------------------------------------
151    if ($('#back-to-top').length) {
152        var scrollTrigger = 500, // px
153        backToTop = function () {
154            var scrollTop = $(window).scrollTop();
155            if (scrollTop > scrollTrigger) {
156                $('#back-to-top').addClass('show');
157            } else {
158                $('#back-to-top').removeClass('show');
159            }
160        };            
161        backToTop();
162        $(window).on('scroll', function () {
163            backToTop();
164        });
165        $('#back-to-top').on('click', function (e) {
166            e.preventDefault();
167            $('html,body').animate({
168                scrollTop: 0
169            }, 700);
170        });    
171    }
172    // --------------------------------------------------
173    // portfolio hover
174    // --------------------------------------------------
175    $(".fx .desc").fadeTo(0, 0);
176    $(".fx .item").on("mouseenter", function() {
177        var speed = 700;
178        var w = $(this).css("height");
179        var wd = parseInt(w) - 80;
180        $(this).find(".desc").stop(true).animate({
181            'height': wd,
182            'margin-top': "20px",
183            "opacity": "100"
184        }, speed, 'easeOutCubic');
185        $(this).find(".overlay").stop(true).animate({
186            'height': "100%",
187            'margin-top': "20px"
188        }, speed, 'easeOutCubic');
189        $(this).parent().parent().find(".item").not(this).stop(
190            true).fadeTo(speed, .5);
191    }).on("mouseleave", function() {
192        var speed = 700;
193        $(this).find(".desc").stop(true).animate({
194            'height': "0px",
195            'margin-top': "0px",
196            "opacity": "0"
197        }, speed, 'easeOutCubic');
198        $(this).find(".overlay").stop(true).animate({
199            'height': "84px",
200            'margin-top': "20px"
201        }, speed, 'easeOutCubic');
202        $(this).parent().parent().find(".item").not(this).stop(
203            true).fadeTo(speed, 1);
204    });
205
206    $.fn.equalHeights = function(){
207        var max_height = 0;
208        $(this).each(function(){
209            max_height = Math.max($(this).height(), max_height);
210        });
211        $(this).each(function(){
212            $(this).height(max_height);
213        });
214    };
215    
216    $('.item-blog').equalHeights();
217
218    $('.small-pic').each(function() {
219        var w = $(this).parent().css("width");
220        var wd = (parseInt(w) - 40) / 4;
221        $(this).css("width", wd);
222        $(this).css("height", wd);
223    });
224    $('.wide-pic').each(function() {
225        var w = $(this).parent().css("width");
226        var wd = (parseInt(w) - 40) / 2;
227        $(this).css("width", wd + 10);
228        $(this).css("height", wd / 2);
229    });
230    $('.long-pic').each(function() {
231        var w = $(this).parent().css("width");
232        var wd = (parseInt(w) - 40) / 4;
233        $(this).css("width", wd);
234        $(this).css("height", wd * 2 + 10);
235    });
236
237    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
238    // fit video
239    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
240    $(".container").fitVids();
241
242    /* Blog Masonry */
243    jQuery(document).ready(function($){
244        (function ($) {             
245            var container = $('.blog-grid');                        
246            function getNumbColumns() { 
247                var winWidth = $(window).width(), 
248                    columnNumb = 1;                             
249                if (winWidth > 1500) {
250                    columnNumb = 4;
251                } else if (winWidth > 1200) {
252                    columnNumb = 3;
253                } else if (winWidth > 900) {
254                    columnNumb = 2;
255                } else if (winWidth > 600) {
256                    columnNumb = 2;
257                } else if (winWidth > 300) {
258                    columnNumb = 1;
259                }               
260                return columnNumb;
261            }           
262            
263            function setColumnWidth() { 
264                var winWidth = $(window).width(), 
265                    columnNumb = getNumbColumns(), 
266                    postWidth = Math.floor(winWidth / columnNumb);
267            }                   
268            
269            function reArrangeProjects() { 
270                setColumnWidth();
271                container.isotope('reLayout');
272            }
273                        
274            container.imagesLoaded(function () { 
275                setColumnWidth();                               
276                container.isotope( { 
277                    itemSelector : '.post', 
278                    layoutMode : 'masonry', 
279                    resizable : false 
280                } );
281            } );
282            
283            $(window).on('debouncedresize', function () { 
284                reArrangeProjects();
285                
286            } );                
287        })(jQuery);
288
289        /* Events Masonry */
290        (function ($) {             
291            var container = $('.blessing-events-grid');                        
292            function getNumbColumns() { 
293                var winWidth = $(window).width(), 
294                    columnNumb = 1;                             
295                if (winWidth > 1500) {
296                    columnNumb = 4;
297                } else if (winWidth > 1200) {
298                    columnNumb = 3;
299                } else if (winWidth > 900) {
300                    columnNumb = 2;
301                } else if (winWidth > 600) {
302                    columnNumb = 2;
303                } else if (winWidth > 300) {
304                    columnNumb = 1;
305                }               
306                return columnNumb;
307            }           
308            
309            function setColumnWidth() { 
310                var winWidth = $(window).width(), 
311                    columnNumb = getNumbColumns(), 
312                    postWidth = Math.floor(winWidth / columnNumb);
313            }                   
314            
315            function reArrangeProjects() { 
316                setColumnWidth();
317                container.isotope('reLayout');
318            }
319                        
320            container.imagesLoaded(function () { 
321                setColumnWidth();                               
322                container.isotope( { 
323                    itemSelector : '.event-item', 
324                    layoutMode : 'masonry', 
325                    resizable : false 
326                } );
327            } );
328            
329            $(window).on('debouncedresize', function () { 
330                reArrangeProjects();
331                
332            } );                
333        })(jQuery);
334
335        /* Images Masonry */
336        (function ($) {             
337            var container = $('#gallery-isotope');                        
338            function getNumbColumns() { 
339                var winWidth = $(window).width(), 
340                    columnNumb = 1;                             
341                if (winWidth > 1500) {
342                    columnNumb = 4;
343                } else if (winWidth > 1200) {
344                    columnNumb = 3;
345                } else if (winWidth > 900) {
346                    columnNumb = 2;
347                } else if (winWidth > 600) {
348                    columnNumb = 2;
349                } else if (winWidth > 300) {
350                    columnNumb = 1;
351                }               
352                return columnNumb;
353            }           
354            
355            function setColumnWidth() { 
356                var winWidth = $(window).width(), 
357                    columnNumb = getNumbColumns(), 
358                    postWidth = Math.floor(winWidth / columnNumb);
359            }                   
360            
361            function reArrangeProjects() { 
362                setColumnWidth();
363                container.isotope('reLayout');
364            }
365                        
366            container.imagesLoaded(function () { 
367                setColumnWidth();                               
368                container.isotope( { 
369                    itemSelector : '.item', 
370                    layoutMode : 'masonry', 
371                    resizable : false 
372                } );
373            } );
374            
375            $(window).on('debouncedresize', function () { 
376                reArrangeProjects();
377                
378            } );                
379        })(jQuery);
380    });
381
382    /* DebouncedResize Function */
383    (function ($) { 
384        var $event = $.event, 
385            $special, 
386            resizeTimeout;                      
387        $special = $event.special.debouncedresize = { 
388            setup : function () { 
389                $(this).on('resize', $special.handler);
390            }, 
391            teardown : function () { 
392                $(this).off('resize', $special.handler);
393            }, 
394            handler : function (event, execAsap) { 
395                var context = this, 
396                    args = arguments, 
397                    dispatch = function () { 
398                        event.type = 'debouncedresize';                         
399                        $event.dispatch.apply(context, args);
400                    };                                      
401                if (resizeTimeout) {
402                    clearTimeout(resizeTimeout);
403                }                                       
404                execAsap ? dispatch() : resizeTimeout = setTimeout(dispatch, $special.threshold);
405            }, 
406            threshold : 150 
407        };
408    })(jQuery);
409
410    $('.animated').fadeTo(0, 0);
411
412    // - - - - - - - - - -
413    $('#gallery-isotope .item').each(function() {
414        $(this).find(".overlay").fadeTo(1, 0);
415        $(this).find("img").css("width", "100%");
416        $(this).find("img").css("height", "auto");
417        $(this).find("img").on('load', function() {
418            var w = $(this).css("width");
419            var h = $(this).css("height");
420            $(this).parent().find(
421                ".overlay").css("width", w);
422            $(this).parent().find(
423                ".overlay").css("height", h);
424        }).each(function() {
425            if (this.complete) $(this).load();
426        });
427    });
428
429    // - - - - - - - - - -
430    $("#gallery-isotope .item").on("mouseenter", function() {
431        $(this).find(".overlay").stop().fadeTo(300,.5);
432    }).on("mouseleave", function() {
433        $(this).find(".overlay").stop().fadeTo(300,0);
434    })
435
436    // - - - - - - - - - -
437    $('.f_box').each(function() {
438        $(this).find("img").on('load', function() {
439            var w = parseInt($(this).css(
440                "width"));
441            var h = parseInt($(this).css(
442                "height"));
443            var w_box = parseInt($(this).parent()
444                .parent().css("width"));
445            var wx = w_box - w;
446            var f = $(this).parent().parent();
447            var t = $(this).parent().parent().find(
448                ".text");
449            t.css("margin-top", h / 2 - (t.height() /
450                2));
451            t.css("width", wx);
452            if (f.hasClass("f_left")) {
453                t.css("left", wx / 2 - (t.width() /
454                    2));
455            } else {
456                t.css("right", wx / 2 - (t.width() /
457                    2));
458            }
459        }).each(function() {
460            if (this.complete) $(this).load();
461        });
462    });
463
464    $('.custom-col-2').each(function() {
465        $(this).find("img").css("width", "100%");
466        $(this).find("img").css("height", "auto");
467        $(this).find("img").fadeTo(0, .5);
468        $(this).find("img").on('load', function() {
469            var w = $(this).css("width");
470            var h = $(this).css("height");
471            $(this).parent().find(
472                ".overlay").css("width", w);
473            var n = $(this).parent().find(
474                ".centered");
475            var hn = (parseInt(h) - parseInt(n.css(
476                'height'))) / 2;
477            var wn = (parseInt(w) - parseInt(n.css(
478                'width')) / 2) / 2;
479            n.css("top", hn);
480            n.css("left", wn);
481        }).each(function() {
482            if (this.complete) $(this).load();
483        });
484    });
485
486    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
487    $('.event-list li').each(function() {
488        $(this).find("img").on('load', function() {
489            var w = parseInt($(this).css(
490                "width"));
491            var h = parseInt($(this).css(
492                "height"));
493            var t = $(this).parent().parent().find(
494                ".text");
495            var s = $(this).parent().parent().find(
496                ".date");
497            t.css("margin-top", h / 2 - (t.height() /
498                2));
499            s.css("margin-top", h / 2 - (s.height() /
500                2));
501            s.css("margin-left", w / 2 - (s.width() /
502                2));
503        }).each(function() {
504            if (this.complete) $(this).load();
505        });
506    });
507
508    $(".event-list li").hover(function() {
509        $(this).find("img").stop(true).fadeTo(200,
510            1);
511        $(this).find(".date").stop(true).fadeTo(
512            200, 0);
513    }, function() {
514        $(this).find(".date").stop(true).fadeTo(
515            200, 1);
516    });   
517
518    var mediaElements = document.querySelectorAll('video, audio');
519    for (var i = 0, total = mediaElements.length; i < total; i++) {
520        var features = [ 'playpause', 'current', 'progress', 'duration', 'volume'];
521        // To demonstrate the use of Chromecast with audio
522        if (mediaElements[i].tagName === 'AUDIO') {
523            features.push('chromecast');
524        }
525        new MediaElementPlayer(mediaElements[i], {
526            // This is needed to make Jump Forward to work correctly
527            pluginPath: 'https://cdnjs.cloudflare.com/ajax/libs/mediaelement/4.2.5/',
528            shimScriptAccess: 'always',
529            autoRewind: false,
530            features: features,
531            currentMessage: 'Now playing:'
532        });
533    }
534
535})(jQuery);

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.