PageSourceSearch

https://drivethiswaydt.com/dtw/wp-content/themes/off-the-shelf/js/offtheshelf.js?ver=1.6.0

js drivethiswaydt.com collected 2026-10-09 22:48:25 UTC 8,937 bytes, 368 lines download raw bytes

1/**
2 * Main Site Initialization Scripts
3 */
4
5
6jQuery.fn.doesExist = function(){
7	return jQuery(this).length > 0;
8};
9
10(function ($, window, undefined) {
11	"use strict";
12
13	/*
14	 Isotope Initialization
15	 */
16	if(jQuery().masonry) {
17		var $container = $('.masonry-wrapper .blog-post-items');
18
19		$container.imagesLoaded( function(){
20
21		});
22
23	}
24
25	$(document).ready(function() {
26		$(window).load(function(){
27
28			/*
29			 Parallax Effect
30			 */
31			if (typeof skrollr != 'undefined') {
32				if (!(/Android|iPhone|iPad|iPod|BlackBerry/i).test(navigator.userAgent || navigator.vendor || window.opera)) {
33					skrollr.init({forceHeight: false});
34				} else {
35					skrollr.init().destroy();
36				}
37			}
38
39			/*
40			 JavaScript replacement for native placeholders
41			 */
42			$('input,textarea').placeholder();
43
44			/*
45			  Sticky Header
46			 */
47			if ( $('body.sticky').length && $('#header-region').length ) {
48				var sticky = new Waypoint.Sticky({
49					element: $('body.sticky #header-region')[0],
50					offset: '-1px'
51				});
52			}
53
54			/*
55			 Menu
56			 */
57			$('.site_main_menu').smartmenus({
58				subMenusSubOffsetX: 38,
59				subMenusSubOffsetY: 21
60
61			});
62
63			$('.menu-button').click(function() {
64				var $this = $(this);
65				if ($this.hasClass('active'))
66				{
67					$('#header-region').addClass('menu-collapsed');
68					$this.removeClass('active');
69				} else {
70					$('#header-region').removeClass('menu-collapsed');
71					$this.addClass('active');
72				}
73				return false;
74			});
75
76			/*
77			Header Search Bar
78			 */
79			$('#header-search-trigger').click(function() {
80				var $search_form = $('#header-search');
81				if (!$search_form.hasClass('collapsed')) {
82					$search_form.addClass('collapsed');
83				} else {
84					$search_form.removeClass('collapsed');
85					$('#header-search').find('input, textarea').first().focus();
86				}
87				return false;
88			});
89
90			$(document).mouseup(function (e)
91			{
92				var container = $("#header-search");
93				if (!container.hasClass('collapsed') && !container.is(e.target) && container.has(e.target).length === 0)
94				{
95					container.addClass('collapsed');
96				}
97			});
98
99			$('.search-field').keyup(function(e) {
100				if (e.keyCode == 27) {
101					$('#header-search').addClass('collapsed');
102				}
103			});
104
105
106			/*
107			Slider Initialization
108			*/
109			$('.flexslider').each(function() {
110				var has_controls 		= false,
111					has_pips			= false,
112					pause_on_action		= false,
113					pause_on_hover		= false,
114					randomize			= false,
115					speed				= 7000,
116					animation			= 'fade';
117
118				if ( $(this).hasClass('has-controls') ) 		has_controls = true;
119				if ( $(this).hasClass('has-item-navigation') )	has_pips = true;
120				if ( $(this).hasClass('pause-on-action') ) 		pause_on_action = true;
121				if ( $(this).hasClass('pause-on-hover') ) 		pause_on_hover = true;
122				if ( $(this).hasClass('randomize') ) 			randomize = true;
123
124				if ( $(this).hasClass('transition-slide') )		animation = 'slide';
125
126				if ( $(this).data('speed'))  					speed = $(this).data('speed');
127
128				$(this).flexslider(
129						{
130							'animation' : animation,
131							'slideshowSpeed' : speed,
132							'randomize' : randomize,
133							'pauseOnAction' : pause_on_action,
134							'pauseOnHover' : pause_on_hover,
135							'controlNav' : has_pips,
136							'directionNav' : has_controls
137						}
138				);
139			});
140
141			$('.flexslider-gallery').flexslider({
142				randomize: true,
143				controlNav: false,
144				directionNav: true,
145				slideshowSpeed: 3000
146			});
147
148			/*
149			Gallery Lightbox Initialization
150			*/
151			$("a[href*=\".jpg\"], a[href*=\"jpeg\"], a[href*=\".png\"], a[href*=\".gif\"]").swipebox({
152				useCSS : true, // false will force the use of jQuery for animations
153				hideBarsDelay : 0, // 0 to always show caption and action bar
154				videoMaxWidth : 1140 // videos max width
155			});
156
157			/*
158			Modal Windows Initialization
159			*/
160			if(jQuery().featherlight) {
161				$.featherlight.defaults.beforeOpen = function(event){
162					$('body').addClass('modal-view');
163				};
164
165				$.featherlight.defaults.afterClose = function(event){
166					$('body').removeClass('modal-view');
167				};
168			}
169
170			/*
171			Scroll Up Arrow
172			 */
173			$(window).scroll(function () {
174				if ($(this).scrollTop() > 100) {
175					$('.scrollup').fadeIn();
176				} else {
177					$('.scrollup').fadeOut();
178				}
179			});
180			$('.scrollup').click(function () {
181				$("html, body").animate({ scrollTop: 0 }, 600);
182				return false;
183			});
184
185			/*
186			Maps
187			*/
188			if ( jQuery().initMap ) {
189				$( ".map-widget-canvas" ).each(function() {
190					var id = $( this ).attr( 'id' );
191					var address = $ (this).data( 'location' );
192					var type = $ (this).data( 'type' );
193					var zoom = $ (this).data( 'zoom' );
194					$('#' + id).initMap( {
195								type: type,
196								controls : {
197									map_type: {
198										type: ['roadmap', 'satellite', 'hybrid'],
199										position: 'top_right',
200										style: 'dropdown_menu'
201									},
202									overview: {opened: false},
203									pan: false,
204									rotate: false,
205									scale: false,
206									street_view: {position: 'top_center'},
207									zoom: {
208										position: 'top_left',
209										style: 'small'
210									}
211								},
212								center: address,
213								markers : {
214									marker1 : {
215										position: address,
216										info_window : {
217											content : address,
218											showOn: 'mouseover',
219											hideOn: 'mouseout',
220											maxWidth: 150,
221											zIndex: 2
222										}
223									}
224								},
225								options :
226								{
227									zoom: zoom
228								}
229							}
230					);
231				});
232			}
233
234			/*
235			Animations
236			 */
237			if (typeof WOW == 'function') {
238				var is_mobile = false;
239				if ( $('body' ).hasClass( 'has-mobile-anim' ) ) {
240					is_mobile = true;
241				}
242				var wow = new WOW(
243						{
244							boxClass:     'ots-wow',
245							mobile:       is_mobile,
246							live:         false
247						}
248				);
249				wow.init();
250			}
251
252			/*
253			WooCommerce
254			 */
255			function offtheshelf_added_to_cart(e) {
256				offtheshelf_show_notification();
257				setTimeout( offtheshelf_hide_notification, 2000);
258			}
259			function offtheshelf_hide_notification() {
260				$('#header-cart-notification').addClass('collapsed');
261			}
262			function offtheshelf_show_notification() {
263				$('#header-cart-notification').removeClass('collapsed');
264			}
265
266
267			$('#header-cart')
268					.mouseenter(function(){
269						$(this).removeClass('collapsed');
270						$("#header-search").addClass('collapsed');
271					})
272					.mouseleave(function(){
273						$(this).addClass('collapsed');
274					});
275
276
277			$('body').bind('added_to_cart', offtheshelf_added_to_cart);
278
279			/*
280			Countdown
281			 */
282			var cur = new Date(),
283					curY = cur.getFullYear(),
284					curM = cur.getMonth()+1,
285					curD = cur.getDate();
286
287
288			$('.countdown.wd').each(function() {
289				var
290						count_days = $(this).data('days'),
291						count_hours = $(this).data('hours'),
292						count_minutes = $(this).data('minutes'),
293						count_seconds = $(this).data('seconds');
294
295				$(this).oli_counter({
296							'times_array': Array(1, 60, 3600, 86400),
297							'group_text': Array( count_seconds, count_minutes, count_hours, count_days),
298							'animation_speed':100
299						});
300			});
301
302
303		});
304
305		/*
306		Page Soft Scrolling to Anchor Points
307		 */
308		$(window).load(function(){
309			$('.site_main_menu a[href^="#"], .so-panel a[href^="#"]').mPageScroll2id({
310				offset: 91,
311				highlightClass: "current-menu-item",
312				highlightSelector: ".site_main_menu a",
313				forceSingleHighlight: true,
314				scrollSpeed: 900
315			});
316		});
317
318		$(window).resize(function(){
319			var loc=window.location.hash,
320					to=(loc.indexOf("#/#")!==-1) ? loc.split("/")[1] : loc;
321			$.mPageScroll2id("scrollTo",to);
322		});
323
324
325
326
327	});
328
329})(jQuery, this);
330
331
332
333
334
335/*! A fix for the iOS orientationchange zoom bug.
336 Script by @scottjehl, rebound by @wilto.
337 MIT License.
338 */
339(function(w){
340	// This fix addresses an iOS bug, so return early if the UA claims it's something else.
341	if( !( /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1 ) ){ return; }
342	var doc = w.document;
343	if( !doc.querySelector ){ return; }
344	var meta = doc.querySelector( "meta[name=viewport]" ),
345			initialContent = meta && meta.getAttribute( "content" ),
346			disabledZoom = initialContent + ",maximum-scale=1",
347			enabledZoom = initialContent + ",maximum-scale=10",
348			enabled = true,
349			x, y, z, aig;
350	if( !meta ){ return; }
351	function restoreZoom(){
352		meta.setAttribute( "content", enabledZoom );
353		enabled = true; }
354	function disableZoom(){
355		meta.setAttribute( "content", disabledZoom );
356		enabled = false; }
357	function checkTilt( e ){
358		aig = e.accelerationIncludingGravity;
359		x = Math.abs( aig.x );
360		y = Math.abs( aig.y );
361		z = Math.abs( aig.z );
362		// If portrait orientation and in one of the danger zones
363		if( !w.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ){
364			if( enabled ){ disableZoom(); } }
365		else if( !enabled ){ restoreZoom(); } }
366	w.addEventListener( "orientationchange", restoreZoom, false );
367	w.addEventListener( "devicemotion", checkTilt, false );
368})( this );

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.