PageSourceSearch

https://fastlifegarage.com/wp-content/themes/ovation/assets/js/main.js?ver=20161216

js fastlifegarage.com collected 2026-10-02 15:38:44 UTC 3,842 bytes, 147 lines download raw bytes

1window.ovation = window.ovation || {};
2
3(function( window, $, undefined ) {
4	'use strict';
5
6	var $window   = $( window ),
7		$document = $( document ),
8		$body     = $( 'body' ),
9		$html     = $( 'html' ),
10		ovation   = window.ovation;
11
12	/**
13	 * Test if an iOS device.
14	*/
15	function checkiOS() {
16		return /iPad|iPhone|iPod/.test( navigator.userAgent ) && ! window.MSStream;
17	}
18
19	/*
20	 * Test if background-attachment: fixed is supported.
21	 * @link http://stackoverflow.com/questions/14115080/detect-support-for-background-attachment-fixed
22	 */
23	function supportsFixedBackground() {
24		var el = document.createElement( 'div' );
25
26		try {
27			if ( ! ( 'backgroundAttachment' in el.style ) || checkiOS() ) {
28				return false;
29			}
30			el.style.backgroundAttachment = 'fixed';
31			return 'fixed' === el.style.backgroundAttachment;
32		} catch ( e ) {
33			return false;
34		}
35	}
36
37	$.extend( ovation, {
38		config: {},
39
40		initialize: function() {
41			$body.addClass( 'ontouchstart' in window || 'onmsgesturechange' in window ? 'touch' : 'no-touch' );
42			$body.toggleClass( 'background-fixed', supportsFixedBackground() );
43
44			ovation.setupExternalLinks();
45			ovation.setupNavigation();
46			ovation.setupSidebar();
47			ovation.setupVideos();
48		},
49
50		/**
51		 * Open external links in a new window.
52		 */
53		setupExternalLinks: function() {
54			$( '.js-maybe-external' ).each(function() {
55				if ( this.hostname && this.hostname !== window.location.hostname ) {
56					$( this ).attr( 'target', '_blank' );
57				}
58			});
59		},
60
61		/**
62		 * Set up the main navigation.
63		 */
64		setupNavigation: function() {
65			$( '.site-navigation-menu' )
66				.cedaroNavMenu({
67					breakpoint: 960,
68					hoverTimeout: 50,
69					submenuToggleInsert: 'append'
70				})
71				.appendAround({
72					set: $( '.header-navigation, .mobile-navigation' )
73				});
74
75			$( '#menu-social' ).appendAround({
76				set: $( '.social-navigation' )
77			});
78		},
79
80		setupSidebar: function() {
81			var $sidebar = $( '.sidebar-area' ),
82				$sidebarToggle = $( '.sidebar-toggle-button' ),
83				$siteNavigation = $( '.site-navigation' ),
84				$siteOverlay = $( '.site' ).append( '<div class="site-overlay" />' ).find( '.site-overlay' );
85
86			function toggleSidebar( e ) {
87				e.preventDefault();
88
89				$html.toggleClass( 'sidebar-is-open' );
90
91				if ( $html.hasClass( 'sidebar-is-open' ) ) {
92					$sidebarToggle.prependTo( $sidebar );
93				} else {
94					$sidebarToggle.appendTo( $siteNavigation );
95				}
96			}
97
98			$sidebarToggle.bind( 'click', toggleSidebar );
99			$siteOverlay.on( 'click', toggleSidebar );
100		},
101
102		/**
103		 * Set up videos.
104		 *
105		 * - Makes videos responsive.
106		 * - Moves videos embedded in page content to an '.entry-video'
107		 *   container. Used primarily with the WPCOM single video templates.
108		 */
109		setupVideos: function() {
110			if ( $.isFunction( $.fn.fitVids ) ) {
111				$( '.entry, .responsive-video' ).fitVids();
112			}
113
114			$( 'body.page' ).find( '.single-video' ).find( '.jetpack-video-wrapper' ).first().appendTo( '.entry-video' );
115		},
116
117		/**
118		 * Update the scrollbar width CSS variable.
119		 *
120		 * This doesn't modify the scrollbar at all, but sets a CSS variable
121		 * with the width of the scrollbar so it can be accounted for in
122		 * full-width layouts.
123		 */
124		updateScrollbarWidth: function() {
125			var docEl = document.documentElement,
126				prevWidth = window.getComputedStyle( docEl ).getPropertyValue( '--scrollbar-width' ),
127				newWidth = window.innerWidth - document.body.clientWidth + 'px';
128
129			if ( newWidth !== prevWidth ) {
130				docEl.style.setProperty( '--scrollbar-width', newWidth );
131			}
132		},
133
134		/**
135		 * Retrieve the viewport width.
136		 */
137		viewportWidth: function() {
138			return window.innerWidth || $window.width();
139		}
140	});
141
142	$document.ready( ovation.initialize );
143	$window.on( 'load orientationchange', ovation.updateScrollbarWidth );
144
145	ovation.updateScrollbarWidth();
146
147})( this, 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.