PageSourceSearch

https://www.peaceforlifeghana.org/wp-content/themes/ngo-charity-fundraising-pro/assets/js/custom.js?ver=2.3

js peaceforlifeghana.org collected 2026-10-02 01:10:03 UTC 22,611 bytes, 644 lines download raw bytes

1function get_sticky_header(){
2
3    var slide_in_animation_class = bizberg_object.slide_in_animation ? ' animated slideInDown' : '';
4
5    if ( jQuery(window).scrollTop() > 50 && bizberg_object.primary_header_layout != 'center' ) {
6        jQuery('nav.navbar-default').addClass('sticky ' + slide_in_animation_class);
7        add_remove_body_sticky_class( 'remove' );
8    } 
9    else if( bizberg_object.primary_header_layout == 'center' && jQuery(window).scrollTop() > jQuery('.primary_header_2_wrapper').outerHeight() ){
10        jQuery('nav.navbar-default').addClass('sticky ' + slide_in_animation_class);
11        add_remove_body_sticky_class( 'remove' );
12    }
13    else {
14        jQuery('nav.navbar-default').removeClass('sticky ' + slide_in_animation_class);
15        add_remove_body_sticky_class( 'add' );
16    }
17
18    /* For Transparent Header */
19    if( bizberg_object.is_transparent_header == 'true' && jQuery(window).scrollTop() > 50 ){
20        jQuery('nav.navbar-default').addClass( 'transparent_header_sticky');
21    } else {
22        jQuery('nav.navbar-default').removeClass( 'transparent_header_sticky');
23    }
24
25}
26
27function add_remove_body_sticky_class( status ){
28
29    if( bizberg_object.is_transparent_header == 'true' ){
30
31        if( status == 'add' ){
32            jQuery('body').addClass('bizberg_sticky_header_enabled');
33            jQuery('body').removeClass('bizberg_sticky_header_disabled');
34        } else {
35            jQuery('body').removeClass('bizberg_sticky_header_enabled');
36            jQuery('body').addClass('bizberg_sticky_header_disabled');
37        }
38
39    }
40
41}
42
43(function($){
44
45	"use strict";
46
47    var $window = $(window);
48    $window.on( 'load', function () {
49        
50        $("#status").fadeOut();
51        $("#preloader").delay(350).fadeOut("slow");
52        $("body").delay(350).css({ "overflow": "visible" });
53
54        /* Preloader */
55        
56        $("#status").fadeOut();
57        $("#preloader").delay(350).fadeOut("slow");
58
59        /* END of Preloader */
60
61    });
62
63    // Add class if menu has desctiption
64    jQuery('#responsive-menu li').each(function(){
65
66        if( jQuery('nav #navbar').hasClass( 'has-menu-description' ) ){
67            return false;
68        }
69
70        if( jQuery(this).find('a span').hasClass('sub') ){
71            jQuery('nav #navbar').addClass( 'has-menu-description' );
72            jQuery('nav #navbar').removeClass( 'has-no-menu-description' );
73        } else {
74            jQuery('nav #navbar').addClass('has-no-menu-description');
75        }
76
77    });
78
79    var $main_header = $('.main_h');
80
81    // If parent menu has submenu then add down arrow
82    jQuery('#responsive-menu > li').each(function(){
83        if( jQuery(this).find('ul').hasClass('sub-menu') ){
84            jQuery(this).find('ul:first').prev('a').find('.eb_menu_title').append('<i class="has_sub_menu_parent fa fa-angle-down"></i>');
85        }
86    });
87
88    $(window).on( 'scroll load resize' , function(event) {
89        event.preventDefault();
90
91        if( bizberg_object.sticky_header_status == 'false' ){
92            return;
93        }
94
95        // IF page template is sticky
96        get_sticky_header();
97    });
98
99    // Mobile Navigation
100    $('.mobile-toggle').on( 'click' , function(event) {
101        event.preventDefault();
102        if ($main_header.hasClass('open-nav')) {
103            $main_header.removeClass('open-nav');
104        } 
105        else {
106            $main_header.addClass('open-nav');
107        }
108    });
109
110    $('.main_h li a').on( 'click' , function(event) {
111        event.preventDefault();
112        if ($main_header.hasClass('open-nav')) {
113            $('.navigation').removeClass('open-nav');
114            $main_header.removeClass('open-nav');
115        }
116    });
117
118    // navigation scroll lijepo radi materem
119    // $('nav a').on( 'click' , function(event) {
120    //     event.preventDefault();
121    //     var id = $(this).attr("href");
122    //     var offset = 70;
123    //     var target = $(id).offset().top - offset;
124    //     $('html, body').animate({
125    //         scrollTop: target
126    //     }, 500);
127    //     event.preventDefault();
128    // });
129
130    // contact form
131    $(document).on( 'submit' , '#main-contact-form1', function(e){
132        e.preventDefault();
133        $.ajax({
134            url: "mail/contact.php",
135            type:   'POST',
136            data: $('#main-contact-form1').serialize(),
137            success: function(msg){
138                $( '#mail_success_message' ).empty().html( msg ).show();
139            },
140        });
141        return;
142    }); 
143
144    $(' #da-thumbs > li ').each( function() { 
145        $(this).hoverdir(); 
146    });
147
148    /**
149    * Slicknav - a Mobile Menu
150    */
151    var $slicknav_label;
152    $('#responsive-menu').slicknav({
153        duration: 500,
154        closedSymbol: '<i class="fa fa-plus"></i>',
155        openedSymbol: '<i class="fa fa-minus"></i>',
156        prependTo: '#slicknav-mobile',
157        allowParentLinks: true,
158        nestedParentLinks : false,
159        label:"" 
160    });
161
162    // Mouse-enter dropdown
163    $('#navbar li').on("mouseenter focusin", function() {
164        if( $(this).hasClass('bizberg_shop_browse_cat') && $(this).hasClass('show') && $('body').hasClass('page-template-home') ){
165            return;
166        }
167        $(this).find('ul').first().stop(true, true).delay(350).slideDown(500);
168    });
169    // Mouse-leave dropdown
170    $('#navbar li').on("mouseleave focusout", function() {
171        if( $(this).hasClass('bizberg_shop_browse_cat') && $(this).hasClass('show') && $('body').hasClass('page-template-home') ){
172            return;
173        }
174        $(this).find('ul').first().stop(true, true).delay(100).slideUp(150);
175    });
176
177    /**
178     *  Arrow for Menu has sub-menu
179     */
180    if ($(window).width() > 992) {
181        $(".navbar-arrow ul ul > li").has("ul").children("a").append("<i class='arrow-indicator fa fa-angle-right'></i>");
182    }
183
184     $(document).ready(function() {
185      $('.progress .progress-bar').css("width",
186                function() {
187                    return $(this).attr("aria-valuenow") + "%";
188                }
189        )
190    });
191
192    $(window).on( 'scroll' , function(){
193        if($(window).scrollTop() > 500){
194            $("#back-to-top").fadeIn(200);
195        } else{
196            $("#back-to-top").fadeOut(200);
197        }
198    });
199
200    $(document).on("click",'#back-to-top a',function() {
201        $('html, body').animate({ scrollTop:0 },'slow');
202        return false;
203    }); 
204
205    setTimeout(function(){ 
206
207        var $grid = '';
208        if( jQuery('.blog-lists').hasClass('blog-nosidebar-1') ){
209            $grid = jQuery('.blog-nosidebar-1 #content').masonry({
210                itemSelector: '.blog-listing'
211            });  
212            $grid.imagesLoaded().progress( function() {
213                $grid.masonry('layout');
214            })  
215        }        
216
217        if( jQuery('.blog-lists').hasClass('blog-nosidebar') ){
218            $grid = jQuery('.blog-nosidebar #content').masonry({
219                itemSelector: '.blog-listing'
220            });
221            $grid.imagesLoaded().progress( function() {
222                $grid.masonry('layout');
223            })
224        }        
225
226    }, 500); 
227
228    bizberg_post_slider();
229
230    jQuery("body").prognroll({
231        color: "#f75691"
232    });
233
234    jQuery('.prognroll-bar').appendTo('nav.navbar-default');
235
236    if( bizberg_object.sticky_sidebar_status == true ){
237
238        var sticky_sidebar_margin_top_status = parseInt( bizberg_object.sticky_sidebar_margin_top_status );
239
240        jQuery('.bizberg_blog_content,.bizberg_sidebar').theiaStickySidebar({
241            additionalMarginTop : sticky_sidebar_margin_top_status,
242            additionalMarginBottom : bizberg_object.sticky_sidebar_margin_bottom_status,
243            minWidth : 900
244        });
245
246    }
247
248})(jQuery);
249
250function bizberg_post_slider(){
251
252    // swiper slider
253
254    var interleaveOffset = 0.5;
255    var swiperOptions = {
256        loop: bizberg_object.slider_loop,
257        speed: parseInt( bizberg_object.slider_speed ) * 1000,
258        grabCursor: bizberg_object.slider_grab_n_slider,
259        SlidesPerView: 1,
260        watchSlidesProgress: true,
261        mousewheelControl: false,
262        keyboardControl: false,
263        allowTouchMove: bizberg_object.slider_grab_n_slider,
264        watchOverflow: true,
265        pagination: {
266            el: '.swiper-pagination',
267            clickable: true,
268        },
269        navigation: {
270            nextEl: ".swiper-button-next",
271            prevEl: ".swiper-button-prev"
272        },
273        autoplay: {
274            delay: parseInt( bizberg_object.autoplay_delay ) * 1000,
275        },
276        fadeEffect: {
277            crossFade: true
278        },
279        on: {
280            progress: function() {
281
282                // Ignore for rtl
283                if( bizberg_object.rtl == true ){
284                    return;
285                }
286
287                // Ignore for firefox
288                if (navigator.userAgent.indexOf("Firefox") <= 0) {
289
290                    var swiper = this;
291                    for (var i = 0; i < swiper.slides.length; i++) {
292                        var slideProgress = swiper.slides[i].progress;
293                        var innerOffset = swiper.width * interleaveOffset;
294                        var innerTranslate = slideProgress * innerOffset;
295                        swiper.slides[i].querySelector(".slide-inner").style.transform = "translate3d(" + innerTranslate + "px, 0, 0)";
296                    } 
297
298                }
299
300            },
301            touchStart: function() {
302
303                // Ignore for rtl
304                if( bizberg_object.rtl == true ){
305                    return;
306                }
307
308                // Ignore for firefox
309                if (navigator.userAgent.indexOf("Firefox") <= 0) {
310
311                    var swiper = this;
312                    for (var i = 0; i < swiper.slides.length; i++) {
313                        swiper.slides[i].style.transition = "";
314                    }
315
316                }
317
318            },
319            setTransition: function(speed) {
320
321                // Ignore for rtl
322                if( bizberg_object.rtl == true ){
323                    return;
324                }
325
326                // Ignore for firefox
327                if (navigator.userAgent.indexOf("Firefox") <= 0) {
328
329                    var swiper = this;
330                    for (var i = 0; i < swiper.slides.length; i++) {
331                        swiper.slides[i].style.transition = speed + "ms";
332                        swiper.slides[i].querySelector(".slide-inner").style.transition = speed + "ms";
333                    }
334
335                }
336                
337            }
338        }
339    };
340
341    var swiper = new Swiper(".swiper-container-bizberg", swiperOptions);
342        
343}
344
345// Photo gallery instagram style
346
347jQuery(function($) {
348
349    var updateArrows = function(){
350        $('.carouselGallery-right').removeClass('disabled');
351        $('.carouselGallery-left').removeClass('disabled');
352        var curIndex = $('.carouselGallery-carousel.active').data('index');
353        updateArrows.nbrOfItems = updateArrows.nbrOfItems || $('.carouselGallery-carousel').length -1;
354
355        curIndex === updateArrows.nbrOfItems && $('.carouselGallery-right').addClass('disabled');
356        curIndex === 0 && $('.carouselGallery-left').addClass('disabled');
357    }
358    $('.carouselGallery-carousel').on('click', function(e){
359        scrollTo = $('body').scrollTop();
360       $('body').addClass('noscroll');
361       $('body').css('position', 'fixed');
362        $('.carouselGallery-col-1, .carouselGallery-col-2').removeClass('active');
363        $(this).addClass('active');
364        showModal($(this));
365        updateArrows();
366    });
367
368    $('body').on('click', '.carouselGallery-right, .carouselGallery-left', function(e){
369        if($(this).hasClass('disabled')) return;
370        var curIndex = $('.carouselGallery-carousel.active').data('index');
371        var nextItemIndex = parseInt(curIndex+1);
372        if($(this).hasClass('carouselGallery-left')){
373            nextItemIndex-=2;
374        }
375        var nextItem = $('.carouselGallery-carousel[data-index='+nextItemIndex+']');
376
377        if(nextItem.length > 0){
378            $('.carouselGallery-col-1, .carouselGallery-col-2').removeClass('active');
379            $('body').find('.carouselGallery-wrapper').remove();
380            showModal($(nextItem.get(0)));
381            nextItem.first().addClass('active');
382        }
383        updateArrows();
384    });
385
386    var modalHtml = '';
387    showModal = function(that){
388
389        var username = that.data('username'),
390        location = that.data('location'),
391        imagetext = that.data('imagetext'),
392        likes =  that.data('likes'),
393        imagepath = that.data('imagepath'),
394        carouselGalleryUrl = that.data('url');
395        postURL =  that.data('posturl');
396
397        maxHeight = $(window).height()-100;
398
399        if ($('.carouselGallery-wrapper').length === 0) {
400            if(typeof imagepath !== 'undefined') {
401                modalHtml = "<div class='carouselGallery-wrapper'>";
402                modalHtml += "<div class='carouselGallery-modal'><span class='carouselGallery-left'><span class='icons icon-arrow-left6'></span></span><span class='carouselGallery-right'><span class='icons icon-arrow-right6'></span></span>";
403                modalHtml += "<div class='container'>";
404                modalHtml += "<span class='icons iconscircle-cross close-icon'></span>";
405                modalHtml += "<div class='carouselGallery-scrollbox' style='max-height:"+maxHeight+"px'><div class='carouselGallery-modal-image'>";
406                modalHtml += "<img src='"+imagepath+"' alt='carouselGallery image'>";
407                modalHtml += "</div>";
408                modalHtml += "<div class='carouselGallery-modal-text'>";
409                modalHtml += "<span class='carouselGallery-modal-username'><a href='javascript:void(0)'>"+username+"</a> </span>"
410                modalHtml += "<span class='carouselGallery-modal-location'>"+location+"</span>";
411                modalHtml += "<span class='carouselGallery-modal-imagetext'>";
412                modalHtml += "<p>"+imagetext+"</p>";
413                modalHtml += "</span></div></div></div></div></div>";
414                $('body').append(modalHtml).fadeIn(2500);
415            }
416        }
417    };
418
419    $('body').on( 'click','.carouselGallery-wrapper', function(e) {
420        if($(e.target).hasClass('.carouselGallery-wrapper')){
421            removeModal();
422        }
423    });
424    $('body').on('click', '.carouselGallery-modal .iconscircle-cross', function(e){
425        removeModal();
426    });
427
428     var removeModal = function(){
429        $('body').find('.carouselGallery-wrapper').remove();
430        $('body').removeClass('noscroll');
431        $('body').css('position', 'static');
432        $('body').animate({scrollTop: scrollTo}, 0);
433    };
434
435    // Avoid break on small devices
436    var carouselGalleryScrollMaxHeight = function() {
437        if ($('.carouselGallery-scrollbox').length) {
438            maxHeight = $(window).height()-100;
439            $('.carouselGallery-scrollbox').css('max-height',maxHeight+'px');
440        }
441    }
442    $(window).resize(function() { // set event on resize
443        clearTimeout(this.id);
444        this.id = setTimeout(carouselGalleryScrollMaxHeight, 100);
445    });
446    document.onkeydown = function(evt) {
447        evt = evt || window.event;
448        if (evt.keyCode == 27) {
449            removeModal();
450        }
451    };
452
453    $('.comment-reply-link').addClass('btn-sm btn btn-primary');
454
455});
456
457function getTestimonialScrollbar( selector ){
458    var custom = new scrollbot( selector );
459    setScrollStyles(custom);
460}
461
462function setScrollStyles(custom3){
463
464    custom3.setStyle({height:2});
465    var onscrollfollower = document.createElement("div");
466    onscrollfollower.style.width = "100%";
467    onscrollfollower.style.height = "100%";
468    onscrollfollower.style.backgroundColor = "#222222";
469    onscrollfollower.style.position = "absolute";
470    onscrollfollower.style.bottom = "100%";
471    onscrollfollower.style.right = 0;
472    custom3.scrollBarHolder.appendChild(onscrollfollower);
473    custom3.onScroll(function(){onscrollfollower.style.bottom = 100 - parseFloat(this.scrollBar.style.top) + "%";})
474
475}
476
477// Search in header.
478jQuery(document).on('click','.search-icon,.mobile_search_icon', function(e){
479    e.preventDefault();
480    jQuery('.full-screen-search').slideToggle();
481});
482
483jQuery(document).on('click','.full-screen-search .close',function(){
484    jQuery('.full-screen-search').slideToggle('fast');
485})
486
487// Close search on esc
488jQuery(document).keyup(function(e) {
489  if (e.keyCode == 27) { jQuery('.full-screen-search').slideUp('fast'); }   // esc
490});
491
492jQuery(window).on( 'scroll load resize', function() {
493
494    /**
495    * Fixed mobile menu
496    */
497
498    setTimeout(function(){ 
499
500        var scrollTop = jQuery('header > nav.navbar').outerHeight();    
501    
502        jQuery('ul.slicknav_nav').css({
503            'top' :  scrollTop + 'px'
504        });
505
506    }, 100);
507    
508});
509
510jQuery(document).on(
511    'focusin',
512    '.navbar-nav > li', 
513    function(){
514        var selector_li_id = jQuery(this).attr('id');
515        jQuery( 'head' ).append('<span class="navbar_li_background"><style>.navbar-default .navbar-nav > li#' + selector_li_id + '{background:' + bizberg_object.header_menu_color_hover + '} .navbar-default .navbar-nav > li#' + selector_li_id + ' > a{ color:#fff; }' + '</style></span>');
516    }
517).on(
518    'focusout',
519    '.navbar-nav > li', 
520    function(){
521        jQuery('.navbar_li_background').remove();
522    }
523);
524
525jQuery(document).on(
526    'mouseenter focusin',
527    'header .navbar-default .navbar-nav li a', 
528    function(){
529        // Remove Border
530        var selector_li_id = jQuery(this).closest('li.parent_menu_bizberg').prev('li').attr('id');
531        jQuery( 'head' ).append('<span class="hide_prev_menu_separator"><style>.navbar-default .navbar-nav > li#' + selector_li_id + ' > a:after{display:none}</style></span>');
532    }
533).on(
534    'mouseleave focusout',
535    'header .navbar-default .navbar-nav li a', 
536    function(){
537        jQuery('.hide_prev_menu_separator').remove();
538    }
539);
540
541jQuery(document).on(
542    'mouseenter focusin',
543    'header .navbar-default:not(.transparent_header_sticky) .navbar-nav > li > ul > li > a,header .navbar-default:not(.transparent_header_sticky) .navbar-nav > li > ul > li > ul > li > a,header .navbar-default:not(.transparent_header_sticky) .navbar-nav > li > ul > li > ul > li > ul > li > a',
544    function(){
545
546    var selector = jQuery(this).parents('ul.sub-menu').last().closest('li').find('a:first');
547    var selector_li_id = jQuery(this).parents('ul.sub-menu').last().closest('li').attr('id');
548
549    if( bizberg_object.is_transparent_header == 'true' ){
550        selector.attr(
551            'style' , 'border-color:' + bizberg_object.header_menu_color_hover
552        );
553    } else if( jQuery('.navbar-default').hasClass('sticky') ){ // Normal sticky menu
554        selector.attr(
555            'style' , 'border-color:' + bizberg_color_luminance( bizberg_object.header_menu_color_hover_sticky , -0.2 )
556        );
557    } else { // No sticky menu
558        selector.attr(
559            'style' , 'border-color:' + bizberg_color_luminance( bizberg_object.header_menu_color_hover , -0.2 )
560        );
561    }
562
563    jQuery( 'head' ).append('<span class="hide_menu_separator"><style>.navbar-default .navbar-nav > li#' + selector_li_id + ' > a:after{display:none}</style></span>');
564
565}).on(
566'mouseleave focusout',
567'header .navbar-default:not(.transparent_header_sticky) .navbar-nav > li > ul > li > a,header .navbar-default:not(.transparent_header_sticky) .navbar-nav > li > ul > li > ul > li > a,header .navbar-default:not(.transparent_header_sticky) .navbar-nav > li > ul > li > ul > li > ul > li > a', 
568function(){
569
570    var selector = jQuery(this).parents('ul.sub-menu').last().closest('li').find('a:first');
571    selector.removeAttr('style');
572    jQuery('.hide_menu_separator').remove();
573
574});
575
576function bizberg_color_luminance(hex, lum) {
577    // validate hex string
578    hex = String(hex).replace(/[^0-9a-f]/gi, '');
579    if (hex.length < 6) {
580        hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
581    }
582    lum = lum || 0;
583    // convert to decimal and change luminosity
584    var rgb = "#", c, i;
585    for (i = 0; i < 3; i++) {
586        c = parseInt(hex.substr(i*2,2), 16);
587        c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
588        rgb += ("00"+c).substr(c.length);
589    }
590    return rgb;
591}
592
593jQuery(document).ready(function($){
594
595    $.exists = function(selector) {
596        return ($(selector).length > 0);
597    }
598
599    if ( $.exists('#tf-partical-wrap') ) {
600        
601        // Some random colors
602        const colors = bizberg_object.flying_balls_colors;
603
604        const numBalls = 50;
605        const balls = [];
606
607        for (let i = 0; i < numBalls; i++) {
608            let ball = document.createElement('div');
609            ball.classList.add('tf-ball');
610            ball.style.background = colors[Math.floor(Math.random() * colors.length)];
611            ball.style.left = `${Math.floor(Math.random() * 100)}vw`;
612            ball.style.top = `${Math.floor(Math.random() * 100)}vh`;
613            ball.style.transform = `scale(${Math.random()})`;
614            ball.style.width = `${Math.random()}em`;
615            ball.style.height = ball.style.width;
616          
617            balls.push(ball);
618            document.getElementById('tf-partical-wrap').append(ball);
619        }
620
621        // Keyframes
622        balls.forEach((el, i, ra) => {
623          let to = {
624            x: Math.random() * (i % 2 === 0 ? -11 : 11),
625            y: Math.random() * 12
626          };
627
628          let anim = el.animate(
629            [
630              { transform: 'translate(0, 0)' },
631              { transform: `translate(${to.x}rem, ${to.y}rem)` }
632            ],
633            {
634              duration: (Math.random() + 1) * 3000, // random duration
635              direction: 'alternate',
636              fill: 'both',
637              iterations: Infinity,
638              easing: 'ease-in-out'
639            }
640          );
641        });
642    }
643
644});

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.