PageSourceSearch

https://cultureandanimals.org/wp-content/themes/Gaea/assets/js/init.js?ver=1.0

js cultureandanimals.org collected 2026-10-02 08:36:57 UTC 22,770 bytes, 708 lines download raw bytes

1jQuery(function($){
2	"use strict";
3var GAEA = window.GAEA || {};
4GAEA.megaMenu = function() {
5        jQuery('.megamenu-sub-title').closest('ul.sub-menu').wrapInner('<div class="row" />').wrapInner('<div class ="megamenu-container container" />').wrapInner('<li />');
6        jQuery('.megamenu-container').closest('li.menu-item-has-children').addClass('megamenu');
7        var $class = '';
8		jQuery(".megamenu-container").each(function(index, elem) {
9    var numImages = $(this).find('.row').children().length;
10	switch (numImages)
11        {
12            case 1:
13                $class = 12;
14                break;
15            case 2:
16                $class = 6;
17                break;
18            case 3:
19                $class = 4;
20                break;
21            case 4:
22                $class = 3;
23                break;
24            default:
25                $class = 2;
26        }
27		$(this).find('.row').find('.col-md-3').each(function() {
28            jQuery(this).removeClass('col-md-3').addClass('col-md-' + $class);
29        })
30});
31}
32/* ==================================================
33	Contact Form Validations
34================================================== */
35	GAEA.ContactForm = function(){
36		$('.contact-form').each(function(){
37			var formInstance = $(this);
38			formInstance.submit(function(){
39		
40			var action = $(this).attr('action');
41		
42			$("#message").slideUp(750,function() {
43			$('#message').hide();
44		
45			$('#submit')
46				 .after('<img src="' + $('#image_path').val() + '/assets/images/assets/ajax-loader.gif" class="loader" />')
47				.attr('disabled','disabled');
48		
49			$.post(action, {
50				name: $('#name').val(),
51				email: $('#email').val(),
52				phone: $('#phone').val(),
53				comments: $('#comments').val(),
54                subject: $('#subject').val(),
55                admin_email: $('#admin_email').val(),
56			},
57				function(data){
58					document.getElementById('message').innerHTML = data;
59					$('#message').slideDown('slow');
60					$('.contact-form img.loader').fadeOut('slow',function(){$(this).remove()});
61					$('#submit').removeAttr('disabled');
62					if(data.match('success') != null) $('.contact-form').slideUp('slow');
63		
64				}
65			);
66			});
67			return false;
68		});
69		});
70	}
71/* ==================================================
72	Responsive Nav Menu
73================================================== */
74	GAEA.navMenu = function() {
75		// Responsive Menu Events
76		$('#menu-toggle').click(function(){
77			$(this).toggleClass("opened");
78			$(".main-navigation").slideToggle();
79			return false;
80		});
81		$(window).resize(function(){
82			if($("#menu-toggle").hasClass("opened")){
83				$(".main-navigation").css("display","block");
84			} else {
85				$("#menu-toggle").css("display","none");
86			}
87		});
88	}
89/* ==================================================
90	Scroll to Top
91================================================== */
92	GAEA.scrollToTop = function(){
93		var windowWidth = $(window).width(),
94			didScroll = false;
95	
96		var $arrow = $('#back-to-top');
97	
98		$arrow.click(function(e) {
99			$('body,html').animate({ scrollTop: "0" }, 750, 'easeOutExpo' );
100			e.preventDefault();
101		})
102	
103		$(window).scroll(function() {
104			didScroll = true;
105		});
106	
107		setInterval(function() {
108			if( didScroll ) {
109				didScroll = false;
110	
111				if( $(window).scrollTop() > 200 ) {
112					$arrow.fadeIn();
113				} else {
114					$arrow.fadeOut();
115				}
116			}
117		}, 250);
118	}
119/* ==================================================
120   Accordion
121================================================== */
122	GAEA.accordion = function(){
123		var accordion_trigger = $('.accordion-heading.accordionize');
124		
125		accordion_trigger.delegate('.accordion-toggle','click', function(event){
126			if($(this).hasClass('active')){
127				$(this).removeClass('active');
128				$(this).addClass('inactive');
129			}
130			else{
131				accordion_trigger.find('.active').addClass('inactive');          
132				accordion_trigger.find('.active').removeClass('active');   
133				$(this).removeClass('inactive');
134				$(this).addClass('active');
135			}
136			event.preventDefault();
137		});
138	}
139/* ==================================================
140   Toggle
141================================================== */
142	GAEA.toggle = function(){
143		var accordion_trigger_toggle = $('.accordion-heading.togglize');
144		
145		accordion_trigger_toggle.delegate('.accordion-toggle','click', function(event){
146			if($(this).hasClass('active')){
147				$(this).removeClass('active');
148				$(this).addClass('inactive');
149			}
150			else{
151				$(this).removeClass('inactive');
152				$(this).addClass('active');
153			}
154			event.preventDefault();
155		});
156	}
157/* ==================================================
158   Tooltip
159================================================== */
160	GAEA.toolTip = function(){ 
161		$('a[data-toggle="tooltip"]').tooltip();
162	}
163/* ==================================================
164   Twitter Widget
165================================================== */
166	GAEA.TwitterWidget = function() {
167		$('.twitter-widget').each(function(){
168			var twitterInstance = $(this); 
169			var twitterTweets = twitterInstance.attr("data-tweets-count") ? twitterInstance.attr("data-tweets-count") : "1"
170			twitterInstance.twittie({
171            	dateFormat: '%b. %d, %Y',
172            	template: '<li><i class="fa fa-twitter"></i> {{tweet}} <span class="date">{{date}}</span></li>',
173            	count: twitterTweets,
174            	hideReplies: true
175        	});
176		});
177	}
178/* ==================================================
179   Flex Slider
180================================================== */
181	GAEA.FlexSlider = function() {
182		$('.flexslider').each(function(){
183            var carouselInstance = $(this); 
184            var carouselAutoplay = carouselInstance.attr("data-autoplay") == 'yes' ? true : false
185            var carouselPagination = carouselInstance.attr("data-pagination") == 'yes' ? true : false
186            var carouselArrows = carouselInstance.attr("data-arrows") == 'yes' ? true : false
187            var carouselDirection = carouselInstance.attr("data-direction") ? carouselInstance.attr("data-direction") : "horizontal"
188            var carouselStyle = carouselInstance.attr("data-style") ? carouselInstance.attr("data-style") : "fade"
189            var carouselSpeed = carouselInstance.attr("data-speed") ? carouselInstance.attr("data-speed") : "5000"
190            var carouselPause = carouselInstance.attr("data-pause") == 'yes' ? true : false
191
192            carouselInstance.flexslider({
193                animation: carouselStyle,
194                easing: "swing",               
195                direction: carouselDirection,       
196                slideshow: carouselAutoplay,              
197                slideshowSpeed: carouselSpeed,         
198                animationSpeed: 600,         
199                initDelay: 0,              
200                randomize: false,            
201                pauseOnHover: carouselPause,       
202                controlNav: carouselPagination,           
203                directionNav: carouselArrows,            
204                prevText: "",          
205                nextText: ""
206            });
207		});
208	}
209/* ==================================================
210   PrettyPhoto
211================================================== */
212	GAEA.PrettyPhoto = function() {
213		$("a[data-rel^='prettyPhoto']").prettyPhoto({
214			  opacity: 0.5,
215			  social_tools: "",
216			  deeplinking: false
217		});
218	}
219/* ======
220/* ==================================================
221   Animated Counters
222================================================== */
223	GAEA.Counters = function() {
224		$('.counters').each(function () {
225			$(".timer .count").appear(function() {
226			var counter = $(this).html();
227			$(this).countTo({
228				from: 0,
229				to: counter,
230				speed: 2000,
231				refreshInterval: 60,
232				});
233			});
234		});
235		
236			$(".countdown .timer .count").appear(function() {
237			var counter = $(this).html();
238			$(this).countTo({
239				from: 0,
240				to: counter,
241				speed: 2000,
242				refreshInterval: 60,
243				});
244			});
245		
246	}
247/* ==================================================
248   SuperFish menu
249================================================== */
250	GAEA.SuperFish = function() {
251		if(jQuery(window).width() > 992){
252			$('.sf-menu').superfish({
253				delay: 200,
254				animation: {
255					opacity: 'show',
256					height: 'show'
257				},
258				speed: 'fast',
259				cssArrows: false,
260				disableHI: true
261			});
262		} else {
263			jQuery('.main-navigation .menu-item-has-children').each(function () {
264                // Append the submenu opener
265                jQuery(this).append('<span class="smenu-opener"><i class="fa fa-angle-down"></i></span>');
266
267                let $menuItem = jQuery(this);
268                let $mainLink = $menuItem.children('a'); // Main link
269                let $subMenu = $menuItem.children('.sub-menu'); // Sub-menu
270                let $opener = $menuItem.children('.smenu-opener'); // Opener button
271
272                function toggleSubMenu() {
273                    if ($subMenu.is(':visible')) {
274                        $opener.removeClass('smenu-opened');
275                        $subMenu.slideUp();
276                        $opener.html('<i class="fa fa-angle-down"></i>');
277                    } else {
278                        $subMenu.slideDown();
279                        $opener.addClass('smenu-opened');
280                        $opener.html('<i class="fa fa-angle-up"></i>');
281                    }
282                }
283
284                // Bind click event to submenu opener
285                $opener.on('click', function (e) {
286                    e.preventDefault();
287                    toggleSubMenu();
288                });
289
290                // Bind click event to the main link if it has no valid URL
291                if (!$mainLink.attr('href') || $mainLink.attr('href') === '#') {
292                    $mainLink.on('click', function (e) {
293                        e.preventDefault();
294                        toggleSubMenu();
295                    });
296                }
297            });
298    	}
299		$(".main-navigation > ul > li:has(ul)").find("a:first").append(" <i class='fa fa-angle-down'></i>");
300		$(".main-navigation > ul > li > ul > li:has(ul)").find("a:first").append(" <i class='fa fa-angle-right'></i>");
301		$(".main-navigation > ul > li > ul > li > ul > li:has(ul)").find("a:first").append(" <i class='fa fa-angle-right'></i>");
302	}
303/* ==================================================
304   IsoTope Portfolio
305================================================== */
306		GAEA.IsoTope = function() {	
307		$("ul.sort-source").each(function() {
308			var source = $(this);
309			var destination = $("ul.sort-destination[data-sort-id=" + $(this).attr("data-sort-id") + "]");
310			if(destination.get(0)) {
311				$(window).load(function() {
312					destination.isotope({
313						itemSelector: ".grid-item",
314						layoutMode: 'sloppyMasonry'
315					});
316					source.find("a").click(function(e) {
317						e.preventDefault();
318						var $this = $(this),
319							filter = $this.parent().attr("data-option-value");
320						source.find("li.active").removeClass("active");
321						$this.parent().addClass("active");
322						destination.isotope({
323							filter: filter
324						});
325						if(window.location.hash !== "" || filter.replace(".","") !== "*") {
326							self.location = "#" + filter.replace(".","");
327						}
328						return false;
329					});
330					$(window).bind("hashchange", function() {
331						var hashFilter = "." + location.hash.replace("#",""),
332							hash = (hashFilter === "." || hashFilter === ".*" ? "*" : hashFilter);
333						source.find("li.active").removeClass("active");
334						source.find("li[data-option-value='" + hash + "']").addClass("active");
335						destination.isotope({
336							filter: hash
337						});
338					});
339					var hashFilter = "." + (location.hash.replace("#","") || "*");
340					var initFilterEl = source.find("li[data-option-value='" + hashFilter + "'] a");
341					if(initFilterEl.get(0)) {
342						source.find("li[data-option-value='" + hashFilter + "'] a").click();
343					} else {
344						source.find("li:first-child a").click();
345					}
346				});
347			}
348		});
349		$(window).load(function() {
350			var IsoTopeCont = $(".isotope-grid");
351			IsoTopeCont.isotope({
352				itemSelector: ".grid-item",
353				layoutMode: 'sloppyMasonry'
354			});
355			if ($(".grid-holder").length > 0){	
356				var $container_blog = $('.grid-holder');
357				$container_blog.isotope({
358					itemSelector : '.grid-item',
359					layoutMode: 'sloppyMasonry'
360				});
361		
362				$(window).resize(function() {
363					var $container_blog = $('.grid-holder');
364					$container_blog.isotope({
365						itemSelector : '.grid-item',
366						layoutMode: 'sloppyMasonry'
367					});
368				});
369			}
370		});
371	}
372/* ==================================================
373   Nivo Slider
374================================================== */
375	GAEA.NivoSlider = function() {
376		$('.nivoslider').each(function(){
377				var nivoInstance = $(this); 
378				var nivoAutoplay = nivoInstance.attr("data-autoplay") == 'no' ? true : false
379				var nivoPagination = nivoInstance.attr("data-pagination") == 'yes' ? true : false
380				var nivoArrows = nivoInstance.attr("data-arrows") == 'yes' ? true : false
381				var nivoThumbs = nivoInstance.attr("data-thumbs") == 'yes' ? true : false
382				var nivoEffect = nivoInstance.attr("data-effect") ? nivoInstance.attr("data-effect") : "random"
383				var nivoSlices = nivoInstance.attr("data-slices") ? nivoInstance.attr("data-slices") : "15"
384				var nivoanimSpeed = nivoInstance.attr("data-animSpeed") ? nivoInstance.attr("data-animSpeed") : "500"
385				var nivopauseTime = nivoInstance.attr("data-pauseTime") ? nivoInstance.attr("data-pauseTime") : "3000"
386				var nivoPause = nivoInstance.attr("data-pauseonhover") == 'yes' ? true : false
387				
388				nivoInstance.nivoSlider({
389					effect: nivoEffect,
390					slices: nivoSlices,
391					animSpeed: nivoanimSpeed,
392					pauseTime: nivopauseTime,
393					directionNav: nivoArrows,
394					controlNav: nivoPagination,
395					controlNavThumbs: nivoThumbs,
396					pauseOnHover: nivoPause,
397					manualAdvance: nivoAutoplay
398				});
399		});
400	}
401/* ==================================================
402   Sticky Navigation
403================================================== */	
404	GAEA.StickyNav = function() {
405		$(".header-v1 .lower-header, .header-v2 .lower-header").sticky({topSpacing:0});
406		$(".full-width-menu").sticky({topSpacing:0});
407	}
408	/* ==================================================
409	   Init Functions
410	================================================== */
411	$(document).ready(function(){
412		GAEA.megaMenu();
413		GAEA.ContactForm();
414		GAEA.scrollToTop();
415		GAEA.accordion();
416		GAEA.toggle();
417		GAEA.toolTip();
418		GAEA.navMenu();
419		GAEA.TwitterWidget();
420		GAEA.FlexSlider();
421		GAEA.PrettyPhoto();
422		GAEA.SuperFish();
423		GAEA.Counters();
424		GAEA.IsoTope();
425		if(urlajax_gaea.sticky==1) {
426		GAEA.StickyNav(); }
427		GAEA.NivoSlider();
428	});
429	// COUNTDOWN TIMER
430	// FrontPage Time Counter
431	var expiryDate = $('#counter').data('date');
432	var target = new Date(expiryDate),
433	finished = false,
434	availiableExamples = {
435		set15daysFromNow: 15 * 24 * 60 * 60 * 1000,
436		set5minFromNow  : 5 * 60 * 1000,
437		set1minFromNow  : 1 * 60 * 1000
438	};
439	function callback(event) {
440		var $this = $(this);
441		switch(event.type) {
442			case "seconds":
443			case "minutes":
444			case "hours":
445			case "days":
446			case "weeks":
447			case "daysLeft":
448				$this.find('div span#'+event.type).html(event.value);
449				if(finished) {
450					$this.fadeTo(0, 1);
451					finished = false;
452				}
453				break;
454			case "finished":
455				$this.fadeTo('slow', .5);
456				finished = true;
457				break;
458		}
459	}
460	if(urlajax_gaea.countdown==1) {
461	$('#counter').countdown(target.valueOf(), callback); }
462	// Pages Design Functions
463
464	/* Added in v1.5 */
465	$(".search-module-trigger").click(function(e){
466		e.stopPropagation();
467		$(".search-module-opened").toggle();
468		$('.cart-module-opened').hide();
469		e.preventDefault();
470	});
471	$(".search-module-opened").click(function(e){
472		e.stopPropagation();
473	});
474	$("#cart-module-trigger").click(function(e){
475		e.stopPropagation();
476		$(".cart-module-opened").toggle();
477		$('.search-module-opened').hide();
478		e.preventDefault();
479	});
480	$(".cart-module-opened").click(function(e){
481		e.stopPropagation();
482	});
483	$(document).click(function(){
484		$('.search-module-opened, .cart-module-opened').hide();
485	});
486	/* End added in v1.5 */
487
488	// Any Button Scroll to section
489	$('.scrollto').click(function(){
490		$.scrollTo( this.hash, 800, { easing:'easeOutQuint' });
491		return false;
492	});
493	$('.secondary-bar .scrollto').click(function(){
494		$.scrollTo( $(this.hash).position().top-$('.lower-header').height()-40, 800, { easing:'easeOutQuint' });
495		return false;
496	});
497
498	// FITVIDS
499	$(".fw-video, .sidr-inner").fitVids();
500	$(document).ready(function(){
501	// Gallery Flex list height
502	var liMaxHeight = -1;
503	var length=$(".format-gallery .slides").length;
504	if(length>0)
505	{
506	   $(".format-gallery .slides").each(function(index) {
507		  var $ul = $(this);
508		  $($ul).find("li").each(function(index) {
509		  if ($(this).outerHeight() > liMaxHeight) {
510			liMaxHeight = $(this).outerHeight();
511		}
512		  });
513		   $($ul).css('height',liMaxHeight)
514		   $($ul).find('a').css('height',liMaxHeight)
515		  });
516	}
517
518	// Centering the dropdown menus
519	$(".main-navigation ul li").mouseover(function() {
520		 var the_width = $(this).find("a").width();
521		 var child_width = $(this).find("ul").width();
522		 var width = parseInt((child_width - the_width)/2);
523		$(this).find("ul").css('left', -width);
524	});
525	//Footer Widget Title
526	$('.footer-widget .widgettitle').html(function(index, curHTML) {
527		var text = curHTML.split(/[\s-]/),
528		 newtext = '<span class="accent-color">' + text.pop() + '</span>';
529		return text.join(' ').concat(' ' + newtext);
530	});
531	// Double border
532	$(".double-border").each(function(){
533		$(this).append('<div class="accent-bg"></div><div class="accent-bg"></div>');
534	});
535	});
536	var BCOLS = function(){
537		var $tallestCol;
538		$('.border-cols').each(function(){
539		   $tallestCol = 0;
540		   $(this).find('div').
541			each(function(){
542				($(this).height() > $tallestCol) ? $tallestCol = $(this).height() : $tallestCol = $tallestCol;
543			});   
544			if($tallestCol == 0) $tallestCol = 'auto';
545			$(this).find('div').css('height',$tallestCol);
546		});
547	}
548	//Donation Form
549	$(".donate-paypal").click(function(){
550		var CauseName = $(this).parents(".cause-item").find("h3").html();
551		$(".payment-to-cause").html(CauseName);
552	});
553	$('select[name="donation amount"]').change(function(){
554	  if ($(this).val() === "Custom")
555	  {
556		$('.custom-donate-amount').show();
557		$('input[name="Custom Donation Amount"]').focus();
558	  }
559	  else
560	  {
561		$('.custom-donate-amount').hide();
562	  }
563	});
564	// Listing Item Height
565	var LIH = function() {
566		$(".events-listing .upcoming-events li").each(function(){
567			var ELH = $(this).height();
568			$(this).find(".event-details-btn").css("line-height",ELH+16+'px');
569		});
570	}
571
572	// Home border column
573	var BCHF = function() {
574		var BCH = $(".home .border-col").height();
575		var BCS = $(".home .sidebar").height();
576		var BCRS = BCS + 90
577		if(BCH < BCS){
578			$(".home .border-col").css("height",BCRS);
579		}
580	}
581	// Featured Projects
582	var FB = function() {
583		var FPB = $(".featured-project-block").width();
584		var FPBT = $(".featured-project-block").find(".project-title").height();
585		var FPBTO = FPBT + 8
586		$(".project-overlay").css("width",FPB);
587		$(".project-overlay .project-cat").css("line-height",FPBTO+'px');
588	}
589	// Image Hover icons for gallery items
590	$(document).ready(function(){
591		BCHF();
592		FB();
593		LIH();
594		BCOLS();
595	});
596	$(window).load(function(){
597		$(".format-image").each(function(){
598			$(this).find(".media-box").append("<span class='zoom'><i class='fa fa-search'></i></span>");
599		});
600		$(".format-standard").each(function(){
601			$(this).find(".media-box").append("<span class='zoom'><i class='fa fa-plus'></i></span>");
602		});
603		$(".format-video").each(function(){
604			$(this).find(".media-box").append("<span class='zoom'><i class='fa fa-play'></i></span>");
605		});
606		$(".format-link").each(function(){
607			$(this).find(".media-box").append("<span class='zoom'><i class='fa fa-link'></i></span>");
608		});
609	});
610	$(window).resize(function(){
611		BCHF();
612		FB();
613		LIH();
614		BCOLS();
615	});
616	$(".cust-counter" ).wrapAll( "<section class=\"counters padding-tb45 accent-color text-align-center\"><div class=\"container\"><div class=\"row\">");
617	// List Styles
618	$('a.external').prepend('<i class="fa fa-external-link"></i> ');
619	// Heading Styles
620	$(".title, .widget-title").each(function(){
621		$(this).wrapInner( "<div class='title-border'></div>");
622	});
623	if(urlajax_gaea.animations==1) {
624	// Animation Appear
625	$("[data-appear-animation]").each(function() {
626		var $this = $(this);
627
628		$this.addClass("appear-animation");
629
630		if(!$("html").hasClass("no-csstransitions") && $(window).width() > 767) {
631
632			$this.appear(function() {
633
634				var delay = ($this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1);
635
636				if(delay > 1) $this.css("animation-delay", delay + "ms");
637				$this.addClass($this.attr("data-appear-animation"));
638
639				setTimeout(function() {
640					$this.addClass("appear-animation-visible");
641				}, delay);
642
643			}, {accX: 0, accY: -150});
644
645		} else {
646
647			$this.addClass("appear-animation-visible");
648		}
649	});
650	}
651	// Animation Progress Bars
652	$("[data-appear-progress-animation]").each(function() {
653		var $this = $(this);
654		$this.appear(function() {
655			var delay = ($this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1);
656			if(delay > 1) $this.css("animation-delay", delay + "ms");
657			$this.addClass($this.attr("data-appear-animation"));
658			setTimeout(function() {
659				$this.animate({
660					width: $this.attr("data-appear-progress-animation")
661				}, 1500, "easeOutQuad", function() {
662					$this.find(".progress-bar-tooltip").animate({
663						opacity: 1
664					}, 500, "easeOutQuad");
665				});
666			}, delay);
667		}, {accX: 0, accY: -50});
668	});
669	// Parallax Jquery Callings
670	if(!Modernizr.touch) {
671		$(window).bind('load', function () {
672			parallaxInit();						  
673		});
674	}
675	function parallaxInit() {
676		$('.parallax1').parallax("50%", 0.1);
677		$('.parallax2').parallax("50%", 0.1);
678		$('.parallax3').parallax("50%", 0.1);
679		$('.parallax4').parallax("50%", 0.1);
680		$('.parallax5').parallax("50%", 0.1);
681		$('.parallax6').parallax("50%", 0.1);
682		$('.parallax7').parallax("50%", 0.1);
683		$('.parallax8').parallax("50%", 0.1);
684		/*add as necessary*/
685	}
686	// Window height/Width Getter Classes
687	var wheighter = $(window).height();
688	var wwidth = $(window).width();
689	$(".wheighter").css("height",wheighter);
690	$(".wwidth").css("width",wwidth);
691	$(window).resize(function(){
692		var wheighter = $(window).height();
693		var wwidth = $(window).width();
694		$(".wheighter").css("height",wheighter);
695		$(".wwidth").css("width",wwidth);
696	});
697	
698	// Add To Calendar
699	$('.atcb-link').on('click',function(){
700		$('.atcb-list').show();
701	});
702	$(document).on('click', function(){
703		$('.atcb-list').hide();
704	});
705	$('.atcb-link, .atcb-list').on('click', function(e){
706		e.stopPropagation();
707	});
708});

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.