PageSourceSearch

https://www.samaritansonlus.org/wp-content/themes/CherryFramework/js/custom.js?ver=1.0

js samaritansonlus.org collected 2026-10-01 15:35:52 UTC 6,928 bytes, 191 lines download raw bytes

1// ---------------------------------------------------------
2// Magnific Popup Init
3// ---------------------------------------------------------
4function magnific_popup_init(item) {
5	item.magnificPopup({
6		delegate: 'a[rel^="prettyPhoto"]',
7		type: 'image',
8		removalDelay: 500,
9		mainClass: 'mfp-zoom-in',
10		callbacks: {
11			beforeOpen: function() {
12				// just a hack that adds mfp-anim class to markup 
13				this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
14			}
15		},
16		gallery: {enabled:true}
17	});
18}
19// ---------------------------------------------------------
20// !!!!!!!!!!!!!!!!!document ready!!!!!!!!!!!!!!!!!!!!!!!!!!
21// ---------------------------------------------------------
22jQuery(document).ready(function(){
23// ---------------------------------------------------------
24// Blog masonry
25// ---------------------------------------------------------
26	if(jQuery('body.blog')[0]){
27		var isotope_holder = jQuery('.isotope');
28		isotope_holder.isotope({
29			itemSelector : '.post_wrapper',
30			hiddenClass : 'hidden',
31			resizable : true,
32			transformsEnabled : false,
33			layoutMode: 'masonry'
34		}).bind("resize.rainbows", function(){
35			isotope_holder.isotope('reLayout');
36		}).trigger("resize.rainbows").css({'visibility':'visible'});
37	}
38// ---------------------------------------------------------
39// Call Magnific Popup
40// ---------------------------------------------------------
41	jQuery(".thumbnail").parent().each(function(){magnific_popup_init(jQuery(this))});
42// ---------------------------------------------------------
43// Tooltip
44// ---------------------------------------------------------
45	jQuery("[rel='tooltip']").tooltip();
46// ---------------------------------------------------------
47// Back to Top
48// ---------------------------------------------------------
49	jQuery(window).scroll(function () {
50		if (jQuery(this).scrollTop() > 100) {
51			jQuery('#back-top').fadeIn();
52		} else {
53			jQuery('#back-top').fadeOut();
54		}
55	});
56	jQuery('#back-top a').click(function () {
57		jQuery('body,html').stop(false, false).animate({
58			scrollTop: 0
59		}, 800);
60		return false;
61	});
62// ---------------------------------------------------------
63// Add accordion active class
64// ---------------------------------------------------------
65	jQuery('.accordion').on('show', function (e) {
66		jQuery(e.target).prev('.accordion-heading').find('.accordion-toggle').addClass('active');
67	});
68	jQuery('.accordion').on('hide', function (e) {
69		jQuery(this).find('.accordion-toggle').not(jQuery(e.target)).removeClass('active');
70	});
71// ---------------------------------------------------------
72// Isotope Init
73// ---------------------------------------------------------
74	jQuery("#portfolio-grid").css({"visibility" : "visible"});
75// ---------------------------------------------------------
76// Menu Android
77// ---------------------------------------------------------
78	if(window.orientation!=undefined){
79		var regM = /ipod|ipad|iphone/gi,
80			result = navigator.userAgent.match(regM)
81		if(!result) {
82			jQuery('.sf-menu li').each(function(){
83				if(jQuery(">ul", this)[0]){
84					jQuery(">a", this).toggle(
85						function(){
86							return false;
87						},
88						function(){
89							window.location.href = jQuery(this).attr("href");
90						}
91					);
92				} 
93			})
94		}
95	}
96// ---------------------------------------------------------
97// images loader
98// ---------------------------------------------------------
99	var MSIE8 = (jQuery.browser.msie) && (jQuery.browser.version == 8);
100	jQuery('img[data-src]').bind('load', img_load_complete);
101	jQuery(window).bind('resize', img_loader).bind('scroll', img_loader).trigger('scroll');
102	
103	function img_loader(){
104		var get_img = jQuery('img[data-src]').eq(0)
105		if(get_img[0]){
106			var visible_height = jQuery(window).scrollTop() + jQuery(window).height(),
107				img_top_position = get_img.offset().top;
108
109			if(img_top_position<visible_height){
110				get_img.attr({'src':get_img.attr('data-src')}).removeAttr('data-src');
111				if(!MSIE8){
112					get_img.fadeOut(0)
113				}
114			};
115		}else{
116			jQuery(window).unbind('resize', img_loader).unbind('scroll', img_loader);
117		}
118	}
119	function img_load_complete(){
120		jQuery(this).unbind('load');
121		if(!MSIE8){
122			jQuery(this).fadeIn(500)
123		}
124		if(jQuery('body.blog')[0]){
125			isotope_holder.isotope('reLayout');
126		}
127		img_loader();
128	}
129// ---------------------------------------------------------
130// set voting post JS
131// ---------------------------------------------------------
132	jQuery('.ajax_voting').bind('click', voitng);
133	function voitng(){
134		var item= jQuery(this),
135			item_parent = item.parents('[class*="meta_type"]'),
136			type = item.attr('date-type'),
137			item_class='user_'+type,
138			count = parseInt(jQuery('.voting_count', item).text()),
139			top_position = (type==='like') ? -18 : 18 ,
140			mark = (type==='like') ? '+' : '-', 
141			post_url = item.attr('href');
142
143		jQuery('.post_like>a, .post_dislike>a', item_parent).unbind('click', voitng).removeAttr('href date-type').removeClass('ajax_voting').addClass('user_voting');
144		item.removeClass('user_voting').addClass(item_class).find('.voting_count').text(++count).append('<span class="animation_item">'+mark+'1</span>');
145		jQuery('.animation_item', item).stop(true).animate({'top':top_position, opacity:'0'}, 500, 'easeOutCubic', function(){jQuery(this).remove()});
146
147		jQuery.post(post_url);
148		return false;
149	}
150// ---------------------------------------------------------
151// Contact form loader
152// ---------------------------------------------------------
153	jQuery('.wpcf7-submit').after('<div class="ajax-loader"></div>');
154	jQuery('.wpcf7-submit').click(function(){
155		var listener = setInterval(
156				function(){
157					if(jQuery('img.ajax-loader').css('visibility')=='visible'){
158						jQuery('div.ajax-loader').css({'display':'inline-block'});
159					}else{
160						jQuery('div.ajax-loader').css({'display':'none'});
161						clearInterval(listener);
162					}
163				},100);
164	})
165// ---------------------------------------------------------
166// OWL Carousel init
167// ---------------------------------------------------------
168	jQuery('div[id^="owl-carousel-"]').each(function(){
169		var carousel = jQuery(this),
170			auto_play = parseInt(carousel.attr('data-auto-play'))<1 ? false : parseInt(carousel.attr('data-auto-play')),
171			items_count = parseInt(carousel.attr('data-items')),
172			disolay_navs = carousel.attr('data-nav')=='true' ? true : false,
173			disolay_pagination = carousel.attr('data-pagination')=='true' ? true : false,
174			auto_height = items_count<=1 ? true : false;
175
176		jQuery(carousel).owlCarousel({
177			autoPlay: auto_play,
178			items: items_count,
179			navigation : disolay_navs,
180			pagination : disolay_pagination,
181			navigationText:false,
182			autoHeight:auto_height,
183			itemsDesktop:[1170, 5],
184			itemsDesktopSmall:[980, 4],
185			itemsTablet:[768, 3],
186			itemsMobile:[480, 2]
187		});
188	})
189	jQuery('.owl-prev').addClass('icon-chevron-left');
190	jQuery('.owl-next').addClass('icon-chevron-right');
191});

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.