PageSourceSearch

https://risefm.co.za/wp-content/themes/fmwave/assets/js/main.js?ver=2.9.5

js risefm.co.za collected 2026-10-02 20:39:40 UTC 25,527 bytes, 717 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    //function Load
5    function fmwave_scripts_load() {
6
7        // audio view count
8        $( document ).ready(function() {
9
10            $('a.print-share-button').on('click', function(e){
11                e.preventDefault();
12                $('header.header').hide();
13                window.print();
14                $('header.header').show();
15                return false;
16            });
17
18             $('.item-action button').on('click', function() {
19                 let post_id = $(this).closest( ".item-action").data('post-id');
20                 let $this = $(this);
21                 $this.closest('.audio-container').toggleClass('icon-play');
22                 $('.mejs-pause').closest('.audio-container.icon-play').removeClass('icon-play');
23            
24                $.ajax({
25                    type: "post",
26                    dataType: "json",
27                    url: ThemeObj.ajaxurl,
28                    data: {
29                        action: 'audio_view_count',
30                        post_id: post_id,
31                    },
32                    success: function(data){
33                        if( data.success ) {
34                            let total_view = data.data;
35                            if ( total_view >= 10 ) {
36                                $this.closest( ".audio-container").find('i.fas').addClass('fa-caret-up');
37                            } else {
38                                $this.closest( ".audio-container").find('i.fas').addClass('fa-caret-down');
39                            }
40                        }
41                    }
42                });
43            });
44			
45        });
46
47        /*------------------------------
48        Music Player - js
49        ------------------------------ */
50        $('.fmwave-audio-track').each(function () {
51            new MediaElementPlayer($(this).get(0), {
52                    startVolume: 0.8,
53                    features: ['playpause', 'progress'],
54                    autoRewind: true,
55                    autoplay: true,
56                    audioWidth: 250,
57                    audioHeight: 40,
58                    controls: false,
59                    loop: true,
60                }
61            )
62        });
63
64        $('.fmwave-audio-full-track').each(function () {
65            new MediaElementPlayer($(this).get(0), {
66                    startVolume: 0.8,
67                }
68            )
69        });
70
71        $('.fmwave-audio-plybtn').each(function () {
72            new MediaElementPlayer($(this).get(0), {
73                    startVolume: 0.8,
74                    features: ['playpause'],
75                    audioWidth: 50,
76                    audioHeight: 40,
77                }
78            )
79        });
80
81        $('.mejs-button > button').each(function () {
82            // console.log('ffff');
83            $(this).on('click', function() {
84                // let test = $(this).closest('.mejs-container');
85                // console.log(test);
86                console.log(355345);
87            });
88        });
89
90        /*-------------------------------------
91        Offcanvas Menu activation code
92        -------------------------------------*/
93        $('#wrapper').on('click', '.offcanvas-menu-btn', function (e) {
94            e.preventDefault();
95            var $this = $(this),
96                wrapper = $(this).parents('body').find('>#wrapper'),
97                wrapMask = $('<div />').addClass('offcanvas-mask'),
98                offCancas = $('#offcanvas-wrap'),
99                position = offCancas.data('position') || 'top';
100
101            if ($this.hasClass('menu-status-open')) {
102                wrapper.addClass('open').append(wrapMask);
103                $this.removeClass('menu-status-open').addClass('menu-status-close');
104                offCancas.css({
105                    'visibility': 'visible',
106                    'opacity': '1',
107                    'top': '50%',
108                    'height': '100%'
109                });
110            } else {
111                removeOffcanvas();
112            }
113
114            function removeOffcanvas() {
115                wrapper.removeClass('open').find('> .offcanvas-mask').remove();
116                $this.removeClass('menu-status-close').addClass('menu-status-open');
117                if (position === 'top') {
118                    offCancas.css({
119                        'visibility': 'hidden',
120                        'opacity': '0',
121                        'top': '0',
122                        'height': '0'
123
124                    });
125                } else {
126                    offCancas.css({
127                        'visibility': 'hidden',
128                        'opacity': '0',
129                        'top': '0',
130                        'height': '0'
131                    });
132                }
133            }
134
135            $(".offcanvas-mask, .offcanvas-close").on('click', function () {
136                removeOffcanvas();
137            });
138
139            return false;
140        });
141		
142        /*Slider Script*/
143        if ($.fn.nivoSlider) {
144			$('#ensign-nivoslider-3').nivoSlider({
145
146				effect: 'fold', // Specify sets like
147				slices: 15, // For slice animations
148				boxCols: 8, // For box animations
149				boxRows: 4, // For box animations
150				animSpeed: 1000, // Slide transition speed
151				pauseTime: 9000, // How long each slide will show
152				startSlide: 0, // Set starting Slide (0 index)
153				directionNav: true, // Next & Prev navigation
154				controlNav: false, // 1,2,3... navigation
155				controlNavThumbs: false, // Use thumbnails for Control Nav
156				pauseOnHover: false, // Stop animation while hovering
157				manualAdvance: true, // Force manual transitions
158				prevText: 'Prev', // Prev directionNav text
159				nextText: 'Next', // Next directionNav text
160				randomStart: false, // Start on a random slide
161				beforeChange: function () {
162				}, // Triggers before a slide transition
163				afterChange: function () {
164				}, // Triggers after a slide transition
165				slideshowEnd: function () {
166				}, // Triggers after all slides have been shown
167				lastSlide: function () {
168				}, // Triggers when last slide is shown
169				afterLoad: function () {
170				} // Triggers when slider has loaded
171
172			});
173
174			if ($('.zoom-gallery').length) {
175				$('.zoom-gallery').each(function() {
176					$(this).magnificPopup({
177						delegate: 'a.popup-zooms',
178						type: 'image',
179						gallery: {
180							enabled: true
181						}
182					});
183				});
184			}
185		}
186
187        $('.offcanvas-menu, .menu-list').on('click', '.menu-item>a', function (e) {
188            if ($(this).parents('body').hasClass('has-offcanvas')) {
189                var animationSpeed = 500,
190                    subMenuSelector = '.sub-menu',
191                    $this = $(this),
192                    checkElement = $this.next();
193                if (checkElement.is(subMenuSelector) && checkElement.is(':visible')) {
194                    checkElement.slideUp(animationSpeed, function () {
195                        checkElement.removeClass('menu-open');
196                    });
197                    checkElement.parent(".menu-item").removeClass("active");
198                } else if ((checkElement.is(subMenuSelector)) && (!checkElement.is(':visible'))) {
199                    var parent = $this.parents('ul').first();
200                    var ul = parent.find('ul:visible').slideUp(animationSpeed);
201                    ul.removeClass('menu-open');
202                    var parent_li = $this.parent("li");
203                    checkElement.slideDown(animationSpeed, function () {
204                        checkElement.addClass('menu-open');
205                        parent.find('.menu-item.active').removeClass('active');
206                        parent_li.addClass('active');
207                    });
208                }
209                if (checkElement.is(subMenuSelector)) {
210                    e.preventDefault();
211                }
212            } else {
213                if ($(this).attr('href') === "#") {
214                    e.preventDefault();
215                }
216            }
217        });
218
219
220        /*-------------------------------------
221        Section background image
222        -------------------------------------*/
223        $("[data-bg-image]").each(function () {
224            var img = $(this).data("bg-image");
225            $(this).css({
226                backgroundImage: "url(" + img + ")"
227            });
228        });
229
230        /*-------------------------------------
231        Countdown activation code
232        -------------------------------------*/
233		$('.countdown').each(function () {
234            var date = $(this).data('date');
235            $(this).countdown(date, function (event) {
236                var $this = $(this).html(event.strftime("<div class='countdown-section'><div class='countdown-number'>%D</div> <div class='countdown-unit'>"+ThemeObj.day+"%!D</div> </div><div class='countdown-section'><div class='countdown-number'>%H</div> <div class='countdown-unit'>"+ThemeObj.hour+"%!H</div> </div><div class='countdown-section'><div class='countdown-number'>%M</div> <div class='countdown-unit'>"+ThemeObj.minute+"%!M</div> </div><div class='countdown-section'><div class='countdown-number'>%S</div> <div class='countdown-unit'>"+ThemeObj.second+"</div> </div>"));
237            });
238        });
239		
240		if ($.fn.slick) {
241			$('.logo-slick-carousel').each(function () {
242				let $carousel = $(this);
243				$carousel.imagesLoaded(function () {
244					var data = $carousel.data('slick'),
245						slidesToShow = data.slidesToShow,
246						slidesToShowTab = data.slidesToShowTab,
247						slidesToShowMobile = data.slidesToShowMobile,
248						slidesToShowMobiles = data.slidesToShowMobiles;
249					$carousel.not('.slick-initialized').slick({
250						slidesToShow: slidesToShow,
251						slidesToScroll: 1,
252						speed: 1000,
253						infinite: true,
254						centerMode: false,
255						centerPadding: '0px',
256						pauseOnHover: true,
257						cssEase: 'ease-in-out',
258						responsive: [{
259								breakpoint: 1024,
260								settings: {
261									slidesToShow: slidesToShowTab,
262									slidesToScroll: 1
263								}
264							},
265							{
266								breakpoint: 768,
267								settings: {
268									slidesToShow: slidesToShowMobile,
269									slidesToScroll: 1
270								}
271							},
272							{
273								breakpoint: 576,
274								settings: {
275									slidesToShow: slidesToShowMobiles,
276									slidesToScroll: 1
277								}
278							}
279						]
280					});
281				});
282			});
283		}
284        /*-------------------------------------
285            Mouse Scroll Slider
286        -------------------------------------*/
287        if ($.fn.slick) {
288            const slider = $(".swiper-slide");
289            slider.not('.slick-initialized').slick({
290                dots: false,
291                arrows: false
292            });
293            slider.on('wheel', (function (e) {
294                e.preventDefault();
295                if (e.originalEvent.deltaY < 0) {
296                    $(this).slick('slickNext');
297                } else {
298                    $(this).slick('slickPrev');
299                }
300            }));
301        }
302
303        sal({ threshold: 1, once: true });
304
305        /*--------------------------------------
306        Isotope initialization
307        --------------------------------------*/
308        function galleryStyleLoading() {
309
310            var $container = $(document).find(".isotope-wrap");
311
312            if ($container.length > 0) {
313                $(".isotope-wrap").each(function () {
314                    var $container = $(this);
315                    var isoContainer = $(".featuredContainer", $container);
316                    isoContainer.imagesLoaded(function () {
317
318                        var $isotope = isoContainer.isotope({
319                            filter: $container.find(".isotope-classes-tab a.current").attr("data-filter") || '*',
320                            transitionDuration: "1s",
321                            hiddenStyle: {
322                                opacity: 0,
323                                transform: "scale(0.001)"
324                            },
325                            visibleStyle: {
326                                transform: "scale(1)",
327                                opacity: 1
328                            }
329                        });
330
331                        $container.find(".isotope-classes-tab").on("click", "a", function () {
332                            var $this = $(this);
333                            $this
334                                .parent(".isotope-classes-tab")
335                                .find("a")
336                                .removeClass("current");
337                            $this.addClass("current");
338                            var selector = $this.attr("data-filter");
339
340                            $isotope.isotope({
341                                filter: selector
342                            });
343                            return false;
344                        });
345                    });
346                });
347            }
348
349            /*-------------------------------------
350                Masonry
351            -------------------------------------*/
352            var galleryIsoContainer = $("#no-equal-gallery");
353            if (galleryIsoContainer.length) {
354                var imageGallerIso = galleryIsoContainer.imagesLoaded(function () {
355                    imageGallerIso.isotope({
356                        itemSelector: ".no-equal-item",
357                        masonry: {
358                            columnWidth: ".no-equal-item",
359                            horizontalOrder: true
360                        }
361                    });
362                });
363            }
364            /*-------------------------------------
365                YouTube Popup
366            -------------------------------------*/
367            var yPopup = $(".popup-youtube");
368            if (yPopup.length) {
369                yPopup.magnificPopup({
370                    disableOn: 320,
371                    type: 'iframe',
372                    mainClass: 'mfp-fade',
373                    removalDelay: 160,
374                    preloader: false,
375                    fixedContentPos: false,
376                    iframe: {
377                        patterns: {
378                            dailymotion: {
379                                index: 'dailymotion.com',
380                                id: function (url) {
381                                    var m = url.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);
382                                    if (m !== null) {
383                                        if (m[4] !== undefined) {
384
385                                            return m[4];
386                                        }
387                                        return m[2];
388                                    }
389                                    return null;
390                                },
391
392                                src: 'https://www.dailymotion.com/embed/video/%id%'
393                            }
394                        }
395                    }
396                });
397            }
398
399        }
400		
401		/* Owl Custom Nav */
402		if (typeof $.fn.owlCarousel == 'function') {
403			$(".owl-custom-nav .owl-next").on('click', function () {
404				$(this).closest('.owl-wrap').find('.owl-carousel').trigger('next.owl.carousel');
405			});
406			$(".owl-custom-nav .owl-prev").on('click', function () {
407				$(this).closest('.owl-wrap').find('.owl-carousel').trigger('prev.owl.carousel');
408			});
409
410			$(".rt-owl-carousel").each(function () {
411				var options = $(this).data('carousel-options');
412				if (ThemeObj.rtl == 'yes') {
413					options['rtl'] = true; //@rtl
414				}
415				$(this).owlCarousel(options);
416			});
417		}
418
419        /*-------------------------------------
420        Intersection Observer
421        -------------------------------------*/
422        function sidebar_title_change() {
423            let observer = new IntersectionObserver((entries, observer) => {
424                entries.forEach(entry => {
425                    if (entry.isIntersecting) {
426                        var heading = $(entry.target).find('.heading-title').data('heading') || '';
427                        $('#wrapper').find(".section-name").text(heading);
428                    }
429                });
430            }, {rootMargin: "0% 0% -70% 0%"});
431            document.querySelectorAll('.has-obserbation').forEach(block => {
432                observer.observe(block)
433            });
434        }
435
436
437        /*-------------------------------------
438            Custom Init
439        -------------------------------------*/
440        galleryStyleLoading();
441        sidebar_title_change();
442
443        /*-------------------------------------
444            Proof Gallery
445        -------------------------------------*/
446        $('.proof-gallery .img-box').click(function () {
447            $(this).toggleClass('checked');
448            $(this).next('.item-icon').slideToggle('500');
449            $(this).find('i').toggleClass('fa-plus fa-check');
450        });
451
452    }
453
454    /*-------------------------------------
455    Page Preloader
456    -------------------------------------*/
457    $("#preloader").fadeOut("slow", function () {
458        $(this).remove();
459    });	
460
461    /*-------------------------------------
462     Search Form
463    -------------------------------------*/
464    //Header Search
465    $('a[href="#header-search"]').on("click", function (event) {
466        event.preventDefault();
467        $("#header-search").addClass("open");
468        $('#header-search > form > input[type="search"]').focus();
469    });
470
471    $("#header-search, #header-search button.close").on("click keyup", function (
472        event
473    ) {
474        if (
475            event.target === this ||
476            event.target.className === "close" ||
477            event.keyCode === 27
478        ) {
479            $(this).removeClass("open");
480        }
481    });
482
483    /*---------------------------------------
484    On Click Section Switch
485    --------------------------------------- */
486    $('[data-type="section-switch"]').on('click', function () {
487        if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
488            var target = $(this.hash);
489            if (target.length > 0) {
490
491                target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
492                $('html,body').animate({
493                    scrollTop: target.offset().top
494                }, 1000);
495                return false;
496            }
497        }
498    });
499
500    /*-------------------------------------
501    Scroll to Bottom
502    -------------------------------------*/
503    $("#mybutton").on('click', 'a', function (e) {
504        e.preventDefault();
505        $('html, body').animate({
506            scrollTop: $("#about-us").offset().top
507        }, 1000);
508    });
509
510    /*-------------------------------------
511    On Scroll
512    -------------------------------------*/
513    $(window).on('scroll', function () {
514
515        if ($(window).scrollTop() >= $("body").offset().top + 50)
516            $('body').addClass('mn-top');
517        else
518            $('body').removeClass('mn-top');
519
520        // Heading Title Show/Hide
521        var targetHeight = $("#sidebar-wrap").outerHeight() || 0;
522        if ($(window).scrollTop() > targetHeight) {
523            $('#sidebar-wrap').addClass('sidebar-sticky');
524        } else {
525            $('#sidebar-wrap').removeClass('sidebar-sticky');
526        }
527
528        // Back Top Button
529        if ($(window).scrollTop() > 500) {
530            $('.scrollup').addClass('back-top');
531        } else {
532            $('.scrollup').removeClass('back-top');
533        }
534
535        // Sticky mobile menu
536        if ($(window).scrollTop() > 0) {
537            $('.rt-header-menu').addClass('sticky-mobile');
538        } else {
539            $('.rt-header-menu').removeClass('sticky-mobile');
540        }
541
542        // Sticky Header
543        if ($('body').hasClass('sticky-header')) {
544            var stickyPlaceHolder = $("#rt-sticky-placeholder"),
545                menu = $("#header-menu"),
546                menuH = menu.outerHeight(),
547                topHeaderH = $('#header-topbar').outerHeight() || 0,
548                middleHeaderH = $('#header-middlebar').outerHeight() || 0,
549                targrtScroll = topHeaderH + middleHeaderH;
550            if ($(window).scrollTop() > targrtScroll) {
551                menu.addClass('rt-sticky');
552                stickyPlaceHolder.height(menuH);
553            } else {
554                menu.removeClass('rt-sticky');
555                stickyPlaceHolder.height(0);
556            }
557        }
558    });
559
560    function body_class_added() {
561        let observer = new IntersectionObserver((entries, observer) => {
562            entries.forEach(entry => {
563                if (entry.isIntersecting) {
564                    $('body').addClass('remove-header')
565                } else {
566                    $('body').removeClass('remove-header')
567
568                }
569            });
570        }, {rootMargin: "0% 0% -10% 0%"});
571        document.querySelectorAll('#rt-author').forEach(block => {
572            observer.observe(block)
573        });
574    }
575
576    if (window.IntersectionObserver) {
577        body_class_added();
578    }   
579
580    /*-------------------------------------
581    MeanMenu activation code
582    --------------------------------------*/
583
584    var a = $('.offscreen-navigation .menu');
585    if (a.length) {
586        $(".menu-item-has-children").append("<span></span>");
587        $(".page_item_has_children").append("<span></span>");
588
589        a.children("li").addClass("menu-item-parent");
590
591        $('.menu-item-has-children > span').on('click', function () {
592            var _self = $(this),
593                sub_menu = _self.parent().find('>.sub-menu');
594            if (_self.hasClass('open')) {
595                sub_menu.slideUp();
596                _self.removeClass('open');
597            } else {
598                sub_menu.slideDown();
599                _self.addClass('open');
600            }
601        });
602        $('.page_item_has_children > span').on('click', function () {
603            var _self = $(this),
604                sub_menu = _self.parent().find('>.children');
605            if (_self.hasClass('open')) {
606                sub_menu.slideUp();
607                _self.removeClass('open');
608            } else {
609                sub_menu.slideDown();
610                _self.addClass('open');
611            }
612        });
613    }
614    $('.mean-bar .sidebarBtn').on('click', function (e) {
615        e.preventDefault();
616        if ($('.rt-slide-nav').is(":visible")) {
617            $('.rt-slide-nav').slideUp();
618            $('body').removeClass('slidemenuon');
619        } else {
620            $('.rt-slide-nav').slideDown();
621            $('body').addClass('slidemenuon');
622        }
623    });
624
625    $('.offscreen-navigation .menu-item-parent > a').on('click', function () {
626        setTimeout(function() {
627            $('.mean-bar .sidebarBtn').trigger('click');
628        }, 300)
629    });
630
631
632    /*--------------------------------------
633    Tooltip initialization
634    --------------------------------------*/
635    $('[data-toggle="tooltip"]').tooltip()
636
637    //PP Nav Remove
638    $('#pp-nav').remove();
639
640    // Window Load+Resize
641    $(window).on('load resize', function () {
642        // Elementor Frontend Load
643        $(window).on('elementor/frontend/init', function () {
644            if (elementorFrontend.isEditMode()) {
645                elementorFrontend.hooks.addAction('frontend/element_ready/widget', function () {
646                    fmwave_scripts_load();
647                });
648            }
649        });
650    });
651
652    // Window Load
653    $(window).on('load', function () {
654        fmwave_scripts_load();
655    });
656	
657	//woocommerce ajax	
658	var WooCommerce = {
659	   quantity_change: function quantity_change() {
660		   $(document).on('click', '.quantity .input-group-btn .quantity-btn', function() {
661			   var $input = $(this).closest('.quantity').find('.input-text');
662
663			   if ($(this).hasClass('quantity-plus')) {
664				   $input.trigger('stepUp').trigger('change');
665			   }
666
667			   if ($(this).hasClass('quantity-minus')) {
668				   $input.trigger('stepDown').trigger('change');
669			   }
670		   });
671	   },
672	   wishlist_icon: function wishlist_icon() {
673		   $(document).on('click', '.rdtheme-wishlist-icon', function() {
674			   if ($(this).hasClass('rdtheme-add-to-wishlist')) {
675				   var $obj = $(this),
676					   productId = $obj.data('product-id'),
677					   afterTitle = $obj.data('title-after');
678				   var data = {
679					   'action': 'fmwave_add_to_wishlist',
680					   'context': 'frontend',
681					   'nonce': $obj.data('nonce'),
682					   'add_to_wishlist': productId
683				   };
684				   $.ajax({
685					   url: ThemeObj.ajaxurl,
686					   type: 'POST',
687					   data: data,
688					   beforeSend: function beforeSend() {
689						   $obj.find('.wishlist-icon').hide();
690						   $obj.find('.ajax-loading').show();
691						   $obj.addClass('rdtheme-wishlist-ajaxloading');
692					   },
693					   success: function success(data) {
694						   if (data['result'] != 'error') {
695							   $obj.find('.ajax-loading').hide();
696							   $obj.removeClass('rdtheme-wishlist-ajaxloading');
697							   $obj.find('.wishlist-icon').removeClass('far fa-heart').addClass('fas fa-heart').show();
698							   $obj.removeClass('rdtheme-add-to-wishlist').addClass('rdtheme-remove-from-wishlist');
699							   $obj.attr('title', afterTitle);
700							   $obj.find('.wl-btn-text').text(afterTitle);
701							   $(".wl-btn-text").text(function(index, text){
702								   return text.replace( "Add to Wishlist", "Added in Wishlist! View Wishlist" );  
703							   });
704						   } else {
705							   console.log(data['message']);
706						   }
707					   }
708				   });
709				   return false;
710			   }
711		   });
712	   }
713	};
714	WooCommerce.wishlist_icon();
715	WooCommerce.quantity_change();
716
717})(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.