PageSourceSearch

https://cetana.org/wp-content/themes/donation-driven-wordpress-theme/js/main.js?ver=1.0

js cetana.org collected 2026-10-07 07:16:20 UTC 39,843 bytes, 1,684 lines download raw bytes

1"use strict";
2
3/**
4 * Equal sidebar and content height
5 */
6function ddEqualSidebar() {
7
8	if(jQuery('#sidebar').length){
9
10		jQuery('#sidebar-inner').height('auto');
11
12		var sidebar_height = jQuery('#sidebar-inner').height();
13		var content_height = jQuery('#content').height()
14
15		if(content_height > sidebar_height){ jQuery('#sidebar-inner').height(content_height); }
16
17	}
18
19}
20
21
22
23/**
24 * Multicol Colors
25 */
26 
27 
28 
29 
30 
31function ddHeaderColors() {
32
33	if ( jQuery('.multicol-colors').length ) {
34
35		jQuery('.multicol-colors').each(function(){
36
37			var color,
38			element,
39			container = jQuery(this),
40			elements = container.find('li'),
41			count = elements.length,
42			percentage = 100 / count + '%';
43
44			elements.css({ width : percentage });
45
46			elements.each(function(){
47
48				element = jQuery(this);
49				color = element.data('color');
50				element.css({ background : color });
51
52			});
53
54		});
55
56	}
57
58}
59
60/**
61 * Initiate Masonry
62 */
63function ddMasonry( container, selector ) {
64
65	var itemWidth = jQuery(selector, container).outerWidth();
66	var containerWidth = jQuery(container).outerWidth();
67	var gutterWidth = 20;
68
69	jQuery(container).masonry({
70		itemSelector : selector,
71		gutterWidth : gutterWidth,
72		columnWidth: function() {
73			return jQuery('div', container).width();
74		}
75	});
76
77}
78
79/**
80 * Initiate Slider
81 */
82function ddSlider() {
83	
84	jQuery('#slider').each(function(){
85
86		/* Default values */
87		var def = {
88			autoplay: '0',
89			loop: 'enabled',
90			animation: 'slide'
91		};
92
93		/* User values */
94		var usr = {
95			autoplay: jQuery(this).data('autoplay'),
96			loop: jQuery(this).data('loop'),
97			animation: jQuery(this).data('animation')
98		};
99		
100		/* Merge values */
101		var opts = jQuery.extend({}, def, usr);
102		
103		/* Loop value */
104		if ( opts.loop == 'enabled' )
105			opts.loop = true;
106		else
107			opts.loop = false;
108
109		/* Other vars */
110		var autoplay_state = opts.autoplay != '0' ? true : false;
111		
112		jQuery('#slider').show();
113
114		/* Find out the width */
115		var slide_width = jQuery(this).width();
116
117		/* Init slider */
118		jQuery(this).find('.flexslider').flexslider({
119			animation: opts.animation,
120			slideshow: autoplay_state,
121			slideshowSpeed: parseInt(opts.autoplay),
122			controlNav: false,
123			itemWidth: slide_width,
124			animationLoop: opts.loop,
125			prevText: '',
126			nextText: '',
127			useCSS: false,
128			smoothHeight: false,
129			pauseOnHover: true,
130			start: function(){
131				ddEqualSidebar();
132				ddSliderNav();
133			},
134			before: function(slider){
135				ddCauseRaisedAnimate( '#slider' );
136			},
137			after: function(slider) {
138				var curSlideIndex = slider.currentSlide;
139				jQuery('#slider-nav .slide:eq(' + curSlideIndex + ')').click();
140			}
141		});
142
143		if( jQuery(this).find('.slides li:not(.clone)').length < 2 ){
144			jQuery(this).find('.slider-prev, .slider-next').remove();
145		}
146
147		jQuery('.slider-prev').on('click', function(e){
148
149			e.preventDefault();
150			jQuery('#slider .flexslider').flexslider('prev');
151
152		});
153
154		jQuery('.slider-next').on('click', function(e){
155
156			e.preventDefault();
157			jQuery('#slider .flexslider').flexslider('next');
158
159		});
160		
161	});
162
163}
164
165/**
166 * Slider Navigation
167 */
168function ddSliderNav() {
169
170	var sliderNav = jQuery('#slider-nav');
171
172	if ( sliderNav.length ) {
173
174		if ( jQuery( '#slider .flexslider li.slide' ).length < 2 ) {
175			sliderNav.hide();
176		}
177
178		// Variables
179		var currOffset, maxOffset,
180		slidesWrapper = jQuery( 'ul', sliderNav ),
181		slides = jQuery( 'li', sliderNav );
182
183		// Set active
184		jQuery( 'li:first-child', sliderNav ).addClass('active').next().addClass('next');
185
186		// Calculate max offset
187
188		maxOffset = -1 * ( slidesWrapper.height() - sliderNav.height() + 27 * 2 );
189
190		// Previous
191
192		jQuery(document).on('click', '#slider-nav-prev', function(e){
193			
194			e.preventDefault();
195
196			var sliderNavHeight = jQuery('#slider-nav').height();
197			var sliderNavOffset = jQuery('#slider-nav').offset().top;
198			var currSlideRealOffset;
199
200			jQuery('#slider-nav li').each(function(){
201
202				var currSlideOffset = jQuery(this).offset().top;
203				currSlideRealOffset = sliderNavOffset - currSlideOffset;
204
205				if ( currSlideRealOffset > ( sliderNavHeight * -1 ) ) {
206					jQuery(this).next().addClass('slide-nav-last').siblings().removeClass('slide-nav-last');
207				}
208
209				if ( currSlideRealOffset < 0 && currSlideRealOffset > ( -1 * jQuery('#slider-nav li').outerHeight() ) ) {
210					if ( jQuery(this).prev().prev().length ) {
211						jQuery(this).prev().prev().addClass('slide-nav-first').siblings().removeClass('slide-nav-first');
212					} else if ( jQuery(this).prev().length ) {
213						jQuery(this).prev().addClass('slide-nav-first').siblings().removeClass('slide-nav-first');
214					} else {
215						jQuery(this).addClass('slide-nav-first').siblings().removeClass('slide-nav-first');
216					}
217				}
218
219			});
220
221			var firstSlideOffset = -1 * jQuery('.slide-nav-first').position().top + 27;			
222
223			var currOffset = slidesWrapper.position();
224			var newOffset = firstSlideOffset;
225
226			if ( newOffset > 0 )
227				newOffset = 0;
228
229			slidesWrapper.stop().animate({ top : newOffset }, 500);
230
231		});
232
233		// Next
234
235		jQuery(document).on('click', '#slider-nav-next', function(e){
236
237			e.preventDefault();
238
239			var sliderNavHeight = jQuery('#slider-nav').height();
240			var sliderNavOffset = jQuery('#slider-nav').offset().top;
241			var currSlideRealOffset;
242
243			jQuery('#slider-nav li').each(function(){
244
245				var currSlideOffset = jQuery(this).offset().top;
246				currSlideRealOffset = sliderNavOffset - currSlideOffset;
247
248				if ( currSlideRealOffset > ( sliderNavHeight * -1 ) ) {
249					jQuery(this).next().addClass('slide-nav-last').siblings().removeClass('slide-nav-last');
250				}
251
252				if ( currSlideRealOffset < 0 && currSlideRealOffset > ( -1 * jQuery('#slider-nav li').outerHeight() ) ) {
253					jQuery(this).prev().prev().addClass('slide-nav-first').siblings().removeClass('slide-nav-first');
254				}
255
256			});
257
258			var lastSlideOffset = -1 * ( jQuery('.slide-nav-last').position().top - sliderNavHeight ) - jQuery('.slide-nav-last').outerHeight() - 27;
259
260			var currOffset = slidesWrapper.position();
261			var newOffset = lastSlideOffset;
262
263			if ( newOffset < maxOffset )
264				newOffset = maxOffset;
265
266			slidesWrapper.stop().animate({ top : newOffset }, 500);
267
268		});
269
270		// Click
271
272		jQuery(document).on('click', '#slider-nav li', function(e){
273
274			e.preventDefault();
275
276			if ( jQuery('#slider .flexslider .slides:not(:animated)').length ) {
277
278				var position = jQuery(this).index();
279
280				jQuery('#slider .next').removeClass('next');
281				jQuery(this).addClass('active').siblings('.active').removeClass('active').end().next().addClass('next');
282
283				jQuery('#slider').find('.flexslider').flexslider(position);
284
285				/* If at end slide nav */
286
287				var sliderNavHeight = jQuery('#slider-nav').height();
288				var sliderNavOffset = jQuery('#slider-nav').offset().top;
289				var currSlideOffset = jQuery(this).offset().top;
290
291				if ( currSlideOffset > ( sliderNavHeight - 60 ) )
292					jQuery('#slider-nav-next').click();
293				else if ( currSlideOffset < jQuery('#slider-nav .slide').height() * 2.5 )
294					jQuery('#slider-nav-prev').click();
295
296			}
297
298		});
299
300		// Hover
301
302		jQuery('#slider-nav li').mouseenter(function(){			
303
304			jQuery('#slider .next-hover').removeClass('next-hover');
305			jQuery(this).addClass('active-hover').siblings('.active-hover').removeClass('active-hover').end().next().addClass('next-hover');
306
307		}).mouseleave(function(){
308
309			jQuery('#slider .active-hover').removeClass('active-hover');
310			jQuery('#slider .next-hover').removeClass('next-hover');
311
312		});
313
314	}
315
316}
317
318/**
319 * Initiate Carousel
320 */
321function ddCarousel() {
322	
323	jQuery('.carousel').each(function(){
324
325		var carousel = jQuery(this);
326		var container = carousel.closest('.container');
327
328		if ( jQuery(this).hasClass('events') )
329			var minSlides = 3;
330		else
331			var minSlides = 5;
332
333		if ( jQuery('.flexslider li', carousel).length < minSlides )
334			jQuery('.carousel-nav', carousel.closest('.home-section')).hide();
335
336		/* Default values */
337		var def = {
338			autoplay: false,
339			loop: false,
340			autoplaybar: true,
341			animation: 'slide',
342			arrows: true
343		};
344		
345		/* Other vars */
346		var autoplay_state = def.autoplay != false ? true : false;
347		
348		/* Find out the width */
349		var slide_width = jQuery('.slides > li', carousel).width();
350
351		if ( carousel.width() < 450 )
352			slide_width = '';
353
354		var startAt = 0;
355
356		if ( carousel.find('li.start-at').length )
357			startAt = carousel.find('li.start-at').index();
358
359		/* Init slider */
360		jQuery(this).find('.flexslider').flexslider({
361			animation: def.animation,
362			slideshow: autoplay_state,
363			slideshowSpeed: parseInt(def.autoplay),
364			controlNav: false,
365			itemWidth: slide_width,
366			itemMargin: 20,
367			animationLoop: def.loop,
368			prevText: '',
369			nextText: '',
370			startAt : startAt,
371			start: function(){
372				ddEqualSidebar();
373				ddCenterButtons();
374				ddSponsorsEqualHeight();
375				jQuery(window).trigger('resize');
376			},
377			before: function(){
378				ddCauseRaisedAnimate( carousel );
379			}
380		});
381
382		jQuery('.carousel-prev', container).on('click', function(e){
383
384			e.preventDefault();
385			jQuery('.flexslider', carousel).flexslider('prev');
386
387		});
388
389		jQuery('.carousel-next', container).on('click', function(e){
390
391			e.preventDefault();
392			jQuery('.flexslider', carousel).flexslider('next');
393
394		});
395		
396	});
397
398}
399
400/**
401 * Center Arrows
402 */
403function ddCenterArrows() {
404
405	jQuery('.carousel-nav').each(function(){
406
407		var carousel = jQuery(this).closest('.carousel');
408		var carouselHeight = carousel.height();
409		var arrowHeight = jQuery('a', this).height();
410		var centerOffset = carouselHeight / 2 - arrowHeight / 2 + arrowHeight;
411
412		jQuery(this).css({ bottom : centerOffset });
413
414	});
415
416}
417
418/**
419 * Initiate Gallery Slider
420 */
421function ddGallerySlider() {
422	
423	jQuery('.gallery-single-carousel').each(function(){
424
425		var carousel = jQuery(this);
426
427		/* Default values */
428		var def = {
429			autoplay: false,
430			loop: false,
431			autoplaybar: true,
432			animation: 'slide',
433			arrows: true
434		};
435		
436		/* Other vars */
437		var autoplay_state = def.autoplay != false ? true : false;
438		
439		/* Find out the width */
440		var slide_width = 75;
441
442		/* Init slider */
443		jQuery(this).find('.flexslider').flexslider({
444			animation: def.animation,
445			slideshow: autoplay_state,
446			slideshowSpeed: parseInt(def.autoplay),
447			controlNav: false,
448			itemWidth: slide_width,
449			itemMargin: 0,
450			animationLoop: def.loop,
451			prevText: '',
452			nextText: '',
453			asNavFor: '.gallery-single-slider .flexslider',
454			start: function(){
455
456				ddShowHideGalleryArrows();
457
458				/* Init slider */
459				jQuery('.gallery-single-slider').find('.flexslider').flexslider({
460					animation: def.animation,
461					slideshow: autoplay_state,
462					slideshowSpeed: parseInt(def.autoplay),
463					controlNav: false,
464					itemMargin: 0,
465					animationLoop: def.loop,
466					prevText: '',
467					nextText: '',
468					sync: '.gallery-single-carousel .flexslider',
469					start: function(){
470						ddEqualSidebar();
471					}
472				});
473
474			}
475		});
476
477		jQuery('.carousel-prev', carousel).on('click', function(e){
478
479			e.preventDefault();
480			jQuery('.flex-prev', carousel).click();
481
482		});
483
484		jQuery('.carousel-next', carousel).on('click', function(e){
485
486			e.preventDefault();
487			jQuery('.flex-next', carousel).click();
488
489		});
490
491		jQuery('.gallery-slider-prev', jQuery('.gallery-single-slider')).on('click', function(e){
492
493			e.preventDefault();
494			jQuery('.flex-prev', jQuery('.gallery-single-slider')).click();
495
496		});
497
498		jQuery('.gallery-slider-next', jQuery('.gallery-single-slider')).on('click', function(e){
499
500			e.preventDefault();
501			jQuery('.flex-next', jQuery('.gallery-single-slider')).click();
502
503		});
504		
505	});
506
507}
508
509/**
510 * Center Buttons
511 */
512function ddCenterButtons() {
513
514	var overlay, overlayParent, centerOffset;
515
516	jQuery('.gallery-thumb-overlay a').each(function(){
517
518		overlay = jQuery(this);
519		overlayParent = overlay.closest('.gallery-thumb-overlay');
520		centerOffset = overlayParent.height() / 2 - overlay.height() / 2;
521
522		overlay.css({ marginTop : centerOffset });
523
524	});
525
526	jQuery('.product-thumb-overlay-inner').each(function(){
527
528		overlay = jQuery(this);
529		overlayParent = overlay.closest('.product-thumb-overlay');
530		centerOffset = overlayParent.height() / 2 - overlay.height() / 2;
531
532		overlay.css({ marginTop : centerOffset });
533
534	});
535
536}
537
538/**
539 * Show Hide Gallery Arrows
540 */
541function ddShowHideGalleryArrows() {
542
543	var containerWidth, itemsWidth;
544
545	if ( jQuery('body').hasClass('single-dd_gallery') ) {
546
547		containerWidth = jQuery('.gallery-single-carousel').width();
548		itemsWidth = jQuery('.gallery-single-carousel li.slide').outerWidth(true) * jQuery('.gallery-single-carousel li.slide').length;
549
550		if ( itemsWidth < containerWidth )
551			jQuery('.gallery-single-carousel .carousel-nav').hide();
552		else
553			jQuery('.gallery-single-carousel .carousel-nav').show();
554
555	}
556
557}
558
559/**
560 * Initiate Products Slider
561 */
562function ddProductsSlider() {
563	
564	jQuery('.products-slider').each(function(){
565
566		var carousel = jQuery('.products-carousel');
567
568		/* Default values */
569		var def = {
570			autoplay: '0',
571			loop: 'enabled',
572			animation: 'slide'
573		};
574
575		/* User values */
576		var usr = {
577			autoplay: jQuery(this).data('autoplay'),
578			loop: jQuery(this).data('loop'),
579			animation: jQuery(this).data('animation')
580		};
581		
582		/* Merge values */
583		var opts = jQuery.extend({}, def, usr);
584		
585		/* Loop value */
586		if ( opts.loop == 'enabled' )
587			opts.loop = true;
588		else
589			opts.loop = false;
590
591		/* Other vars */
592		var autoplay_state = opts.autoplay != '0' ? true : false;
593		
594		/* Find out the width */
595		var slide_width = jQuery(this).width();
596
597		/* Init slider */
598
599		jQuery('.products-slider').prev('.slider-container-loader').hide();
600
601		jQuery('.products-carousel').find('.flexslider').flexslider({
602			animation: def.animation,
603			slideshow: autoplay_state,
604			slideshowSpeed: parseInt(def.autoplay),
605			controlNav: false,
606			itemWidth: 65,
607			itemMargin: 30,
608			animationLoop: def.loop,
609			prevText: '',
610			nextText: '',
611			asNavFor: '.products-slider .flexslider',
612			start: function(){
613
614				jQuery('.products-carousel').css({ opacity : 1 });
615				jQuery('.products-slider').show();
616
617				ddShowHideGalleryArrows();
618
619				/* Init slider */
620				jQuery('.products-slider').find('.flexslider').flexslider({
621					animation: def.animation,
622					slideshow: autoplay_state,
623					slideshowSpeed: parseInt(def.autoplay),
624					controlNav: false,
625					itemMargin: 0,
626					animationLoop: def.loop,
627					prevText: '',
628					nextText: '',
629					smoothHeight: true,
630					sync: '.products-carousel .flexslider',
631					start: function(){
632						ddEqualSidebar();
633					}
634				});
635
636				if ( jQuery('.flexslider .slides li', carousel).length < 2 )
637					carousel.hide();
638
639			}
640		});
641
642		jQuery('.products-carousel-nav-prev', carousel).on('click', function(e){
643
644			e.preventDefault();
645			jQuery('.flex-prev', carousel).click();
646
647		});
648
649		jQuery('.products-carousel-nav-next', carousel).on('click', function(e){
650
651			e.preventDefault();
652			jQuery('.flex-next', carousel).click();
653
654		});
655		
656	});
657
658	jQuery('.products-slider .flexslider li').each(function(){
659
660		if ( jQuery(this).data('bg-color') !== 'default' )
661			jQuery(this).css({ backgroundColor : jQuery(this).data('bg-color') });
662
663	});
664
665}
666
667/**
668 * Slider Shortcode
669 */
670function ddSliderShortcode() {
671	
672	jQuery('.slider-container').each(function(){
673
674		var slider_container = jQuery(this);
675		var slider = jQuery('.slider', this);
676		var slider_nav = jQuery('.slider-nav', this);
677
678		/* Default values */
679		var def = {
680			autoplay: '0',
681			loop: 'enabled',
682			animation: 'slide'
683		};
684
685		/* User values */
686		var usr = {
687			autoplay: jQuery(this).data('autoplay'),
688			loop: jQuery(this).data('loop'),
689			animation: jQuery(this).data('animation')
690		};
691		
692		/* Merge values */
693		var opts = jQuery.extend({}, def, usr);
694		
695		/* Loop value */
696		if ( opts.loop == 'enabled' )
697			opts.loop = true;
698		else
699			opts.loop = false;
700
701		/* Other vars */
702		var autoplay_state = opts.autoplay != '0' ? true : false;
703
704		/* Init slider */
705		slider_nav.find('.flexslider').flexslider({
706			animation: def.animation,
707			slideshow: autoplay_state,
708			slideshowSpeed: parseInt(def.autoplay),
709			controlNav: false,
710			itemWidth: 65,
711			itemMargin: 30,
712			animationLoop: def.loop,
713			prevText: '',
714			nextText: '',
715			asNavFor: slider.find('.flexslider'),
716			start: function(){
717
718				slider_container.prev('.slider-container-loader').hide();
719
720				/* Init slider */
721				slider.find('.flexslider').flexslider({
722					animation: def.animation,
723					slideshow: autoplay_state,
724					slideshowSpeed: parseInt(def.autoplay),
725					controlNav: false,
726					itemMargin: 0,
727					animationLoop: def.loop,
728					prevText: '',
729					nextText: '',
730					smoothHeight: true,
731					sync: slider_nav.find('.flexslider'),
732					start: function(){
733						slider_container.css({ opacity : 1 });
734						ddEqualSidebar();
735					}
736				});
737
738			}
739		});
740
741		jQuery('.slider-nav-arrow-prev', slider_nav).on('click', function(e){
742
743			e.preventDefault();
744			jQuery('.flexslider', slider_nav).flexslider('prev');
745
746		});
747
748		jQuery('.slider-nav-arrow-next', slider_nav).on('click', function(e){
749
750			e.preventDefault();
751			jQuery('.flexslider', slider_nav).flexslider('next');
752
753		});
754		
755	});
756
757}
758
759/**
760 * Twitter
761 */
762function ddTwitter() {
763
764	var containerWidth = jQuery('#footer-top-inner').width();
765	var profileWidth = jQuery('#footer-top-inner .footer-twitter-profile').outerWidth();
766	var navWidth = jQuery('#footer-top-inner .footer-twitter-nav').outerWidth();
767	var tweetsWidth = containerWidth - profileWidth - navWidth;
768
769	jQuery('.footer-twitter-tweets').width(tweetsWidth).find('.flexslider').flexslider({
770		animation: 'slide',
771		slideshow: false,		
772		controlNav: false,
773		animationLoop: false,
774		prevText: '',
775		nextText: ''
776	});
777
778	jQuery('.footer-twitter-nav-prev').click(function(e){
779
780		e.preventDefault();
781
782		jQuery('.footer-twitter-tweets').find('.flexslider').flexslider('prev');
783
784	});
785
786	jQuery('.footer-twitter-nav-next').click(function(e){
787
788		e.preventDefault();
789
790		jQuery('.footer-twitter-tweets').find('.flexslider').flexslider('next');
791
792	});
793
794}
795
796/**
797 * Tabs
798 */
799function ddTabs() {
800
801	jQuery('.tabs-container').each(function(){
802
803		var tabs = jQuery(this);
804		var tabsNav = tabs.find('.tabs-nav');
805		var tabsContent = tabs.find('.tabs-content');
806
807		// First tab active
808		tabsNav.find('li:first-child').addClass('active');
809		tabsContent.find('.tab-content:first-child').siblings('.tab-content').hide().css( 'opacity', 0);
810
811		tabsNav.find('a').click(function(e){
812
813			e.preventDefault();
814
815			jQuery(this).closest('li').addClass('active').siblings('.active').removeClass('active');
816			var tabNew = tabsContent.find('.tab-content').eq(jQuery(this).closest('li').index());
817
818			tabsContent.find('.tab-content').stop().animate({ opacity : 0 }, 200, function(){
819				tabNew.siblings('.tab-content').hide().end().stop().show().animate({ opacity : 1 }, 200);
820			});
821
822		});
823
824	});
825
826}
827
828/**
829 * Equal Donate Overlay
830 */
831function ddEqualDonateOverlay() {
832
833	var overlayHeight = jQuery('.lb-overlay-inner').outerHeight();
834	var windowHeight = jQuery(window).height();
835	var centerOffset = windowHeight / 2 - overlayHeight / 2;
836
837	jQuery('.lb-overlay-inner').css({ marginTop : centerOffset });
838
839}
840
841/**
842 * Causes Widget
843 */
844function ddCausesWidgetCarousel() {
845	
846	jQuery('.causes-widget-carousel').each(function(){
847
848		/* Default values */
849		var def = {
850			autoplay: '0',
851			loop: 'enabled',
852			animation: 'fade'
853		};
854
855		/* User values */
856		var usr = {
857			autoplay: jQuery(this).data('autoplay'),
858			loop: jQuery(this).data('loop'),
859			animation: jQuery(this).data('animation')
860		};
861		
862		/* Merge values */
863		var opts = jQuery.extend({}, def, usr);
864		
865		/* Loop value */
866		if ( opts.loop == 'enabled' )
867			opts.loop = true;
868		else
869			opts.loop = false;
870
871		/* Other vars */
872		var autoplay_state = opts.autoplay != '0' ? true : false;
873		
874		/* Find out the width */
875		var slide_width = jQuery(this).width();
876
877		/* Init slider */
878		jQuery(this).find('.flexslider').flexslider({
879			animation: opts.animation,
880			slideshow: autoplay_state,
881			slideshowSpeed: parseInt(opts.autoplay),
882			controlNav: false,
883			itemWidth: slide_width,
884			animationLoop: opts.loop,
885			prevText: '',
886			nextText: '',
887			useCSS: false,
888			start: function(){
889				ddEqualSidebar();
890			}
891		});
892
893		if( jQuery(this).find('.slides li:not(.clone)').length < 2 ){
894			jQuery(this).find('.causes-widget-carousel-nav').remove();
895		}
896
897		jQuery('.causes-widget-carousel-prev').on('click', function(e){
898
899			e.preventDefault();
900			jQuery(this).closest('.causes-widget-carousel').find('.flexslider').flexslider('prev');
901
902		});
903
904		jQuery('.causes-widget-carousel-next').on('click', function(e){
905
906			e.preventDefault();
907			jQuery(this).closest('.causes-widget-carousel').find('.flexslider').flexslider('next');
908
909		});
910		
911	});
912
913}
914
915/**
916 * Cause Raised Animate
917 */
918function ddCauseRaisedAnimate( container ){
919
920	if ( container == undefined) container = 'body';
921
922	var the_container = jQuery(container);
923
924	jQuery('.cause-info-widget-percentage-bar, .cause-info-bar', the_container).each(function(){
925
926		var _this = jQuery(this);
927		var percentage = _this.data('raised');
928
929		jQuery('span', _this).css( 'width', 0 ).animate({ width : percentage }, 1000);
930
931	});
932
933}
934
935/**
936 * Flickr Feed
937 */
938function ddFlickrFeed() {
939
940	jQuery('.flickr-feed').each(function(){
941
942		var flickr_id = jQuery(this).data('id');
943		var flickr_amount = jQuery(this).data('amount');
944
945		jQuery(this).jflickrfeed({
946			limit: flickr_amount,
947			qstrings: {
948				id: flickr_id
949			},
950			itemTemplate: '<span><a href="{{image_b}}" target="_blank"><img alt="{{title}}" src="{{image_s}}" /></a></span>'
951		});
952
953	});
954
955
956}
957
958/**
959 * Sponsors - Equal Height
960 */
961
962function ddSponsorsEqualHeight() {
963
964	jQuery('.sponsors').each(function(){
965
966		var sponsors = jQuery(this);
967		var sponsor = jQuery('.sponsor-inner', sponsors);
968		var sponsorTallest = 0;
969
970		sponsor.each( function(){
971			if ( sponsor.height() > sponsorTallest )
972				sponsorTallest = sponsor.height();
973		});
974
975		if ( sponsorTallest > 10 ) {
976			sponsor.css({ height : sponsorTallest });
977		}
978
979	});
980
981}
982
983/**
984 * DOM Ready
985 */
986
987jQuery(document).ready(function($){
988
989	ddHeaderColors();
990	ddTabs();
991	ddCauseRaisedAnimate();
992	ddFlickrFeed();
993
994	/**
995	 * Sticky Header
996	 */
997
998	if ( $('body').hasClass('sticky-header') ) {
999
1000		$('#page-container').css({ paddingTop : $('#header').outerHeight() });
1001
1002	}
1003
1004	/**
1005	 * Move events/causes widget after slider
1006	 */
1007
1008	$('.single-dd_causes #content .widget, .single-dd_events #content .widget').each(function(){
1009
1010		if ( $(this).next('.slider-container-loader') ) {
1011
1012			$(this).insertAfter($(this).next('.slider-container-loader').next('.slider-container'));
1013
1014		}
1015
1016	});
1017
1018	$('input, textarea').placeholder();
1019
1020	$('.sub-menu').each(function(){
1021		$('li:last-child', this).addClass('last-child');
1022	});
1023
1024	/**
1025	 * Header Search
1026	 */
1027
1028	$('.header-search span').click(function(){
1029
1030		if ( $('.header-search').hasClass('header-search-active') ) {
1031			$('.header-search').removeClass('header-search-active').find('.header-search-container').animate({ opacity : 0, top : 10 }, 400, function(){
1032				$('.header-search-container').hide();
1033			});
1034		} else {
1035			$('.header-search').addClass('header-search-active').find('.header-search-container').show().animate({ opacity : 1, top : 33 }, 400);
1036		}
1037
1038	});
1039
1040	/**
1041	 * Footer Banner
1042	 */
1043
1044	var footer_banner_img = $('#footer-banner').data('bg-image');
1045	if ( footer_banner_img != 'none' )
1046		$('#footer-banner').css({ 'background-image' : 'url(' + footer_banner_img + ')' });
1047
1048	/**
1049	 * Sign in Submit
1050	 */
1051
1052	$('.dd-login-submit-hook').click(function(){
1053		$('#dd-login-submit-form').submit();
1054	});
1055
1056	/**
1057	 * Sign in
1058	 */
1059	$('#header .sign-in').click(function(e){
1060
1061		e.preventDefault();
1062
1063		$('#lb-overlay-sign-in').fadeIn(200);
1064		ddEqualDonateOverlay();
1065
1066	});
1067
1068	/**
1069	 * Sub header - Previous of active without border
1070	 */
1071	$('#sub-header a.active').prev('a').addClass('no-border-right');
1072
1073	/**
1074	 * No posts Events Header
1075	 */
1076
1077	$('#sub-header .no-posts').click(function(e){
1078		e.preventDefault();
1079	});
1080
1081	/**
1082	 * Donate - Load More Causes
1083	 */
1084
1085	$('.causes-load-more').on('click', function(e){
1086
1087		// Stop default behaviour
1088		e.preventDefault();
1089
1090		// Declare vars
1091		var current_page, next_page, next_page_link,
1092		_this = jQuery(this),
1093		container = '.causes';
1094
1095		// If there are more posts
1096		if ( ! _this.hasClass('causes-load-more-finished') ) {
1097
1098			// Change text
1099			_this.find('.causes-load-more-text').html(_this.data('loading'));
1100
1101			// Get the pages info
1102			current_page = $('.current', '#pagination');
1103			next_page = current_page.next('li');
1104			next_page_link = $('a', next_page).attr('href');
1105
1106			// Fetch, append and prepare for next page
1107			$.get(next_page_link, function(data){ 
1108
1109				// Append the content
1110				$(container + ' > .cause', data).appendTo(container);
1111
1112				// Animate the causes percentages
1113				ddCauseRaisedAnimate(container);
1114
1115				// Remove current class from previous page
1116				current_page.removeClass('current');
1117
1118				// Add current class to current page
1119				next_page.addClass('current');
1120
1121				// If there are no more posts
1122				if ( ! next_page.next('li').length )
1123					_this.addClass('causes-load-more-finished').find('.causes-load-more-text').html(_this.data('finished'));
1124				else
1125					_this.find('.causes-load-more-text').html(_this.data('default'));			
1126
1127			});
1128
1129		}
1130
1131	});
1132
1133	/**
1134	 * Cause Single - Donate
1135	 */
1136
1137	$('.cause-info-widget-donate a').click(function(e){
1138
1139		if ( $(this).attr('href') == '#' ) {
1140
1141			e.preventDefault();
1142
1143			$('#lb-overlay-donate').fadeIn(200);
1144			ddEqualDonateOverlay();
1145
1146		}
1147
1148	});
1149
1150	$('.lb-overlay').click(function(e) {
1151
1152		if (e.target.className === 'lb-overlay')
1153				$('.lb-overlay').fadeOut(200);	
1154
1155	});
1156
1157	/**
1158	 * Button DropDown
1159	 */
1160
1161	$('.dd-button-dropdown').mouseenter(function(){
1162		$('.dd-button-dropdown-content', this).slideDown(200);
1163	}).mouseleave(function(){
1164		$('.dd-button-dropdown-content', this).stop().slideUp(200);
1165	});
1166
1167	$('.dd-button-dropdown a').click(function(e){
1168
1169		if ( $(this).attr('href') == '#' ) {
1170
1171			e.preventDefault();
1172
1173			$('.dd-button-dropdown-content', $(this).closest('.dd-button-dropdown')).stop().slideUp(200);
1174
1175			$(this).closest('.dd-button-dropdown').find('.dd-button-txt').text($(this).text());
1176
1177		}
1178
1179	});
1180
1181	/**
1182	 * Last Classes
1183	 */
1184	 $('#footer .widget:last-child').addClass('last');
1185
1186	 /**
1187	  * Events Calendar
1188	  */
1189
1190	 $(document).on('click', '.events-calendar td a', function(e){
1191
1192	 	if ( $(this).closest('.widget').length ) {
1193
1194	 	} else {
1195
1196	 		e.preventDefault();
1197
1198		 	var container = $(this).closest('.home-section');
1199		 	var slider = container.find('.flexslider');
1200
1201		 	var day = $(this).data('day');
1202		 	var firstOnDay = slider.find('li[data-day="' + day + '"]:first').index();
1203		 	var lastItem = slider.find('li[data-day="' + day + '"]:last-child').index();
1204
1205		 	if ( firstOnDay == lastItem ) {
1206
1207		 		$(this).closest('.home-section').find('.flexslider').flexslider(lastItem - 1);
1208
1209		 	} else {
1210
1211			 	if ( firstOnDay != -1 )
1212					$(this).closest('.home-section').find('.flexslider').flexslider(firstOnDay);
1213
1214			}
1215
1216		}
1217
1218	 });
1219
1220	 $(document).on('click', '.events-calendar-caption a', function(e){
1221
1222	 	e.preventDefault();
1223
1224	 	var _this = $(this);
1225	 	var calendar = _this.closest('.events-calendar');
1226	 	var goToMonth = _this.data('month');
1227	 	var goToYear = _this.data('year');
1228
1229	 	if ( ! calendar.hasClass('loading') ) {
1230
1231		 	calendar.addClass('loading');
1232
1233		 	jQuery.post(
1234
1235				DDAjax.ajaxurl,
1236				{
1237					action : 'dd-events-calendar',
1238					month : goToMonth,
1239					year : goToYear
1240				},
1241				function( response ) {
1242					
1243					calendar.after(response.output);
1244					calendar.animate({ marginLeft : -380 }, 300, function(){
1245						calendar.remove();
1246					});
1247					calendar.removeClass('loading');				
1248
1249				}
1250
1251			);
1252
1253		}
1254
1255	 });
1256	
1257	/**
1258	 * Thumb Arrows
1259	 */
1260
1261	$('.gallery-thumb, .blog-post-thumb, .blog-post-single-thumb').append('<span class="thumb-arrow"></span>');
1262
1263	/**
1264	 * Top Info
1265	 */
1266
1267		$('.top-info-show').click(function(){
1268			$('#top-info-inner').stop().slideDown(200);
1269			$('.top-info-hide').css({ 'z-index' : 1001 });
1270			$(this).hide();
1271		});
1272
1273		$('.top-info-hide').click(function(){
1274			$('#top-info-inner').stop().slideUp(200);
1275			$('.top-info-show').show().css({ 'z-index' : 1001 });
1276			$(this).css({ zIndex : 1 });
1277		});
1278
1279	/**
1280	 * Navigation
1281	 */
1282
1283	 	$('#nav li').mouseenter(function(){
1284	 		$(this).addClass('hover');
1285	 	}).mouseleave(function(){
1286	 		$(this).removeClass('hover');
1287	 	});
1288
1289	 	$('.sub-menu').hide();
1290
1291	 	$('#nav li').mouseenter(function(){
1292
1293	 		$(this).children('.sub-menu').css({ display : 'block', left : '80%' }).stop().animate({ opacity : 1, left : '100%' }, 350);
1294
1295	 	}).mouseleave(function(){
1296
1297	 		$(this).children('.sub-menu').stop().animate({ left : '80%', opacity : 0 }, 250, function(){
1298	 			$(this).css('display', 'none');
1299	 		});
1300
1301	 	});
1302
1303	 /**
1304	  * Gallery
1305	  */
1306
1307	 	$('.gallery-thumb').on('mouseenter', function(){
1308	 		$('.gallery-thumb-overlay', $(this)).stop().animate( { opacity : 1 }, 300 );
1309	 	}).on('mouseleave', function(){
1310	 		$('.gallery-thumb-overlay', $(this)).stop().animate( { opacity : 0 }, 300 );
1311	 	});
1312
1313	 /**
1314	  * Products
1315	  */
1316
1317	 	$('.product-thumb').on('mouseenter', function(){
1318	 		$('.product-thumb-overlay', $(this)).stop().animate( { opacity : 1 }, 300 );
1319	 	}).on('mouseleave', function(){
1320	 		$('.product-thumb-overlay', $(this)).stop().animate( { opacity : 0 }, 300 );
1321	 	});
1322
1323	 	$(document).on( 'click', '.add-to-cart-ajax', function(e){
1324
1325	 		e.preventDefault();
1326
1327	 		var add_to_cart = $(this);
1328	 		var add_to_cart_url = add_to_cart.attr('href');
1329	 		var view_cart_url = add_to_cart.data('view-cart-url');
1330	 		var view_cart_text = add_to_cart.data('view-cart-text');
1331
1332	 		add_to_cart.append('<span class="icon-cycle"></span>');
1333
1334			$.get( add_to_cart_url, function(data) {				
1335				add_to_cart.html( '<span class="icon-cart"></span>' + view_cart_text).attr( 'href', view_cart_url ).removeClass('add-to-cart-ajax');
1336			});
1337
1338	 	});
1339
1340	 /**
1341	  * Lightbox
1342	  */
1343
1344	  	$("a[rel^='prettyPhoto']").prettyPhoto({
1345	  		theme: 'light_square',
1346	  		social_tools: ''
1347	  	});
1348
1349	  /**
1350	   * Mobile Nav
1351	   */
1352
1353	   	$('#mobile-nav select').change(function() {
1354			window.location = $(this).val();
1355		});		
1356
1357	/**
1358	 * Init Donate on load
1359	 */
1360
1361	if ( $('body').hasClass('init-donate') )
1362		$('.cause-info-widget-donate a').click();
1363
1364	/**
1365	 * Autofocus on donate page
1366	 */
1367
1368	if ( $('body').hasClass('page-template-template-donate-php') )
1369		$('.lb-overlay-form-amount input').focus();
1370
1371	/**
1372	 * Autofocus when replying to comment
1373	 */
1374
1375	if ( $('#cancel-comment-reply-link:visible').length )
1376		$('.comment-form-comment textarea').focus();
1377
1378	/**
1379	 * Donate Button
1380	 */
1381
1382	$('#lb-overlay-donate .lb-overlay-form-submit, #lb-overlay-donate-page .lb-overlay-form-submit').click(function(){
1383
1384		$('#lb-overlay-donate form, #lb-overlay-donate-page form').submit();
1385
1386	});
1387
1388	/**
1389	 * Subheader (generate mobile version)
1390	 */
1391
1392	if ( $('#sub-header').length ) {
1393
1394		var sh_mobile_opts = '',
1395		sh_mobile_select = '';
1396
1397		$('a', '#sub-header').each(function(){
1398
1399			var sh_title = $(this).text();
1400			var sh_url = $(this).attr('href');
1401
1402			if ( $(this).hasClass('active') ) {
1403				sh_mobile_opts = sh_mobile_opts + '<option selected="selected" value="' + sh_url + '">' + sh_title + '</option>';
1404			} else {
1405				sh_mobile_opts = sh_mobile_opts + '<option value="' + sh_url + '">' + sh_title + '</option>';
1406			}
1407
1408		});
1409
1410		if ( ! $('a.active', '#sub-header').length ) {
1411			sh_mobile_opts = '<option value="#">GO TO</option>' + sh_mobile_opts;
1412		}
1413
1414		sh_mobile_select = '<div class="sub-header-mobile"><select>' + sh_mobile_opts + '</select></div>';
1415
1416		$('#sub-header-inner').append(sh_mobile_select);
1417
1418		$('.sub-header-mobile select').change(function(){
1419			window.location = $(this).val();
1420		});
1421
1422	}
1423
1424});
1425
1426/**
1427 * Fully Loaded
1428 */
1429
1430jQuery(window).load(function(){
1431
1432	ddMasonry( '.events.masonry', '.event' );
1433	ddMasonry( '.causes.masonry', '.cause' );
1434	ddMasonry( '.blog-posts.masonry', '.blog-post' );
1435	ddSliderShortcode();
1436	ddSlider();
1437	ddCarousel();
1438	ddGallerySlider();
1439	ddProductsSlider();
1440	ddTwitter();
1441	ddEqualSidebar();
1442	ddEqualDonateOverlay();
1443	ddCausesWidgetCarousel();
1444
1445	jQuery(window).resize(function(){
1446		//ddCenterArrows();
1447		ddCenterButtons();
1448		ddShowHideGalleryArrows();
1449		ddEqualSidebar();
1450
1451		if ( jQuery('body').hasClass('sticky-header') ) {
1452
1453			jQuery('#page-container').css({ paddingTop : jQuery('#header').outerHeight() });
1454
1455		}
1456
1457	});
1458
1459});
1460
1461/**
1462 * BuddyPress
1463 */
1464
1465function ddbpFilters( container ) {
1466
1467	var optionVal, optionTxt, optionOutput = '', optionOptions = '';
1468
1469	if ( jQuery(container).length ) {
1470
1471		jQuery(container).hide();
1472
1473		jQuery(container).each(function(){
1474
1475			jQuery('select option', jQuery(this)).each(function(){
1476
1477				optionVal = jQuery(this).val();
1478				optionTxt = jQuery(this).text();
1479
1480				optionOptions += '<li><a href="#" data-option-id="' + optionVal + '">' + optionTxt + '</a></li>';
1481	 
1482			});
1483
1484		});
1485
1486		optionOutput += '<div class="dd-button-dropdown fr active sub-header-year-selection">'
1487			optionOutput += '<div class="dd-button-dropdown-content">';
1488				optionOutput += '<ul>';
1489
1490					optionOutput += optionOptions;
1491
1492				optionOutput += '</ul>';
1493			optionOutput += '</div>';
1494			optionOutput += '<a href="#" class=""><span class="dd-button-txt">EVERYTHING</span><span class="dd-button-icon"><span class="icon-chevron-down"></span></span></a>';
1495		optionOutput += '</div>'
1496
1497		jQuery('#sub-header-bp > .fr').append(optionOutput);
1498
1499		jQuery('.dd-button-dropdown', '#sub-header').mouseenter(function(){
1500			jQuery('.dd-button-dropdown-content', this).slideDown(200);
1501		}).mouseleave(function(){
1502			jQuery('.dd-button-dropdown-content', this).stop().slideUp(200);
1503		});
1504
1505		jQuery('.dd-button-dropdown a', '#sub-header').click(function(e){
1506
1507			if ( jQuery(this).attr('href') == '#' ) {
1508
1509				e.preventDefault();
1510
1511				jQuery('.dd-button-dropdown-content', jQuery(this).closest('.dd-button-dropdown')).stop().slideUp(200);
1512				jQuery(this).closest('.dd-button-dropdown').find('.dd-button-txt').text( jQuery(this).text() );
1513
1514				jQuery('select', container).val(jQuery(this).data('option-id')).trigger('change');
1515
1516			}
1517
1518		});
1519
1520	}
1521
1522}
1523
1524jQuery(document).ready(function($){
1525
1526	ddbpFilters( $('#activity-filter-select') );
1527	ddbpFilters( $('#members-order-select') );
1528	ddbpFilters( $('#groups-order-select') );
1529
1530	jQuery('.rev_slider li').each(function(){
1531		jQuery('.tp-caption.big_orange', this).eq(1).addClass('dd-rev-caption-second');
1532		jQuery('.tp-caption.big_yellow', this).eq(1).addClass('dd-rev-caption-second');
1533		jQuery('.tp-caption.big_black', this).eq(1).addClass('dd-rev-caption-second');
1534		jQuery('.tp-caption.big_white', this).eq(1).addClass('dd-rev-caption-second');
1535		jQuery('.tp-caption.big_bluee', this).eq(1).addClass('dd-rev-caption-second');
1536	});
1537
1538	$('.item-list-tabs .feed').each(function(){
1539		
1540		var feedLink = $('a', $(this)).attr('href');
1541		var feedTxt = $('a', $(this)).text();
1542
1543		$(this).hide();
1544
1545		$('#sub-header-bp > .fr').append('<a class="fr" href="' + feedLink + '">' + feedTxt + '</a>');
1546
1547	});	
1548
1549	$('.dd-bp-content:empty, .dd-bp-wrapper-primary:empty, .dd-bp-wrapper-secondary:empty').hide();
1550
1551	$('#group-create-body label, .group-admin #buddypress label, .buddypress .standard-form label').each(function(){
1552
1553		if ( ! $('form#send_message_form').length && ! $('#signup_form').length ) {
1554
1555			var bp_input_placeholder = $(this).text();
1556			if ( $(this).siblings('input[type="text"], textarea').length ) {
1557				$(this).hide().siblings('input[type="text"], input[type="password"], textarea').attr('placeholder', bp_input_placeholder);
1558			}
1559
1560		}
1561
1562		if ( $('#signup_form').length ) {
1563
1564			var bp_input_placeholder = $(this).text();
1565			if ( $(this).next('input[type="text"], textarea, input[type="password"]').length ) {
1566				$(this).hide().next('input[type="text"], input[type="password"], textarea').attr('placeholder', bp_input_placeholder);
1567			}
1568
1569		}
1570
1571	});
1572
1573	$('#whats-new').autosize();
1574
1575	$('#buddypress .button.acomment-reply').addClass('purple');
1576	$('#buddypress .button.fav').addClass('orange');
1577	$('#buddypress .button.unfav, #buddypress .button.delete-activity').addClass('red');
1578
1579	if ( $('#members-list .update').length ) {
1580
1581		$('#members-list .update').each(function(){
1582
1583			var bp_update = $(this);
1584			var bp_action = bp_update.closest('li').find('.action');
1585
1586			var bp_action_offset = bp_update.outerHeight() / 2 - bp_action.outerHeight() / 2 + 15;
1587
1588			bp_action.css( 'margin-top', bp_action_offset );
1589
1590		});
1591
1592	}
1593
1594	$('.dd-bp-post-in-fake a').click(function(e){
1595
1596		if ( $(this).attr('href') == '#' ) {
1597
1598			e.preventDefault();
1599
1600			$('#whats-new-post-in option:eq(' + $(this).closest('li').index() + ')').attr('selected', 'selected');
1601
1602		}
1603
1604	});
1605
1606	$('.dd-bp-wrapper-secondary', '#buddypress #members-list').each(function(){
1607
1608		if( ! $('.update', this).length ) {
1609			$(this).addClass('dd-bp-no-update');
1610		}
1611
1612	});
1613
1614	if ( $('.item-list-tabs:first').length ) {
1615
1616		if ( ! $('body').hasClass('group-create') ) {
1617
1618			var bp_nav = $('.item-list-tabs:first');
1619			var bp_fake_nav = $('#sub-header-bp .fl');
1620
1621			bp_nav.hide();
1622
1623			if ( bp_nav.hasClass('no-ajax') ) {
1624
1625				$('li', bp_nav).each(function(){
1626
1627					var bp_nav_item_link = $('a', this).attr('href');
1628					var bp_nav_item_title = $('a', this).html();
1629
1630					if ( $(this).hasClass('current') )
1631						bp_fake_nav.append('<a href="' + bp_nav_item_link + '" class="fl active">' + bp_nav_item_title + '</a>');
1632					else
1633						bp_fake_nav.append('<a href="' + bp_nav_item_link + '" class="fl">' + bp_nav_item_title + '</a>');
1634
1635				});
1636
1637			} else {
1638
1639				$('li', bp_nav).each(function(){
1640
1641					var bp_item_count = $(this).index();
1642
1643					var bp_nav_item_title = $('a', this).html();
1644
1645					$('a', this).data('hook', bp_item_count);
1646
1647					if ( $(this).hasClass('current') )
1648						bp_fake_nav.append('<a href="#" data-hook="' + bp_item_count + '" class="fl active">' + bp_nav_item_title + '</a>');
1649					else
1650						bp_fake_nav.append('<a href="#" data-hook="' + bp_item_count + '" class="fl">' + bp_nav_item_title + '</a>');
1651
1652				});
1653
1654				$('a:first', bp_fake_nav).addClass('active');
1655
1656			}
1657
1658			$('a span', bp_fake_nav).each(function(){
1659
1660				$(this).prepend(' (').append(')');
1661
1662			});
1663
1664			$('a', bp_fake_nav).click(function(e){
1665
1666				if ( $(this).attr('href') == '#' ) {
1667
1668					e.preventDefault();
1669
1670					$(this).addClass('active').siblings('.active').removeClass('active');
1671
1672					var bp_hook = $(this).data('hook');
1673
1674					$('li:eq(' + bp_hook + ') a', bp_nav).click();
1675
1676				}
1677
1678			});	
1679
1680		}
1681
1682	}
1683
1684});

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.