PageSourceSearch

https://whatshernamepodcast.com/wp-content/themes/septera/resources/js/frontend.js?ver=1.5.1.1

js whatshernamepodcast.com collected 2026-09-24 20:22:10 UTC 18,244 bytes, 565 lines download raw bytes

1/*
2 * Frontend JS
3 *
4 * @package Septera
5 */
6
7jQuery( document ).ready( function() {
8
9	cryoutLpBoxesRatios();
10	cryoutMobileMenuInit();
11	cryoutInitNav('#mobile-menu');
12	cryoutMenuAnimate();
13	cryoutBackToTop();
14	cryoutSearchFormAnimation();
15	cryoutSocialTitles();
16	cryoutBodyClasses();
17	cryoutTabsWidget();
18	cryoutPortfolioFilter();
19
20	if ( ( (cryout_theme_settings.fitvids == 2) && (cryout_theme_settings.is_mobile == 1) ) || ( cryout_theme_settings.fitvids == 1 ) ) {
21		jQuery( ".entry-content" ).fitVids();
22	}
23
24	if ( cryout_theme_settings.autoscroll == 1 ) {
25		cryoutAutoScroll();
26	}
27
28}); /* document.ready */
29
30jQuery(window).on('load', function() {
31
32	/* trigger scroll on load */
33	jQuery( window ).trigger( "scroll" );
34	cryoutMasonry();
35	cryoutPortfolioMasonry();
36
37}); /* window.load */
38
39
40/*
41 * Functions
42 */
43
44function cryoutLpBoxesRatios() {
45	for (index = 1; index <= cryout_theme_settings.lpboxratios.length; ++index) {
46		jQuery( '.lp-boxes-'+index+' .lp-box-image' ).keepRatio( cryout_theme_settings.lpboxratios[index-1] );
47	}
48} /* cryoutLpBoxesRatios() */
49
50/* Menu animation */
51function cryoutMenuAnimate() {
52	jQuery( "#access > .menu ul li > a:not(:only-child)" ).attr( "aria-haspopup", "true" );/* IE10 mobile Fix */
53
54	jQuery( "#access li" ).on( 'mouseenter', function() {
55		jQuery( this ).addClass('menu-hover');
56	} ).on( 'mouseleave', function() {
57		jQuery( this ).removeClass('menu-hover');
58	} );
59
60	jQuery('#access ul').find('a').on( 'focus', function() {
61		jQuery( this ).parents( '.menu-item, .page_item' ).addClass( 'menu-hover' );
62	});
63
64	jQuery('#access ul').find('a').on( 'blur', function() {
65		jQuery( this ).parents( '.menu-item, .page_item' ).removeClass( 'menu-hover' );
66	});
67} /* cryoutMenuAnimate() */
68
69/* Back to top button animation */
70function cryoutBackToTop() {
71	jQuery( window ).on( 'scroll', function() {
72
73		if ( jQuery( this ).scrollTop() > 500 ) {
74			jQuery( "#toTop" ).addClass('toTop-show');
75		} else {
76			jQuery( "#toTop" ).removeClass('toTop-show');
77		}
78
79		if ( jQuery( this ).scrollTop() > 70 ) {
80			jQuery( ".septera-fixed-menu #site-header-main" ).addClass( "header-fixed" );
81		} else {
82			jQuery( ".septera-fixed-menu #site-header-main" ).removeClass( "header-fixed" );
83		}
84	});
85	
86	jQuery( '#toTop' ).on( 'click', function( event ) {
87		event.preventDefault();
88		jQuery( 'html, body' ).animate( { scrollTop: 0 }, 500 );
89		return false;
90	} );
91
92} /* cryoutBackToTop() */
93
94/* Search form animation */
95function cryoutSearchFormAnimation() {
96	var searchIcon = jQuery( "#access .menu-search-animated > a" ),
97		searchForm = jQuery( ".menu-search-animated .searchform, .menu-main-search .icon-cancel" ),
98	searchInput = jQuery( "#access .menu-search-animated .s" );
99
100	searchIcon.on( 'click', function( event ) {
101		event.preventDefault();
102		searchForm.slideToggle( 200, function() {
103			searchInput.trigger( 'focus' );
104			searchInput.css( 'outline', 'none' );
105		} );
106		event.stopPropagation();
107	} );
108
109	searchForm.on( 'click', function( event ){
110		event.stopPropagation();
111	} );
112
113	searchInput.on( 'blur', function() {
114		searchForm.fadeOut( 200 );
115	} );
116} /* cryoutSearchFormAnimation() */
117
118/* Mobile Menu */
119function cryoutMobileMenuInit() {
120
121	jQuery("#nav-toggle").on('click', function(){
122		jQuery("#mobile-menu").show().animate({left: "0"}, 500);
123		jQuery('body').addClass("noscroll");
124	});
125
126	jQuery("#nav-cancel").on('click', function(){
127		jQuery("#mobile-menu").animate({left: "100%"},500,function(){jQuery(this).css("left","-100%").hide();});
128		jQuery('body').removeClass("noscroll");
129	});
130
131	/* Remove animated class from mobile menu */
132	jQuery("#mobile-menu .menu-main-search").removeClass("menu-search-animated");
133
134	jQuery( "#mobile-menu > div" ).append( jQuery( "#sheader" ).clone() );
135	jQuery( "#mobile-menu #sheader" ).attr( "id", "smobile");
136
137} /* cryoutMobileMenuInit() */
138
139/* Add submenus toggles to the primary navigation */
140function cryoutInitNav(selector) {
141
142	container = jQuery(selector);
143
144	/* Add dropdown toggle that display child menu items. */
145	container.find( '.menu-item-has-children > a' ).after( '<button class="dropdown-toggle" aria-expanded="false"></button>' );
146	container.find( '.page_item_has_children > a' ).after( '<button class="dropdown-toggle" aria-expanded="false"></button>' );
147
148	/* Toggle buttons and submenu items with active children menu items. */
149	container.find( '.current-menu-ancestor > button, .current-page-ancestor > button' ).addClass( 'toggle-on' );
150	container.find( '.current-menu-ancestor > .sub-menu, .current-page-ancestor > .sub-menu, .current-menu-ancestor .children, .current-page-ancestor .children' ).show(0).addClass( 'toggled-on' );
151
152	container.find( '.dropdown-toggle' ).on('click',  function( e ) {
153		var _this = jQuery( this );
154		e.preventDefault();
155		_this.toggleClass( 'toggle-on' );
156		if ( _this.hasClass( 'toggle-on') ) {
157			_this.next( '.children, .sub-menu' ).show(0).addClass( 'toggled-on' );
158			_this.prev("a").addClass( "toggled-on" );
159		}
160		else {
161			_this.next( '.children, .sub-menu' ).removeClass( 'toggled-on' );
162			_this.next( '.children, .sub-menu' ).find( '.children, .sub-menu' ).removeClass( 'toggled-on' );
163			_this.next( '.children, .sub-menu' ).find( 'a' ).removeClass( 'toggled-on' );
164			_this.next( '.children, .sub-menu' ).find( '.dropdown-toggle' ).removeClass( 'toggled-on' );
165			_this.prev("a").removeClass( "toggled-on" );
166
167			setTimeout(function() {
168				_this.next( '.children, .sub-menu' ).hide(0);
169				_this.next( '.children, .sub-menu' ).find( '.children, .sub-menu' ).hide(0);
170			},600)
171		}
172
173		/* _this.parent().find( 'a' ).toggleClass( 'toggled-on' ); */
174		_this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
175	} );
176
177	/* Close mobile menu on click/tap */
178	jQuery('body').on('click','#mobile-nav a', function() {
179		jQuery('#nav-cancel i').trigger('click');
180	});
181
182} /* cryoutInitNav() */
183
184/* LP Boxes Keep aspect ratio*/
185jQuery.fn.keepRatio = function( ratio ) {
186
187	var $this = jQuery( this );
188	var nh = $this.width() / ratio;
189	$this.css( "height", nh + "px" );
190	jQuery( window ).on('resize', function() {
191		var nh = $this.width() / ratio;
192		$this.css( "height", nh + "px" );
193	});
194
195}; /* keepRatio() */
196
197/* LP Box Mouse direction overlay animation */
198jQuery.fn.mousedir = function( el ) {
199	if ( ! jQuery( "body" ).hasClass( "septera-landing-page" ) ) return;
200
201	var $this = jQuery( this ),
202		$el = jQuery( el ),
203		last_position = {},
204		$output = "direction-down";
205
206	jQuery( document ).on( "mousemove", function (event) {
207
208	    if ( typeof( last_position.x ) != "undefined" ) {
209	        var deltaX = last_position.x - event.offsetX,
210	            deltaY = last_position.y - event.offsetY;
211	        if ( Math.abs( deltaX ) > Math.abs( deltaY ) && deltaX > 0 ) {
212	            $output = "direction-left";
213	        } else if ( Math.abs( deltaX ) > Math.abs( deltaY ) && deltaX < 0 ) {
214	            $output = "direction-right";
215	        } else if ( Math.abs( deltaY ) > Math.abs( deltaX ) && deltaY > 0 ) {
216	            $output = "direction-up";
217	        } else if ( Math.abs( deltaY ) > Math.abs( deltaX ) && deltaY < 0 ) {
218	            $output = "direction-down";
219	        } else {
220				$output = "direction-down";
221			}
222		}
223		last_position = {
224	    	x : event.offsetX,
225	    	y : event.offsetY
226		};
227
228	});
229
230	$el.on( "mouseenter", function() {
231		jQuery( this ).removeClass( "in-direction-left in-direction-right in-direction-up in-direction-down out-direction-left out-direction-right out-direction-up out-direction-down" );
232		jQuery( this ).addClass( "in-" + $output );
233		return;
234	});
235	$el.on( "mouseleave", function() {
236		jQuery( this ).removeClass( "in-direction-left in-direction-right in-direction-up in-direction-down out-direction-left out-direction-right out-direction-up out-direction-down" );
237		jQuery( this ).addClass( "out-" + $output );
238		return;
239	});
240
241}; /* mouseDir() */
242
243/* See if element is visible in browser window */
244jQuery.fn.visible = function( partial ) {
245	var $t            = jQuery( this ),
246		$w            = jQuery( window ),
247		viewTop       = $w.scrollTop(),
248		viewBottom    = viewTop + $w.height(),
249		_top          = $t.offset().top,
250		_bottom       = _top + $t.height(),
251		compareTop    = partial === true ? _bottom : _top,
252		compareBottom = partial === true ? _top : _bottom;
253
254	return ( (compareBottom <= viewBottom) && (compareTop >= viewTop) );
255}; /* jQuery.fn.visible() */
256
257/* Animate on scroll */
258function animateScroll( $articles ) {
259
260	var $articles = jQuery( $articles );
261
262	$articles.each( function( i, el ) {
263	  var el = jQuery( el );
264	  if ( ! el.visible( true ) ) {
265		  el.addClass( "animated-article" );
266	  }
267	});
268
269	jQuery( window ).on({
270	    'scroll': function( e ) {
271			$articles.each( function( i, el ) {
272				var el = jQuery( el );
273				if ( el.visible( true ) ) {
274					el.removeClass( "animated-article" );
275				}
276			});
277	    }
278	});
279
280} /* animateScroll() */
281
282/* Animate articles */
283if ( cryout_theme_settings.articleanimation ) {
284	animateScroll( "#content-masonry > article" );
285}
286
287/*  Add Social Icons titles */
288function cryoutSocialTitles() {
289
290	jQuery( ".socials a" ).each(function() {
291		jQuery( this ).attr( "title", jQuery( this ).children().html() );
292		jQuery( this ).html( "" );
293	});
294
295} /* cryoutSocialTitles() */
296
297/* Add body classes */
298function cryoutBodyClasses() {
299	/* Detect and apply custom class for Safari */
300	if ( navigator.userAgent.indexOf( "Safari" ) != -1 && navigator.userAgent.indexOf( "Chrome" ) == -1) {
301		jQuery( "body" ).addClass( "safari" );
302	}
303	/* Add body class if masonry is used on page */
304	if ( jQuery( "#content-masonry" ).length > 0 ) {
305		jQuery( "body" ).addClass( "septera-with-masonry" );
306	}
307} /* cryoutBodyClasses() */
308
309
310/*  Tabs widget */
311function cryoutTabsWidget() {
312		var tabsNav       = jQuery('.cryout-wtabs-nav'),
313			tabsNavLis    = tabsNav.children('li'),
314			tabsContainer = jQuery('.cryout-wtabs-container');
315
316		tabsNav.each(function() {
317			var localthis = jQuery(this);
318			localthis.next().children('.cryout-wtab').stop(true, true).children('li').hide().parent().siblings( localthis.find('a').attr('href') ).children('li').show();
319			localthis.children('li').first().addClass('active').stop(true, true).show();
320		});
321
322		tabsNavLis.on('click', function(e) {
323			var localthis = jQuery(this);
324
325			localthis.siblings().removeClass('active').end().addClass('active');
326			var tabs_duration = 200;
327			localthis.parent().next().children('.cryout-wtab').stop(true, true).children( 'li' ).hide().parent().siblings( localthis.find('a').attr('href') ).children('li').each( function(index){
328				jQuery(this).fadeIn(tabs_duration*(index+1));
329			});
330			e.preventDefault();
331		}).children( window.location.hash ? 'a[href="' + window.location.hash + '"]' : 'a:first' ).trigger('click');
332
333} /* cryoutTabsWidget() */
334
335/* Blog Masonry */
336function cryoutMasonry() {
337	if ( ( cryout_theme_settings.masonry == 1 ) && ( cryout_theme_settings.magazine != 1 ) && ( typeof jQuery.fn.masonry !== 'undefined' ) ) {
338		jQuery('#content-masonry').masonry({
339			itemSelector: 'article',
340			columnWidth: 'article',
341			percentPosition: true,
342			isRTL: cryout_theme_settings.rtl,
343		});
344	}
345} /* cryoutMasonry() */
346
347/* Jetpack Portfolio Masonry */
348function cryoutPortfolioMasonry() {
349	if ( ( cryout_theme_settings.masonry == 1 ) && ( typeof jQuery.fn.masonry !== 'undefined' ) ) {
350		/* jQuery('#portfolio-masonry').masonry({
351			itemSelector: '.portfolio-entry',
352		 	columnWidth: '.portfolio-entry:not(.hidey)',
353		 	percentPosition: true,
354		 	isRTL: cryout_theme_settings.rtl,
355		 });*/
356		jQuery('.jetpack-portfolio-shortcode').masonry({
357			itemSelector: '.portfolio-entry',
358			columnWidth: '.portfolio-entry:not(.hidey)',
359			percentPosition: true,
360			isRTL: cryout_theme_settings.rtl,
361		});
362	}
363} /* cryoutPortfolioMasonry() */
364
365/* Portfolio filtering */
366function cryoutPortfolioFilter() {
367	jQuery('body').on('click', '#portfolio-filter > a', function(e) {
368		e.preventDefault();
369		jQuery('#portfolio-filter > a').removeClass('active');
370		jQuery(this).addClass('active');
371		var filter = jQuery(this).attr('data-slug');
372		jQuery('#portfolio-masonry .portfolio-entry').each( function(i,elm) {
373			if (filter == 'all') {
374				jQuery(elm).removeClass('hidey').fadeIn('fast');
375			} else {
376				if ( !jQuery(elm).hasClass('type-'+filter) ) {
377					jQuery(elm).addClass('hidey').fadeOut('fast');
378				} else {
379					jQuery(elm).removeClass('hidey').fadeIn('fast');
380				}
381			}
382		}).promise().done( function() {
383			cryoutPortfolioMasonry();
384			/*jQuery('.jetpack-portfolio-shortcode').masonry();*/
385		});
386		return false;
387	});
388} /* cryoutPortfolioFilter() */
389
390/* FitVids 1.1*/
391;(function( $ ){
392
393  'use strict';
394
395  $.fn.fitVids = function( options ) {
396    var settings = {
397      customSelector: null,
398      ignore: null
399    };
400
401    if(!document.getElementById('fit-vids-style')) {
402      /* appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js */
403      var head = document.head || document.getElementsByTagName('head')[0];
404      var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
405      var div = document.createElement("div");
406      div.innerHTML = '<p>
406x</p><style id="fit-vids-style">' + css + '</style>';
407      head.appendChild(div.childNodes[1]);
408    }
409
410    if ( options ) {
411      $.extend( settings, options );
412    }
413
414    return this.each(function(){
415      var selectors = [
416        'iframe[src*="player.vimeo.com"]',
417        'iframe[src*="youtube.com"]',
418        'iframe[src*="youtube-nocookie.com"]',
419        'iframe[src*="kickstarter.com"][src*="video.html"]',
420        'object',
421        'embed'
422      ];
423
424      if (settings.customSelector) {
425        selectors.push(settings.customSelector);
426      }
427
428      var ignoreList = '.fitvidsignore, .wp-block-embed__wrapper';
429
430      if(settings.ignore) {
431        ignoreList = ignoreList + ', ' + settings.ignore;
432      }
433
434      var $allVideos = $(this).find(selectors.join(','));
435      $allVideos = $allVideos.not('object object'); /* SwfObj conflict patch */
436      $allVideos = $allVideos.not(ignoreList); /* Disable FitVids on this video. */
437
438      $allVideos.each(function(){
439        var $this = $(this);
440        if($this.parents(ignoreList).length > 0) {
441          return; /* Disable FitVids on this video. */
442        }
443        if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
444        if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
445        {
446          $this.attr('height', 9);
447          $this.attr('width', 16);
448        }
449        var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
450            width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
451            aspectRatio = height / width;
452        if(!$this.attr('name')){
453          var videoName = 'fitvid' + $.fn.fitVids._count;
454          $this.attr('name', videoName);
455          $.fn.fitVids._count++;
456        }
457        $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
458        $this.removeAttr('height').removeAttr('width');
459      });
460    });
461  };
462
463  /* Internal counter for unique video names. */
464  $.fn.fitVids._count = 0;
465
466/* Works with either jQuery or Zepto */
467})( window.jQuery || window.Zepto );
468
469/* IE .closest() fix */
470if (window.Element && !Element.prototype.closest) {
471    Element.prototype.closest =
472    function(s) {
473        var matches = (this.document || this.ownerDocument).querySelectorAll(s),
474            i,
475            el = this;
476        do {
477            i = matches.length;
478            while (--i >= 0 && matches.item(i) !== el) {};
479        } while ((i < 0) && (el = el.parentElement));
480        return el;
481    };
482}
483
484/**
485 * Scroll to anchors
486 */
487function cryoutAutoScroll(document, history, location) {
488	document = window.document;
489	history = window.history;
490	location = window.location;
491	var HISTORY_SUPPORT = !!(history && history.pushState);
492	var anchorScrolls = {
493		ANCHOR_REGEX: /^#[^ ]+$/,
494		OFFSET_HEIGHT_PX: jQuery('.septera-fixed-menu #site-header-main').height()+40,
495
496		/**
497		* Establish events, and fix initial scroll position if a hash is provided.
498		*/
499		init: function() {
500			this.scrollToCurrent();
501			jQuery(window).on('hashchange', jQuery.proxy(this, 'scrollToCurrent'));
502			jQuery('body').on('click', '.main a, nav ul li a', jQuery.proxy(this, 'delegateAnchors'));
503		},
504
505		/**
506		* Return the offset amount to deduct from the normal scroll position.
507		* Modify as appropriate to allow for dynamic calculations
508		*/
509		getFixedOffset: function() {
510			return this.OFFSET_HEIGHT_PX;
511		},
512
513		/**
514		* If the provided href is an anchor which resolves to an element on the
515		* page, scroll to it.
516		* @param  {String} href
517		* @return {Boolean} - Was the href an anchor.
518		*/
519		scrollIfAnchor: function(href, pushToHistory) {
520			var match, anchorOffset;
521
522			if(!this.ANCHOR_REGEX.test(href)) {
523				return false;
524			}
525
526			match = document.getElementById(href.slice(1));
527
528			if(match && ! jQuery(match).visible( true )) {
529				anchorOffset = jQuery(match).offset().top - this.getFixedOffset();
530				jQuery('html, body').animate({ scrollTop: anchorOffset});
531
532				/* Add the state to history as-per normal anchor links */
533				if(HISTORY_SUPPORT && pushToHistory) {
534					history.pushState({}, document.title, location.pathname + href);
535				}
536			}
537
538			return !!match;
539		},
540
541		/**
542		* Attempt to scroll to the current location's hash.
543		*/
544		scrollToCurrent: function(e) {
545			if(this.scrollIfAnchor(window.location.hash) && e) {
546				e.preventDefault();
547			}
548		},
549
550		/**
551		* If the click event's target was an anchor, fix the scroll position.
552		*/
553		delegateAnchors: function(e) {
554			var elem = e.target.closest('a');
555
556			if(this.scrollIfAnchor(elem.getAttribute('href'), true)) {
557				e.preventDefault();
558			}
559		}
560	};
561
562	jQuery(document).ready(jQuery.proxy(anchorScrolls, 'init'));
563}
564
565/* FIN */

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.