PageSourceSearch

https://valleytownhall.com/wp-content/themes/eventim/js/misc.js?ver=7.1.2

js valleytownhall.com collected 2026-09-30 13:06:13 UTC 16,099 bytes, 467 lines download raw bytes

1'use strict';
2
3window.addEventListener("pageshow", function(evt){
4        if(evt.persisted){
5        setTimeout(function(){
6            window.location.reload();
7        },10);
8    }
9}, false);
10
11window.onunload = function(){};
12
13window.addEventListener( 'pageshow', function( e ) {
14	if ( e.persisted ) {
15		setTimeout( function() {
16			window.location.reload();
17		}, 10 );
18    }
19}, false );
20
21window.boldthemes_loaded = false;
22
23(function( $ ) {
24
25	function boldthemes_video_resize() {
26		$( 'iframe' ).not( '.twitter-tweet' ).each(function() {
27			if ( ! $( this ).parent().hasClass( 'boldPhotoBox' ) ) {
28				$( this ).css( 'width', '100%' );
29				$( this ).css( 'height', $( this ).width() * 9 / 16 );
30			}
31		});
32		
33		$( 'embed' ).each(function() {
34			if ( ! $( this ).parent().hasClass( 'boldPhotoBox' ) ) {
35				$( this ).css( 'width', '100%' );
36				$( this ).css( 'height', $( this ).width() * 9 / 16 );
37			}
38		});	
39	}
40	
41	jQuery.fn.isOnScreen = function() {
42		var element = this.get( 0 );
43		if ( element == undefined ) return false;
44		var bounds = element.getBoundingClientRect();
45		return bounds.top + 75 < window.innerHeight && bounds.bottom > 0;
46	}
47
48	$( document ).ready(function() {
49		
50		boldthemes_video_resize();
51		
52		/* position on screen */
53
54		$( '.btSidebar select, select.orderby, .wpcf7-form select:not([multiple])' ).fancySelect().on( 'change.fs', function() {
55			$( this ).trigger( 'change.$' );
56		});
57		
58		if ( $( '.btGhost' ).length > 0 ) {
59			$( 'body' ).append( $( '.btGhost' ) );
60			$( 'body' ).addClass( 'btHasGhost' );
61		}
62		
63		$( '.btQuoteSlider' ).wrap( '<div class="btQuoteWrapper"></div>' );
64
65		$( '.btHasGhost .btGhostSliderThumb a' ).on( 'click', function( e ) {
66			e.preventDefault();
67			$( '.single-portfolio .btGhost' ).removeClass( 'btRemoveGhost' );
68			$( '.btHasGhost .btGhostSliderThumb' ).removeClass( 'btMarkedImage' );
69			boldthemes_disable_scroll();
70			$( '.btGhost .slick-slider' ).slick( 'slickGoTo', $( this ).closest( '.btGhostSliderThumb' ).data( 'order-num' ) );
71		});
72		
73		if ( $( window ).scrollTop() > 0 || $( 'html' ).hasClass( 'no-csstransforms3d' ) ) {
74			$( '.btGhost' ).addClass( 'btRemoveGhost' );
75		}
76		
77		window.boldthemes_theme_loaded = false;
78		
79		window.boldthemes_disable_scroll = function() {
80			window.onmousewheel = document.onmousewheel = function() {
81				if ( window.boldthemes_theme_loaded ) {
82					$( '.btCloseGhost' ).trigger( 'click' );
83				}
84				if ( ! window.boldthemes_theme_loaded || ! window.boldthemes_theme_allow_scroll ) {
85					return false;
86				}
87			};
88			$( window ).on( 'DOMMouseScroll', function( e ) {
89				if ( window.boldthemes_theme_loaded ) {
90					$( '.btCloseGhost' ).trigger( 'click' );
91				}			
92				if ( ! window.boldthemes_theme_loaded || ! window.boldthemes_theme_allow_scroll ) {
93					e.preventDefault();
94				}
95			});		
96		}
97		
98		window.boldthemes_enable_scroll = function() {
99			window.onmousewheel = document.onmousewheel = null;
100		}
101		
102		var articleWithGhost = $( '.btPostOverlay' ).length > 0;
103		
104		if ( $( '.btRemoveGhost' ).length == 0 && $( '.btGhost' ).length > 0  ) {
105			window.boldthemes_theme_allow_scroll = false;
106			boldthemes_disable_scroll();
107		}
108		
109	});
110
111	$( window ).load(function() {
112		window.boldthemes_theme_loaded = true;
113		
114		// remove preloader
115		$( '#btPreloader' ).addClass( 'removePreloader' );
116		
117		// trigger custom load event
118		setTimeout( function() { $( window ).trigger( 'btload' ); window.boldthemes_loaded = true; }, 1000 );
119		
120	});
121
122	$( window ).resize(function() {
123		boldthemes_video_resize();
124	});
125
126	/* Animate classic elements */
127
128	function btAnimateRows() {
129		var $elems = $( 'body:not(.btPageTransitions) .rowItem.animate:not(.animated), .headline .animate, article.animate' ).not( '.slided .animate' );
130		$elems.each(function() {
131			var $elm = $( this );
132			if ( 
133			( $elm.isOnScreen() && ! $( 'body' ).hasClass( 'impress-enabled' ) ) ||
134			( $elm.isOnScreen() && $( 'body' ).hasClass( 'impress-enabled' ) && $elm.closest( '.boldSection' ).hasClass( 'active' ) )
135			) {
136				$elm.addClass( 'animated' );
137			}
138		});
139	}
140
141	if ( ! $( 'body' ).hasClass( 'impress-enabled' ) ) {
142		$( window ).scroll(function() {
143			btAnimateRows();
144		});
145	}	
146
147	$( window ).on( 'btload', function() {
148		btAnimateRows();
149		
150		// autoplay
151		if ( $( 'li.btAnimNavNext' ).length && $( 'body' ).data( 'autoplay' ) > 0 ) {
152			window.boldthemes_autoplay_interval = setInterval( function(){ $( 'li.btAnimNavNext' ).trigger( 'click' ); }, $( 'body' ).data( 'autoplay' ) );
153		}		
154	});
155	
156	$( window ).on( 'boldthemes_section_animation_out', function( e, el ) {
157		$( el ).find( '.rowItem.animated' ).removeClass( 'animated' );
158	});
159	
160	$( window ).on( 'boldthemes_section_animation_end', function( e, el ) {
161		$( el ).find( '.rowItem.animate' ).addClass( 'animated' );
162	});		
163
164	$( document ).ready(function() {
165
166		var doc = document.documentElement;
167		doc.setAttribute('data-useragent', navigator.userAgent);
168
169		// basic functions
170
171		if ( ! String.prototype.startsWith ) {
172			String.prototype.startsWith = function(searchString, position) {
173				position = position || 0;
174				return this.lastIndexOf(searchString, position) === position;
175			};
176		}
177
178		if ( ! String.prototype.endsWith ) {
179			String.prototype.endsWith = function(searchString, position) {
180				var subjectString = this.toString();
181				if (position === undefined || position > subjectString.length) {
182					position = subjectString.length;
183				}
184				position -= searchString.length;
185				var lastIndex = subjectString.indexOf(searchString, position);
186				return lastIndex !== -1 && lastIndex === position;
187			};
188		}
189
190		/* scroll handlers */
191
192		function scrollPage() {
193			var fromTop = $( this ).scrollTop();
194			$( '.btCloseGhost' ).trigger( 'click' );
195		}
196
197		function scrollPageTo( val ) {
198			val = parseInt( val );
199			$( 'body, html' ).animate({ scrollTop: val + 'px' }, 500 );
200		}
201
202		function scrollPageToId(id) {
203			if ( $( id ).length == 0 ) return false;
204			var topOffset = $( id ).offset().top;
205			if ( window.btStickyEnabled && topOffset > window.btStickyOffset ) {
206				topOffset -= $( '.mainHeader' ).height();
207				
208			}
209			$( 'html, body' ).animate({ scrollTop: topOffset }, 500);
210		}
211
212		/* init scroll listener */
213
214		window.addEventListener( 'scroll', scrollPage );
215	 	
216		// delay click to allow on page leave screen
217
218		$( document ).on( 'click', 'a', function() {
219			if ( ! $( this ).hasClass( 'lightbox' ) && ! $( this ).hasClass( 'add_to_cart_button' ) ) {
220				var href = $( this ).attr( 'href' );
221				if ( href !== undefined ) {
222					if ( location.href == href || ( location.href.split( '#' )[0] != href.split( '#' )[0] && ! href.startsWith( '#' ) && ! href.startsWith( 'mailto' ) && ! href.startsWith( 'callto' ) ) ) {
223						if ( $( this ).attr( 'target' ) != '_blank' && ! href.endsWith( '#respond' ) ) {
224							if ( $( '#btPreloader' ).length ) {
225								$( '#btPreloader' ).removeClass( 'removePreloader' );
226								setTimeout( function() { window.location = href }, 1500 );
227								return false;
228							}
229						}
230					} else if ( href != "#" && ! href.startsWith( 'mailto' ) ) {
231						if ( $( this ).parent().parent().attr('class') != 'tabsHeader' ) scrollPageToId( href );
232						return false;
233					}
234				}
235			}
236		});
237
238		// Vertical alignment fix
239
240		$( '.rowItem.btMiddleVertical, .rowItem.btBottomVertical' ).parent().addClass( 'btTableRow' );
241
242		/* Footer widgets count and column set */
243
244		$( '#boldSiteFooterWidgetsRow' ).children().addClass( 'rowItem col-md-' + 12 / $( '#boldSiteFooterWidgetsRow' ).children().length + ' col-sm-12' );
245
246		// Gallery slider info bar toggler
247
248		$( '.btGetInfo' ).on( 'click', function () {
249			$(this).toggleClass( 'on' ).next().toggleClass( 'open' );
250			return false;
251		});	
252
253		// Close gallery slider
254
255		$( '.btCloseGhost' ).on( 'click', function () {
256			if ( ! $( '.btGhost' ).hasClass( 'btRemoveGhost' ) ) {
257				$( '.btGhost' ).addClass( 'btRemoveGhost' );
258				$( window ).trigger( 'resize' );
259				var pos = $( this ).parent().find( '.slick-slider' ).first().slick( 'slickCurrentSlide' );
260				var num_slides = $( this ).parent().find( '.slick-slider' ).find( '.slick-slide' ).length;
261				var thumbs = $( '.btGridGallery' ).first().find( '.btGhostSliderThumb' );
262				if ( thumbs.length > 0 ) {
263					var num_thumbs = thumbs.length;
264					if ( num_slides > num_thumbs && pos > 0 ) {
265						$( thumbs[ pos - 1 ] ).addClass( 'btMarkedImage' );
266						$( 'html, body' ).animate({
267							scrollTop: $( thumbs[ pos - 1 ] ).offset().top + $( thumbs[ pos - 1 ] ).height() * .5 - window.innerHeight * 0.5
268						}, 0 );
269					} else if ( num_slides == num_thumbs ) {
270						$( thumbs[ pos ] ).addClass( 'btMarkedImage' );
271						$( 'html, body' ).animate({
272							scrollTop: $( thumbs[ pos ] ).offset().top + $( thumbs[ pos ] ).height() * .5 - window.innerHeight * 0.5
273						}, 0 );
274					}
275				}
276				setTimeout( function() { window.boldthemes_theme_allow_scroll = true; $( '.btMarkedImage' ).removeClass( 'btMarkedImage' ) }, 800 );
277				return false;
278			}
279		});
280		
281		// magnific-popup grid gallery
282		
283		$( '.tilesWall.lightbox' ).each(function() {
284			$( this ).find( 'a' ).magnificPopup({
285				type: 'image',
286				// other options
287				gallery:{
288					enabled:true
289				},
290				closeMarkup:'<button class="mfp-close" type="button"><i class="mfp-close-icn">&times;</i></button>',
291				image: {
292					titleSrc: 'data-title'
293				},
294				closeBtnInside:false		
295			});
296		});
297		
298		if ( window.boldthemes_anim_selector ) {
299		
300			$( window ).on( 'btload', function() {
301				$( '.btPageWrap' ).append( '<div id="btAnimSelector" class="btDarkSkin"><select id="btFwdAnim"></select><select id="btBckAnim"></select></div>' );
302				
303				var anim = [];
304				
305				anim[1] = 'Move to left | from right';
306				anim[2] = 'Move to right | from left';
307				anim[3] = 'Move to top | from bottom';
308				anim[4] = 'Move to bottom | from top';
309				anim[5] = 'Fade | from right';
310				anim[6] = 'Fade | from left';
311				anim[7] = 'Fade | from bottom';
312				anim[8] = 'Fade | from top';
313				anim[9] = 'Fade left | Fade right';
314				anim[10] = 'Fade right | Fade left';
315				anim[11] = 'Fade top | Fade bottom';
316				anim[12] = 'Fade bottom | Fade top';
317				anim[13] = 'Different easing | from right';
318				anim[14] = 'Different easing | from left';
319				anim[15] = 'Different easing | from bottom';
320				anim[16] = 'Different easing | from top';
321				anim[17] = 'Scale down | from right';
322				anim[18] = 'Scale down | from left';
323				anim[19] = 'Scale down | from bottom';
324				anim[20] = 'Scale down | from top';
325				anim[21] = 'Scale down | scale down';
326				anim[22] = 'Scale up | scale up';
327				anim[23] = 'Move to left | scale up';
328				anim[24] = 'Move to right | scale up';
329				anim[25] = 'Move to top | scale up';
330				anim[26] = 'Move to bottom | scale up';
331				anim[27] = 'Scale down | scale up';
332				anim[28] = 'Glue left | from right';
333				anim[29] = 'Glue right | from left';
334				anim[30] = 'Glue bottom | from top';
335				anim[31] = 'Glue top | from bottom';
336				anim[32] = 'Flip right';
337				anim[33] = 'Flip left';
338				anim[34] = 'Flip top';
339				anim[35] = 'Flip bottom';
340				anim[36] = 'Rotate fall';
341				anim[37] = 'Rotate newspaper';
342				anim[38] = 'Push left | from right';
343				anim[39] = 'Push right | from left';
344				anim[40] = 'Push top | from bottom';
345				anim[41] = 'Push bottom | from top';
346				anim[42] = 'Push left | pull right';
347				anim[43] = 'Push right | pull left';
348				anim[44] = 'Push top | pull bottom';
349				anim[45] = 'Push bottom | pull top';
350				anim[46] = 'Fold left | from right';
351				anim[47] = 'Fold right | from left';
352				anim[48] = 'Fold top | from bottom';
353				anim[49] = 'Fold bottom | from top';
354				anim[50] = 'Move to right | unfold left';
355				anim[51] = 'Move to left | unfold right';
356				anim[52] = 'Move to bottom | unfold top';
357				anim[53] = 'Move to top | unfold bottom';
358				anim[54] = 'Room to left';
359				anim[55] = 'Room to right';
360				anim[56] = 'Room to top';
361				anim[57] = 'Room to bottom';
362				anim[58] = 'Cube to left';
363				anim[59] = 'Cube to right';
364				anim[60] = 'Cube to top';
365				anim[61] = 'Cube to bottom';
366				anim[62] = 'Carousel to left';
367				anim[63] = 'Carousel to right';
368				anim[64] = 'Carousel to top';
369				anim[65] = 'Carousel to bottom';
370				anim[66] = 'Sides';
371				
372				if ( $('body.btHalfPage').length ) {
373					var titleLeft = 'Select left animation';
374					var titleRight = 'Select right animation';
375				} else {
376					var titleLeft = 'Select forward animation';
377					var titleRight = 'Select backward animation';				
378				}
379				
380				$( '#btAnimSelector #btFwdAnim' ).append( '<option value="">' + titleLeft + '</option>' );
381				$( '#btAnimSelector #btBckAnim' ).append( '<option value="">' + titleRight + '</option>' );
382				
383				for ( var i = 1; i < anim.length; i++ ) {
384					$( '#btAnimSelector #btFwdAnim' ).append( '<option value="' + i + '">' + anim[ i ] + '</option>' );
385					$( '#btAnimSelector #btBckAnim' ).append( '<option value="' + i + '">' + anim[ i ] + '</option>' );
386				}
387				
388				$( '#btAnimSelector #btFwdAnim' ).on( 'change', function( e ) {
389					var val = $( this ).val();
390					var $pages = $( 'section.btSectionTransitions' );
391					$pages.each( function() {
392						$( this ).data( 'animation', val );
393					});
394					$( '.btAnimNavNext' ).trigger( 'click' );
395				});
396				
397				$( '#btAnimSelector #btBckAnim' ).on( 'change', function( e ) {
398					var val = $( this ).val();
399					var $pages = $( 'section.btSectionTransitions' );
400					$pages.each( function() {
401						$( this ).data( 'animation-back', val );
402					});
403					$( '.btAnimNavPrev' ).trigger( 'click' );
404				});
405
406				$( '#btAnimSelector select' ).fancySelect().on('change.fs', function() {
407					$(this).trigger('change.$');
408				});
409
410				setTimeout( function() { $( 'body' ).addClass( 'btShowAnimSelector' ); }, 10 );
411			});
412		
413		}
414
415	});
416	
417	
418	
419})( jQuery );
420
421function boldthemes_swipedetect( el, callback ) {
422  
423    var touchsurface = el,
424    swipedir,
425    startX,
426    startY,
427    distX,
428    distY,
429    threshold = 150, //required min distance traveled to be considered swipe
430    restraint = 100, // maximum distance allowed at the same time in perpendicular direction
431    allowedTime = 300, // maximum time allowed to travel that distance
432    elapsedTime,
433    startTime,
434    handleswipe = callback || function( swipedir ) {}
435  
436    touchsurface.addEventListener( 'touchstart', function( e ) {
437        var touchobj = e.changedTouches[0];
438        swipedir = 'none';
439        //dist = 0;
440        startX = touchobj.pageX;
441        startY = touchobj.pageY;
442        startTime = new Date().getTime(); // record time when finger first makes contact with surface
443        //e.preventDefault();
444    }, false );
445  
446    touchsurface.addEventListener( 'touchmove', function( e ) {
447       // e.preventDefault(); // prevent scrolling when inside DIV
448    }, false );
449  
450    touchsurface.addEventListener( 'touchend', function( e ) {
451        var touchobj = e.changedTouches[0];
452        distX = touchobj.pageX - startX;// get horizontal dist traveled by finger while in contact with surface
453        distY = touchobj.pageY - startY; // get vertical dist traveled by finger while in contact with surface
454
455        elapsedTime = new Date().getTime() - startTime; // get time elapsed
456        if ( elapsedTime <= allowedTime ) { // first condition for awipe met
457            if ( Math.abs( distX ) >= threshold && Math.abs( distY ) <= restraint ) { // 2nd condition for horizontal swipe met
458                swipedir = ( distX < 0 ) ? 'left' : 'right'; // if dist traveled is negative, it indicates left swipe
459            } else if ( Math.abs( distY ) >= threshold && Math.abs( distX ) <= restraint ) { // 2nd condition for vertical swipe met
460                swipedir = ( distY < 0 ) ? 'up' : 'down'; // if dist traveled is negative, it indicates up swipe
461            }
462        }
463
464        handleswipe( swipedir );
465        //e.preventDefault();
466    }, false );
467}

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.