PageSourceSearch

https://barbecuetricks.com/wp-content/themes/cookd-pro/js/general.js?ver=1.0.1

js barbecuetricks.com collected 2026-10-02 06:36:57 UTC 7,634 bytes, 250 lines download raw bytes

1/*!
2* FitVids 1.1
3*
4* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
5* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
6* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
7*
8*/
9;(function( $ ) {
10
11	'use strict';
12
13	$.fn.fitVids = function( options ) {
14		var settings = {
15			customSelector: null,
16			ignore: null
17		};
18
19		if ( ! document.getElementById( 'fit-vids-style' ) ) {
20			// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
21			var head = document.head || document.getElementsByTagName( 'head' )[0];
22			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%;}';
23			var div = document.createElement( 'div' );
24			div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
25			head.appendChild( div.childNodes[1] );
26		}
27
28		if ( options ) {
29			$.extend( settings, options );
30		}
31
32		return this.each(function() {
33			var selectors = [
34				'iframe[src*="player.vimeo.com"]',
35				'iframe[src*="youtube.com"]',
36				'iframe[src*="youtube-nocookie.com"]',
37				'iframe[src*="kickstarter.com"][src*="video.html"]',
38				'object',
39				'embed'
40			];
41
42			if ( settings.customSelector ) {
43				selectors.push( settings.customSelector );
44			}
45
46			var ignoreList = '.fitvidsignore';
47
48			if ( settings.ignore ) {
49				ignoreList = ignoreList + ', ' + settings.ignore;
50			}
51
52			var $allVideos = $( this ).find( selectors.join( ',' ) );
53			$allVideos = $allVideos.not( 'object object' ); // SwfObj conflict patch
54			$allVideos = $allVideos.not( ignoreList ); // Disable FitVids on this video.
55
56			$allVideos.each(function( count ) {
57				var $this = $( this );
58				if ( $this.parents( ignoreList ).length > 0 ) {
59					return; // Disable FitVids on this video.
60				}
61				if ( this.tagName.toLowerCase() === 'embed' && $this.parent( 'object' ).length || $this.parent( '.fluid-width-video-wrapper' ).length ) {
62					return;
63				}
64				if ( ( ! $this.css( 'height' ) && ! $this.css( 'width' ) ) && ( isNaN( $this.attr( 'height' ) ) || isNaN( $this.attr( 'width' ) ) ) ) {
65					$this.attr( 'height', 9 );
66					$this.attr( 'width', 16 );
67				}
68				var height = ( this.tagName.toLowerCase() === 'object' || ( $this.attr( 'height' ) && ! isNaN( parseInt( $this.attr( 'height' ), 10 ) ) ) ) ? parseInt( $this.attr( 'height' ), 10 ) : $this.height(),
69					width = ! isNaN( parseInt( $this.attr( 'width' ), 10 ) ) ? parseInt( $this.attr( 'width' ), 10 ) : $this.width(),
70					aspectRatio = height / width;
71				if ( ! $this.attr( 'id' ) ) {
72					var videoID = 'fitvid' + count;
73					$this.attr( 'id', videoID );
74				}
75				$this.wrap( '<div class="fluid-width-video-wrapper"></div>' ).parent( '.fluid-width-video-wrapper' ).css( 'padding-top', ( aspectRatio * 100 ) + '%' );
76				$this.removeAttr( 'height' ).removeAttr( 'width' );
77			});
78		});
79	};
80})( window.jQuery || window.Zepto );
81
82/*! Gamajo Accessible Menu - v1.0.0 - 2014-09-08
83* https://github.com/GaryJones/accessible-menu
84* Copyright (c) 2014 Gary Jones; Licensed MIT */
85;(function( $, window, document, undefined ) {
86	'use strict';
87
88	var pluginName = 'gamajoAccessibleMenu',
89		hoverTimeout = [];
90
91	// The actual plugin constructor
92	function Plugin( element, options ) {
93		this.element = element;
94		// jQuery has an extend method which merges the contents of two or
95		// more objects, storing the result in the first object. The first object
96		// is generally empty as we don't want to alter the default options for
97		// future instances of the plugin
98		this.opts = $.extend({}, $.fn[ pluginName ].options, options );
99		this.init();
100	}
101
102	// Avoid Plugin.prototype conflicts
103	$.extend( Plugin.prototype, {
104		init: function() {
105			$( this.element )
106				.on( 'mouseenter.' + pluginName, this.opts.menuItemSelector, this.opts, this.menuItemEnter )
107				.on( 'mouseleave.' + pluginName, this.opts.menuItemSelector, this.opts, this.menuItemLeave )
108				.find( 'a' )
109				.on( 'focus.' + pluginName + ', blur.' + pluginName, this.opts, this.menuItemToggleClass );
110		},
111
112		/**
113		 * Add class to menu item on hover so it can be delayed on mouseout.
114		 *
115		 * @since 1.0.0
116		 */
117		menuItemEnter: function( event ) {
118			// Clear all existing hover delays
119			$.each( hoverTimeout, function( index ) {
120				$( '#' + index ).removeClass( event.data.hoverClass );
121				clearTimeout( hoverTimeout[ index ] );
122			});
123			// Reset list of hover delays
124			hoverTimeout = [];
125
126			$( this ).addClass( event.data.hoverClass );
127		},
128
129		/**
130		 * After a short delay, remove a class when mouse leaves menu item.
131		 *
132		 * @since 1.0.0
133		 */
134		menuItemLeave: function( event ) {
135			var $self = $( this );
136			// Delay removal of class
137			hoverTimeout[ this.id ] = setTimeout(function() {
138				$self.removeClass( event.data.hoverClass );
139			}, event.data.hoverDelay );
140		},
141
142		/**
143		 * Toggle menu item class when a link fires a focus or blur event.
144		 *
145		 * @since 1.0.0
146		 */
147		menuItemToggleClass: function( event ) {
148			$( this ).parents( event.data.menuItemSelector ).toggleClass( event.data.hoverClass );
149		}
150	});
151
152	// A really lightweight plugin wrapper around the constructor,
153	// preventing against multiple instantiations
154	$.fn[ pluginName ] = function( options ) {
155		this.each(function() {
156			if ( ! $.data( this, 'plugin_' + pluginName ) ) {
157				$.data( this, 'plugin_' + pluginName, new Plugin( this, options ) );
158			}
159		});
160
161		// chain jQuery functions
162		return this;
163	};
164
165	$.fn[ pluginName ].options = {
166		// The CSS class to add to indicate item is hovered or focused
167		hoverClass: 'menu-item-hover',
168
169		// The delay to keep submenus showing after mouse leaves
170		hoverDelay: 250,
171
172		// Selector for general menu items. If you remove the default menu item
173		// classes, then you may want to call this plugin with this value
174		// set to something like 'nav li' or '.menu li'.
175		menuItemSelector: '.menu-item'
176	};
177})( jQuery, window, document );
178
179/**
180 * Cookd Pro General Scripts
181 *
182 * @copyright Copyright (c) 2016, Shay Bocks
183 * @license   MIT
184 */
185(function( $, undefined ) {
186	'use strict';
187
188	var $document = $( document ),
189		$navs     = $( '.nav-primary, .nav-secondary' );
190
191	/**
192	 * Debounce a window resize event.
193	 */
194	function debouncedResize( c, t ) {
195		onresize = function() {
196			clearTimeout( t );
197			t = setTimeout( c, 100 );
198		};
199		return c;
200	}
201
202	/**
203	 * Check whether or not a given element is visible.
204	 *
205	 * @param  {object} $object a jQuery object to check
206	 * @return {bool} true if the current element is hidden
207	 */
208	function isHidden( $object ) {
209		var element = $object[0];
210		return ( null === element.offsetParent );
211	}
212
213	function addNavToggles() {
214		$navs.before( '<div class="menu-toggle"><span></span></div>' );
215		$navs.find( '.sub-menu' ).before( '<div class="sub-menu-toggle"></div>' );
216	}
217
218	function showHideNav() {
219		$( '.menu-toggle, .sub-menu-toggle' ).on( 'click', function() {
220			var $that = $( this );
221			$that.toggleClass( 'active' );
222			$that.next( 'nav, .sub-menu' ).slideToggle( 'slow' );
223		});
224	}
225
226	function reflowNavs() {
227		if ( isHidden( $navs ) ) {
228			$navs.removeAttr( 'style' );
229			$( '.sub-menu-toggle, .menu-toggle' ).removeClass( 'active' );
230		}
231	}
232
233	function navInit() {
234		if ( 0 === $navs.length ) {
235			return;
236		}
237
238		addNavToggles();
239		showHideNav();
240		debouncedResize(function() {
241			reflowNavs();
242		})();
243	}
244
245	$document.ready(function() {
246		$( '#genesis-content' ).fitVids();
247		$document.gamajoAccessibleMenu();
248		navInit();
249	});
250}( jQuery ) );

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.