PageSourceSearch

https://lagrandederoute.com/wp-content/themes/smart-mag/js/bunyad-theme.js?ver=3.4.0

js lagrandederoute.com collected 2026-10-04 16:17:18 UTC 54,378 bytes, 1,391 lines download raw bytes

1/**
2 * SmartMag JS functions & 3rd party libraries
3 */
4
5var Bunyad_Theme = (function($) {
6	"use strict";
7	
8	var hasTouch = false,
9	    responsive_menu = false,
10	    mobile_head_init = false;
11	
12	// module
13	return {
14		
15		init: function() 
16		{
17			
18			// posts grid 
19			var grid = $('.posts-grid').data('grid-count');
20			if (parseInt(grid) > 0) {
21				$('.posts-grid .column:nth-child(' + grid + 'n)').addClass('last');
22			}
23			
24			// fit videos to container
25			$('.featured-vid, .post-content').fitVids();
26
27			// ratings
28			$('.rate-number').each(function() {
29				var raw = $(this).find('span:not(.progress)').html(),
30					progress = parseFloat(raw);
31				
32				$(this).find('.progress').css('width', (raw.search('%') === -1 ? (Math.round(progress / 10 * 100)) + '%' : progress));
33			});
34			
35			// Image effects - remove temp CSS when loaded
36			$('.main img, .main-footer img').addClass('no-display');
37			$('.bunyad-img-effects-css').remove();
38			
39						
40			// Social icons widget
41			$('.lower-foot .social-icons a, .share-links a').tooltip({placement: 'top'});
42			//$('.social-icons a').tooltip({placement: 'bottom'});
43			
44			// Block display filters
45			var term_processing;
46			$('.section-head .subcats a, .block-head .filters a').click(function() {
47				
48				if ($(this).hasClass('active')) {
49					return false;
50				}
51				
52				var active   = $(this).parents('.subcats').find('a.active'),
53					parent   = $(this).closest('section'),
54					block_id = parent.data('id'), 
55					term_id  = $(this).data('id'),
56					content  = parent.find('.block-content');
57				
58				// First associated with All with id 0
59				content.find('> div:first-child').attr('data-id', 0);
60				
61				// Add pre-loaded filter content to block 
62				if (!content.find('[data-id='+ term_id +']').length) {
63					if (typeof bunyad_preload == 'undefined' || !bunyad_preload[block_id]) {
64						return false;
65					}
66
67					var block = $(bunyad_preload[block_id][term_id]).find('.block-content');
68					block.find(' > div').hide().attr('data-id', term_id);
69					block.find('img').addClass('no-display appear');
70
71					content.append(block.html());
72				}
73				
74				var block_ref = content.find('[data-id='+ term_id +']');
75				term_processing = null;
76				
77				// Not ready yet, show loader
78				if (!block_ref.hasClass('ready')) {
79					
80					content.addClass('loading');
81					term_processing = term_id;
82					
83					var process = function() {
84						
85						// Some other term has been clicked
86						if (term_processing !== term_id) {
87							return;
88						}
89						
90						// Show current and hide others
91						content.find('> div').hide();
92						
93						block_ref.addClass('ready').fadeIn(500);
94						content.removeClass('loading');
95					};
96				
97					// Wait for images
98					if (block_ref.find('img').length) {
99						block_ref.waitForImages(true).always(process);
100					}
101					else {
102						process();
103					}
104				}
105				else {
106					// Show current and hide others
107					content.find('> div').hide();
108					block_ref.fadeIn(500);
109				}
110				
111				// Filter links active
112				$(this).addClass('active');
113				active.removeClass('active');
114				
115				return false;
116			});
117			
118			$('.modal').on('shown.bs.modal', function() {
119				$(this).css({
120					'margin-top': function () {
121						return -($(this).height() / 2);
122					}
123				});
124			});
125			
126			// login
127			$(document).on('click', '.user-login', function() {
128				
129				$('.login-modal .modal-content').hide();
130				$('.login-modal .main-screen').show();
131				
132				$('#login-modal').modal('show');
133				
134				return false;
135			});
136			
137			var change_modal = function(name) {
138				
139				if (!$('.login-modal').is(':visible')) {
140					$('#login-modal').modal('show');
141				}
142				
143				$('.login-modal .modal-content').hide();
144				$('.login-modal ' + name).show();
145				
146				return false;
147				
148			};
149			
150			$('a.register-modal').click(function() {
151				return change_modal('.register-now');
152			});
153			
154			$('a.lost-pass-modal').click(function() {
155				return change_modal('.lost-pass');
156			});
157			
158			// setup all sliders
159			this.sliders();
160			
161			// handle shortcodes
162			this.shortcodes();
163			
164			// setup mobile header and navigation
165			this.mobile_header();
166			this.responsive_nav();
167			this.touch_nav();
168			
169			// start the news ticker
170			this.news_ticker();
171			
172			// setup the lightbox
173			this.lightbox();
174			
175			// use sticky navigation if enabled
176			this.sticky_nav();
177			
178			// use sticky sidebar if enabled
179			this.sticky_sidebar();
180			
181			// user ratings
182			this.user_ratings();
183			
184			// infinite scroll if enabled
185			this.infinite_scroll();
186			
187			/**
188			 * Image scroll animations
189			 */
190			$('.main img, .main-footer img, .main-featured .row').one('inview', function() {
191				$(this).addClass('appear');
192			});
193			
194			$('.review-box ul li .bar').each(function() {
195				$(this).data('width', $(this)[0].style.width).css('width', 0);
196			});
197			
198			$('.review-box ul li').one('inview', function() {
199				var bar = $(this).find('.bar');
200				bar.addClass('appear').css('width', bar.data('width'));
201			});
202			
203			// Single top social sharing view all buttons
204			$('.post-share-b .show-more').on('click', function() {
205				$(this).parent().addClass('all');
206				return false;
207			})
208			
209			/**
210			 * Nav Search
211			 */
212			$('.search-overlay .search-icon').on('click', function() {
213				
214				$(this).parent().toggleClass('active');
215				return false;
216				
217			});
218			
219			$(document).on('click', function(e) {
220				if (!$(e.target).is('.search-overlay') && !$(e.target).parents('.search-overlay').length) {
221					$('.search-overlay').removeClass('active');
222				}
223			});
224			
225			// nav icons class if missing
226			$('.navigation i.only-icon').each(function() {
227				
228				var el = $(this).closest('li');
229				if (!el.hasClass('only-icon')) {
230					el.addClass('only-icon');
231					
232					// reflow bug fix for webkit
233					var nav = $('.navigation .menu ul').css('-webkit-box-sizing', 'border-box');
234					requestAnimationFrame(function() {
235						nav.css('-webkit-box-sizing', '');
236					});
237				}
238
239			});
240			
241			/**
242			 * IE fixes
243			 */
244			if ($.browser && $.browser.msie && 8 == parseInt($.browser.version)) {
245				
246				$('.main img, .main-footer img').addClass('no-display');
247				$('.main img, .main-footer img, .main-featured .row').unbind('inview');
248				
249				// fontawesome4 fails to draw sometimes on IE8
250			    $(function() {
251			        var $ss = $('#smartmag-font-awesome-css');
252			        $ss[0].href = $ss[0].href;
253			    });
254			    
255			    // flickr widget fix - ie8 only
256				$('.flickr-widget .flickr_badge_image:nth-of-type(4n)').css('margin-right', 0);
257
258				// background image fix for IE8
259				var bg = $('body').css('background-attachment'),
260					bg_url = $('body').css('background-image').replace(/^url\((['"]?)(.*)\1\)$/, '$2');
261			
262				if (bg == 'fixed' && bg_url) {
263			 							
264					$('body').append('<style type="text/css">.bg-overlay { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + bg_url + '\', sizingMethod=\'scale\'); \
265						-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + bg_url + '\', sizingMethod=\'scale\')"; }</style>');
266					
267					$('<div class="bg-overlay"></div>').appendTo('body');
268				}
269				
270				// more lackluster ie8 
271				$('.listing > .column:nth-child(odd)').css('clear', 'both');
272			}
273			
274			// add support for placeholder in IE8/IE9
275			$('input, textarea').placeholder();
276			
277			/**
278			 * Mobile devices "background-attachment: fixed" support
279			 */
280			if ($(window).width() < 1128) {
281				
282				var bg = $('body').css('background-attachment'),
283					bg_image = $('body').css('background-image');
284				
285				if (bg == 'fixed' && bg_image) {
286					$('body').css('background-image', 'none').append(
287							$('<div class="background-cover">' + '</div>').css('background-image', bg_image)
288					);
289				}
290			}
291			
292			/**
293			 * Woocommerce
294			 */ 
295			$('.woocommerce-ordering .drop li a').click(function(e) {
296				var form = $(this).closest('form');
297				
298				form.find('[name=orderby]').val($(this).parent().data('value'));
299				form.submit();
300				
301				e.preventDefault();
302			});	
303			
304			$('body').on('added_to_cart', function() {
305				$('.menu .widget_shopping_cart').css('opacity', '');
306			});
307			
308			if ($('.menu .cart_list .empty').length) {
309				$('.menu .cart_list').remove();
310			}
311			
312			// Fix Firefox Bug #1149357
313			if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1 && window.devicePixelRatio > 1.5) {
314				
315				var firefox_retina = function(sel) {
316					var images = $(sel);
317					if (images.length) {
318						
319						images.each(function() {
320							
321							var image = $(this);
322							
323							// order maters - attach event first
324							$('<img />').on('load', function() {
325								
326								// picked 2x limage? set 1x dimension to prevent firefox overflowing
327								if (image.prop('currentSrc') !== image.prop('src')) {
328									image.css('width', $(this)[0].naturalWidth).css('height', $(this)[0].naturalHeight);
329								}
330								
331							}).attr('src', image.attr('src'));
332						});
333					}
334				};
335				
336				// Common areas with image width set as auto
337				firefox_retina('.logo-image, .highlights .thumb img, .posts-list img');
338				
339				$('.section-head .subcats a, .block-head .filters a').on('click', function() {
340					firefox_retina($(this).parents('.block-wrap').find('img'));
341				});
342			}
343			
344			// add android class
345			if (navigator.userAgent.match(/android/i)) {
346				$('body').addClass('android');
347			}
348			
349		},
350		
351		news_ticker: function()
352		{
353			$('.trending-ticker ul').each(function() {
354				
355				if (!$(this).find('li.active').length) {
356					$(this).find('li:first').addClass('active');
357				}
358				
359				var ticker = $(this);
360				
361				window.setInterval(function() {
362					
363					var active = ticker.find('li.active');
364					active.fadeOut(function() {
365						
366						var next = active.next();
367						if (!next.length) {
368							next = ticker.find('li:first');
369						}
370						
371						next.addClass('active').fadeIn();
372						active.removeClass('active');
373					});
374					
375				}, 8000);
376			});
377		},
378		
379		/**
380		 * Configure mobile header
381		 */
382		mobile_header: function() {
383			
384			// register resize event
385			var that = this;
386			
387			// place in separate method to prevent mem leaks
388			$(window).on('resize orientationchange', function f() {
389				that.init_mobile_header();
390				return f;
391			}());
392		},
393		
394		init_mobile_header: function() {
395			
396			if (mobile_head_init || $(window).width() > 799 || !$('body').hasClass('has-mobile-head')) {
397				return;
398			}
399			
400			// copy search form
401			var search = $('.top-bar .search');
402			search = (search.length ? search : $('.nav-search .search'));
403
404			if (search.length) {
405				$('.mobile-head .search-overlay').append(search.clone());
406			}
407			
408			mobile_head_init = true;
409		},
410		
411		/**
412		 * Setup the responsive nav events and markup
413		 */
414		responsive_nav: function() {
415			
416			// detect touch capability dynamically
417			$(window).on('touchstart', function() {
418				hasTouch = true;
419				$('body').addClass('touch');
420			});
421			
422			this.init_responsive_nav();
423			var that = this;
424
425			$(window).on('resize orientationchange', function() {
426				that.init_responsive_nav();
427			});		
428		},
429
430		init_responsive_nav: function() {
431			
432			if ($(window).width() > 799 || responsive_menu) {
433				return;
434			}
435			
436			// set responsive initialized
437			responsive_menu = true;
438			
439			var off_canvas = ($('.navigation .mobile').data('type') == 'off-canvas'),
440			    mobile_search = false,
441			    menu;
442			
443			/**
444			 * Create the mobile menu from desktop menu
445			 */
446			if (!$('.navigation .mobile-menu').length) {
447				
448				// clone navigation for mobile
449				var menu = $('.navigation div[class$="-container"]').clone().addClass('mobile-menu-container');
450				
451				// add category mega menu links
452				menu.find('div.mega-menu .sub-cats').each(function() {
453					var container = $(this).closest('.menu-item');
454					
455					container.append($(this).find('.sub-nav'));
456					container.find('.sub-nav').replaceWith(function() {
457						return $('<ul />', {html: $(this).html()});
458					});
459				});
460				
461				menu.find('.menu').addClass('mobile-menu');
462				
463				// append inside wrap for full width menu
464				menu.appendTo(($('.navigation > .wrap').length ? '.navigation > .wrap' : '.navigation'));
465			}
466			else {
467				menu = $('.navigation .mobile-menu-container');
468			}
469			
470			// off-canvas setup?
471			if (off_canvas) {
472				menu.addClass('off-canvas');
473				menu.find('.menu').prepend($('<li class="close"><a href="#"><span>' + $('.navigation .selected .text').text()  + '</span> <i class="fa fa-times"></i></a></li>'));
474				$('body').addClass('nav-off-canvas');
475			}
476			
477			// mobile search?
478			if ($('.navigation .mobile').data('search')) {
479				mobile_search = true;
480			}
481			
482			// register click handlers for mobile menu
483			$('.navigation .mobile .selected').click(function(e) {
484				
485				// search active?
486				if ($(e.target).hasClass('hamburger') || !mobile_search  || !$(this).find('.search .query').is(':visible')) {
487                   
488                    if (off_canvas) {
489                        $('.navigation .mobile-menu').addClass('active');
490                    	$('body').toggleClass('off-canvas-active');
491                    }
492                    else {
493                        $('.navigation .mobile-menu').toggleClass('active');
494                    }
495                    
496                    return false;
497				}
498			});
499			
500			$('.mobile-head .menu-icon a').on('click', function() {
501             	$('body').toggleClass('off-canvas-active');
502			});
503			
504			
505			// have custom retina mobile logo? set dimensions
506			var logo_mobile = $('.mobile-head').length ? $('.mobile-head .logo-mobile') : $('.logo-mobile');
507			
508			if (logo_mobile.length) {
509				
510				// order maters - attach event first
511				$('<img />').on('load', function() {
512					logo_mobile.prop('width', $(this)[0].naturalWidth / 2).prop('height', $(this)[0].naturalHeight / 2);
513				}).prop('src', logo_mobile.prop('src'));
514			}
515			
516			// Fix: Retina.js 2x logo on tablets orientation change
517			$(window).on('resize orientationchange', function() {
518				var logo = $('.logo-image');
519				if (logo.prop('width') == 0) {
520					logo.prop('width', logo[0].naturalWidth / 2).prop('height', logo[0].naturalHeight / 2);
521				}
522			});
523			
524			// off-canvas close
525			$('.off-canvas .close').click(function() {
526				$('body').toggleClass('off-canvas-active');
527			});
528			
529			
530			// add mobile search
531			if (mobile_search) {
532				
533				var search = $('.top-bar .search');
534				search = (search.length ? search : $('.nav-search .search'));
535				
536				// copy from top bar or nav search
537				if (search.length) {
538				
539					$('.navigation .mobile .selected').append(search[0].outerHTML);
540					$('.mobile .search .search-button').click(function() {
541		
542						if (!$('.mobile .search .query').is(':visible')) {
543								$('.navigation .mobile .selected .current, .navigation .mobile .selected .text').toggle();              
544								$('.mobile .search').toggleClass('active');
545		
546								return false;
547						}
548					});
549				}
550			}
551			
552			// setup mobile menu click handlers
553			$('.navigation .mobile-menu li > a').each(function() {
554				
555				if ($(this).parent().children('ul').length) {
556					$('<a href="#" class="chevron"><i class="fa fa-angle-down"></i></a>').appendTo($(this));
557				}
558			});
559			
560			$('.navigation .mobile-menu li .chevron').click(function() {
561					$(this).closest('li').find('ul').first().toggle().parent().toggleClass('active item-active');
562					return false;
563			});
564			
565			// add active item
566			var last = $('.mobile-menu .current-menu-item').last().find('> a');
567			if (last.length) {
568				
569				var selected = $('.navigation .mobile .selected'),
570					current  = selected.find('.current'),
571					cur_text = selected.find('.text').text();
572				
573				if (cur_text.slice(-1) !== ':') {
574					selected.find('.text').text(cur_text + ':');
575				}
576				
577				current.text(last.text());
578			}
579		},
580		
581		/**
582		 * Setup touch navigation for larger touch devices
583		 */
584		touch_nav: function() {
585			
586			var targets = $('.menu:not(.mobile-menu) a'),
587				open_class = 'item-active',
588				child_tag = 'ul, .mega-menu';
589			
590			targets.each(function() {
591				
592				var $this = $(this),
593					$parent = $this.parent('li'),
594					$siblings = $parent.siblings().find('a');
595				
596				$this.click(function(e) {
597					
598					if (!hasTouch) {
599						return;
600					}
601					
602					var $this = $(this);
603					e.stopPropagation();
604					
605					$siblings.parent('li').removeClass(open_class);
606					
607					// has a child? open the menu on tap
608					if (!$this.parent().hasClass(open_class) && $this.next(child_tag).length > 0 && !$this.parents('.mega-menu.links').length) {
609						e.preventDefault();
610						$this.parent().addClass(open_class);
611					}
612				});
613			});
614			
615			// close all menus
616			$(document).click(function(e) {
617				if (!$(e.target).is('.menu') && !$(e.target).parents('.menu').length) {
618					targets.parent('li').removeClass(open_class);
619				}
620			});
621		},
622		
623		/**
624		 * Setup sticky navigation if enabled
625		 */
626		sticky_nav: function()
627		{
628			var nav = $('.navigation-wrap'),
629			    nav_top  = nav.offset().top,
630			    smart = (nav.data('sticky-type') == 'smart'),
631			    is_sticky = false,
632			    prev_scroll = 0,
633			    cur_scroll;
634			
635			// Not enabled?
636			if (!nav.data('sticky-nav')) {
637				return;
638			}
639			
640			if (nav.find('.sticky-logo').length) {
641				nav.addClass('has-logo');
642			}
643			
644			// Set height for container when icons etc. have loaded
645			var set_size = function() {
646				$('.main-nav').css('min-height', nav.height());
647			};
648			
649			$(window).on('load resize', set_size);
650			
651			// Disable the sticky nav
652			var remove_sticky = function() {
653				
654				// check before dom modification 
655				if (is_sticky) {
656					nav.removeClass('sticky-nav');
657					set_size();
658				}
659			};
660			
661			// Make the nav sticky
662			var sticky = function() {
663
664				if (!nav.data('sticky-nav') || $(window).width() < 800) {
665					return;
666				}
667				
668				cur_scroll = $(window).scrollTop();
669				is_sticky  = nav.hasClass('sticky-nav');
670				
671				// make it sticky when viewport is scrolled beyond the navigation
672				if ($(window).scrollTop() > nav_top) {
673					
674					// for smart sticky, test for scroll change
675					if (smart && (!prev_scroll || cur_scroll > prev_scroll)) {
676						remove_sticky();
677					}
678					else {
679						
680						if (!nav.hasClass('sticky-nav')) {
681							nav.addClass('sticky-nav no-transition');
682						
683							setTimeout(function() { 
684								nav.removeClass('no-transition'); 
685							}, 100);
686						}
687					}
688					
689					prev_scroll = cur_scroll;
690					
691				} else {
692					remove_sticky();
693				}
694			};
695
696			sticky();
697
698			$(window).scroll(function() {
699				sticky();
700			});
701			
702		},
703		
704		/**
705		 * Setup sticky sidebar
706		 */
707		sticky_sidebar: function() 
708		{
709			var sticky = $('.sidebar').data('sticky');
710			if (!sticky) {
711				return;
712			}
713			
714			$('.main .sidebar').theiaStickySidebar({minWidth: 800, updateSidebarHeight: false});
715		},
716		
717		/**
718		 * Setup all the sliders available
719		 */
720		sliders: function()
721		{
722			if (!$.fn.flexslider) {
723				return;
724			}
725			
726			var is_rtl = ($('html').attr('dir') == 'rtl' ? true : false);
727			
728			// main slider
729			var slider = $('.main-featured .slider');
730			
731			$('.main-featured .flexslider').flexslider({
732				controlNav: true,
733				animationSpeed: slider.data('animation-speed'),
734				animation: slider.data('animation'),
735				slideshowSpeed: slider.data('slide-delay'),
736				manualControls: '.main-featured .flexslider .pages a',
737				pauseOnHover: true,
738				start: function() {
739					$('.main-featured .slider').css('opacity', 1);
740				},
741				rtl: is_rtl
742			});
743			
744			// main slider dynamic pagination - if not at default of 5
745			var pages  = $('.main-featured .pages'),
746				number = parseInt(pages.data('number'));
747			
748			if (number && number != 5) {
749				var width = (100 - ((number + 1) * 0.284900285)) / number;  // 100 - (slides + 1 * margin-left) / slides
750				pages.find('a').css('width', width + '%');
751			}
752			
753			// carousels / galleries
754			$('.carousel').flexslider({
755				animation: 'slide',
756				animationLoop: false,
757				itemWidth: 214,
758				itemMargin: 30,
759				minItems: 3,
760				maxItems: 4,
761				controlNav: false,
762				slideshow: false,
763				rtl: is_rtl
764				
765			});
766			
767			$('.gallery-block .flexslider').flexslider({
768				controlNav: false,
769				pauseOnHover: true,
770				rtl: is_rtl
771			});
772			
773			// for post-galleries
774			$('.gallery-slider .flexslider').flexslider({
775				controlNav: false,
776				pauseOnHover: true,
777				rtl: is_rtl
778			});
779			
780			// post galleries in post cover
781			$('.post-cover .gallery-slider li, .post-cover .featured').each(function() {
782				var img = $(this).find('img');
783				$(this).css('background-image', 'url("' + img.attr('src') + '")');
784				img.addClass('hidden');
785			});
786			
787			/**
788			 * Post Content Slideshow: AJAX
789			 */
790			var slideshow_cache = {},
791				slideshow_wrap  = '.post-slideshow .post-pagination-next';
792			
793			if ($(slideshow_wrap).length && $(slideshow_wrap).data('type') == 'ajax') {
794			
795				var processing;
796				
797				$('.main-content').on('click', '.post-slideshow .post-pagination-next .links a', function() {
798					
799						// showing on home-page?
800						if ($('body').hasClass('page')) {
801							return;
802						}
803						
804						// bottom links, scroll top
805						var scroll;
806						if ($(this).parents('.bottom').length) {
807							scroll = true;
808						}
809						
810						// abort existing request
811						if (processing && processing.hasOwnProperty('abort')) {
812							processing.abort();
813						}
814					
815						var parent = $(this).closest('.post-slideshow'),
816							url    = $(this).attr('href');
817						
818						parent.find('.content-page').removeClass('active').addClass('hidden previous');
819					
820						var show_slide = function(data) {
821							
822							// change browser url
823							if (history.pushState) {
824								history.pushState({}, '', url);
825							}
826							
827							var page = $(data).find('.post-slideshow');
828							
829							if (page.length) {
830								parent.find('.post-pagination-next').html(page.find('.post-pagination-next').html());
831								parent.find('.content-page').after(page.find('.content-page').addClass('hidden loading'));
832								
833								setTimeout(function() {
834
835									if (scroll) {
836										$('html, body').animate({scrollTop: parent.offset().top - 50}, 200);
837									}
838									
839									parent.find('.content-page.previous').remove();
840									parent.find('.content-page.loading')
841										.removeClass('previous hidden loading')
842										.find('img').addClass('appear');
843								}, 1);
844							}
845							
846							processing = null;
847							
848						};
849						
850						// in cache?
851						if (slideshow_cache[url]) {
852							show_slide(slideshow_cache[url]);
853						}
854						else {
855							
856							// get via ajax
857							processing = $.get(url, function(data) {
858								slideshow_cache[url] = data;
859								show_slide(data);
860								
861							});
862						}
863						
864						return false;
865				});
866				
867				// keyboard nav
868				$(document).on('keyup', function(e) {				
869						if (e.which == 37) {
870							$(slideshow_wrap).find('.prev').parent().click();
871						}
872						else if (e.which == 39) {
873							$(slideshow_wrap).find('.next').parent().click();
874						}
875				});
876				
877			} // end slideshow wrap
878			
879			
880			// Object-fit polyfill
881			var images = $('.featured-grid-b .image-link img');
882			if (images.length) {
883				objectFitImages(null, {watchMQ: true});
884			}
885		},
886		
887		/**
888		 * Register shortcode related events
889		 */
890		shortcodes: function()
891		{
892			// normal tabs
893			$('.tabs-list a').click(function() {
894				
895				var tab = $(this).data('tab'),
896					tabs_data = $(this).closest('.tabs-list').siblings('.tabs-data'),
897					parent = $(this).parent().parent(),
898					active = parent.find('.active');
899				
900				if (!active.length) {
901					active = parent.find('li:first-child');
902				}
903
904				active.removeClass('active').addClass('inactive');
905				$(this).parent().addClass('active').removeClass('inactive');
906				
907				// hide current and show the clicked one
908				var active_data = tabs_data.find('.tab-posts.active');
909				if (!active_data.length) {
910					active_data = tabs_data.find('.tab-posts:first-child');
911				}
912				
913				active_data.hide();
914				
915				tabs_data.find('#recent-tab-' + tab).fadeIn().addClass('active').removeClass('inactive');
916
917				return false;
918				
919			});
920			
921			/**
922			 * Shortcode: Tabs
923			 */
924			$('.sc-tabs a').click(function() {
925	
926				// tabs first
927				var tabs = $(this).parents('ul');
928				tabs.find('.active').removeClass('active');
929				$(this).parent().addClass('active');
930				
931				// panes second
932				var panes = tabs.siblings('.sc-tabs-panes');
933				
934				panes.find('.active').hide().removeClass('active');
935				panes.find('#sc-pane-' + $(this).data('id')).addClass('active').fadeIn();
936				
937				return false;
938			});
939			
940			/**
941			 * Shortcode: Accordions & Toggles
942			 */
943			$('.sc-accordion-title > a').click(function() {
944				
945				var container = $(this).parents('.sc-accordions');
946				container.find('.sc-accordion-title').removeClass('active');
947				container.find('.sc-accordion-pane').slideUp().removeClass('active');
948				
949				var pane = $(this).parent().next();
950				if (!pane.is(':visible')) {
951					$(this).parent().addClass('active');
952					pane.slideDown().addClass('active');
953				}
954				
955				return false;
956			});
957			
958			$('.sc-toggle-title > a').click(function() {
959				$(this).parent().toggleClass('active');
960				$(this).parent().next().slideToggle().toggleClass('active');
961				
962				return false;
963			});
964	
965		},
966		
967		/**
968		 * User Ratings handling
969		 */
970		user_ratings: function() 
971		{
972			
973			var compute_percent = function(e) {
974				
975				
976				var offset = $(this).offset(),
977				    position, percent;
978				
979				// count from right for RTL
980				if ($('html').attr('dir') == 'rtl')  {
981					offset.left = offset.left + $(this).outerWidth();
982				}
983				
984				position = Math.abs(e.pageX - Math.max(0, offset.left));
985				percent  = Math.min(100, Math.round(position / $(this).width() * 100));
986				
987				return percent;
988			};
989
990			// percent or points?
991			var is_points = true,
992				scale = parseInt($('.review-box .value-title').text()) || 10;
993			
994			if ($('.review-box .overall .percent').length) {
995				is_points = false;
996			}
997			
998			// update the bar and percent/points on hover
999			$('.user-ratings .main-stars, .user-ratings .rating-bar').on('mousemove mouseenter mouseleave', 
1000				function(e) {
1001				
1002					// set main variables
1003					var bar = $(this).find('span'),
1004						user_ratings = $(this).closest('.user-ratings');
1005				
1006					bar.css('transition', 'none');
1007					
1008					if (user_ratings.hasClass('voted')) {
1009						return;
1010					}
1011				
1012					// hover over?
1013					if (e.type == 'mouseleave') {
1014						bar.css('width', bar.data('orig-width'));
1015						user_ratings.find('.hover-number').hide();
1016						user_ratings.find('.rating').show();
1017						return;
1018					}
1019					
1020					var percent = compute_percent.call(this, e);
1021					
1022					if (!bar.data('orig-width')) {
1023						bar.data('orig-width', bar[0].style.width);
1024					}
1025					
1026					bar.css('width', percent + '%');
1027					user_ratings.find('.rating').hide();
1028					user_ratings.find('.hover-number').show().text((is_points ? +parseFloat(percent / 100 * scale).toFixed(1) : percent + '%'));
1029				}
1030			);
1031			
1032			// add the rating
1033			$('.user-ratings .main-stars, .user-ratings .rating-bar').on('click', function(e) {
1034				
1035				// set main variables
1036				var bar = $(this).find('span'),
1037					user_ratings = $(this).closest('.user-ratings');
1038				
1039				if (user_ratings.hasClass('voted')) {
1040					return;
1041				}
1042				
1043				// setup ajax post data
1044				var post_data = {
1045						'action': 'bunyad_rate', 
1046						'id': user_ratings.data('post-id'), 
1047						'rating': compute_percent.call(this, e)
1048				};
1049				
1050				// get current votes
1051				var votes = user_ratings.find('.number'),
1052					cur_votes = parseInt(votes.text()) || 0;
1053				
1054				user_ratings.css('opacity', '0.3');
1055				bar.data('orig-width', bar[0].style.width);
1056				
1057				// add to votes and disable further voting 
1058				votes.text((cur_votes + 1).toString());
1059				
1060				$(this).trigger('mouseleave');
1061				user_ratings.addClass('voted');
1062				
1063				$.post(Bunyad.ajaxurl, post_data, function(data) {
1064					
1065					// update data
1066					if (data === Object(data)) {
1067
1068						// change rating
1069						var cur_rating = user_ratings.find('.rating').text();
1070						user_ratings.find('.rating').text( cur_rating.search('%') !== -1 ? data.percent + ' %' : data.decimal );
1071						
1072						bar.css('width', data.percent + '%');
1073						bar.data('orig-width', data.percent);
1074					}
1075					
1076					user_ratings.hide().css('opacity', 1).fadeIn('slow');			
1077				}, 'json');
1078			});
1079		},
1080		
1081		/**
1082		 * Infinite Scroll
1083		 */
1084		infinite_scroll: function() 
1085		{
1086			// require jquery plugin
1087			if (!$.fn.infinitescroll) {
1088				return;
1089			}
1090				
1091			$('.listing-classic, .listing, .listing-alt, .list-timeline').filter(function() { if ($(this).data('infinite')) { return true; } }).each(function() {
1092				var that = this,
1093					data_sel = '[data-infinite="' + $(this).data('infinite') + '"]',
1094					timeline = false,
1095					instance, 
1096					opts;
1097				
1098				// infinitescroll options
1099				var options = {
1100					loading: {
1101						finishedMsg: '',
1102						msg: $('<div class="ajax-loading"><div class="spinner"><span></span><span></span><span></span></div>')
1103					},
1104					navSelector: '.main-pagination',
1105					nextSelector: '.main-pagination .next',
1106					itemSelector: data_sel + ' > .column,' + data_sel + ' > .post,' +  data_sel + ' > .post,' + data_sel + ' > .month'
1107				};
1108				
1109				// is timeline listing?
1110				if ($(this).hasClass('list-timeline')) {
1111					timeline = true;
1112					options.appendCallback = false;
1113				}
1114				
1115				/**
1116				 * Main callback when data is loaded via $.infinitescroll
1117				 */
1118				var callback = function(data) {
1119					
1120					// handle timeline listing
1121					if (timeline == true) {
1122						
1123						$(data).each(function() {
1124							var month = $(this).data('month'),
1125								existing = $(data_sel + ' .month[data-month="' + month + '"] .posts');
1126							
1127							// month container exists
1128							if (existing.length) {
1129								existing.append($(this).find('.posts article'));
1130							}
1131							else {
1132								$(data_sel).append($(this));
1133							}
1134						});
1135					}
1136
1137					// re-bind the inview image animations
1138					$(that).find('img').addClass('no-display').one('inview', function() {
1139						$(this).addClass('appear');
1140					});
1141					
1142					$(window).trigger('checkInView.inview');
1143					$(window).trigger('resize'); // for sticky sidebar
1144				};
1145				
1146				// setup infinitescroll instance and set callbacks
1147				instance = new $.infinitescroll(options, callback, this);
1148				opts     = instance.options;
1149				
1150				// overwrite start event
1151				opts.loading.start = function() {
1152					
1153					$(opts.loading.msg).insertAfter(that).show();
1154					instance.beginAjax(opts);
1155					
1156					// for sticky sidebar
1157					$(window).trigger('resize');
1158				};
1159				
1160				opts.errorCallback = function() {
1161					$(opts.loading.msg).hide();
1162					
1163					// for sticky sidebar
1164					$(window).trigger('resize');
1165				};
1166				
1167				// hide pagination if valid infinite scroll page
1168				if (!opts.state.isInvalidPage) {
1169					$(this).parent().find('.main-pagination').hide();	
1170				}
1171			});
1172		
1173		},
1174		
1175		
1176		/**
1177		 * Setup prettyPhoto
1178		 */
1179		lightbox: function() {
1180			
1181			// disabled on mobile screens
1182			if (!$.fn.prettyPhoto || $(window).width() < 700) {
1183				return;
1184			}
1185			
1186			var filter_images = function() {
1187				
1188				if (!$(this).attr('href')) {
1189					return false;
1190				}
1191				
1192				return $(this).attr('href').match(/\.(jpe?g|png|bmp|gif)$/); 
1193			};
1194			
1195			(function() {
1196				var gal_id = 1;
1197				
1198				$('.post-content a, .main .featured a').has('img').filter(filter_images).attr('rel', 'prettyPhoto');
1199				
1200				$('.gallery-slider, .post-content .gallery, .post-content .tiled-gallery').each(function() {
1201					gal_id++; // increment gallery group id
1202					
1203					$(this).find('a').has('img').filter(filter_images)
1204						.attr('rel', 'prettyPhoto[gal_'+ gal_id +']');
1205				});
1206				
1207				$("a[rel^='prettyPhoto']").prettyPhoto({social_tools: false});
1208				
1209			})();
1210			
1211			// WooCommerce lightbox
1212			$('a[data-rel^="prettyPhoto"], a.zoom').prettyPhoto({hook: 'data-rel', social_tools: false});
1213			
1214		}
1215	}; // end return
1216	
1217})(jQuery);
1218
1219// load when ready
1220jQuery(function($) {
1221		
1222	Bunyad_Theme.init();
1223});
1224
1225/**
1226 * Live Search Handler
1227 */
1228var Bunyad_Live_Search = (function($) {
1229	"use strict";
1230	
1231	var cache = {}, timer, element;
1232	
1233	return {
1234		
1235		init: function() {
1236			
1237			var self = this,
1238			    search = $('.live-search-query');
1239
1240			if (!search.length) {
1241				return;
1242			}
1243			
1244			// turn off browser's own auto-complete
1245			$('.live-search-query').attr('autocomplete', 'off');
1246			
1247			// setup the live search on key press
1248			$('.live-search-query').on('keyup', function() {
1249				
1250				element = $(this).parent();
1251				
1252				var query = $(this).val(), result;
1253				
1254				
1255				// clear existing debounce
1256				clearTimeout(timer);
1257				
1258				// minimum of 1 character
1259				if (query.length < 1) {
1260					self.add_result('');
1261					return;
1262				}
1263				
1264				// debounce to prevent excessive ajax queries
1265				timer = setTimeout(function() {
1266					self.process(query);
1267				}, 250);
1268			});
1269			
1270			// setup hide 
1271			$(document).on('click', function(e) {
1272				
1273				var results = $('.live-search-results');
1274				
1275				if (results.is(':visible') && !$(e.target).closest('.search').length) {
1276					results.removeClass('fade-in');
1277				}
1278			});
1279		},
1280		
1281		/**
1282		 * Process the search query
1283		 */
1284		process: function(query) {
1285			
1286			var self = this;
1287			
1288			// have it in cache?
1289			if (query in cache) {
1290				self.add_result(cache[query]);
1291			}
1292			else {
1293				$.get(Bunyad.ajaxurl, {action: 'bunyad_live_search', 'query': query}, function(data) {
1294					
1295					// add to cache and add results
1296					cache[query] = data;
1297					self.add_result(data);
1298				});
1299			}
1300		},
1301		
1302		/**
1303		 * Add live results to the container
1304		 */
1305		add_result: function(result) {
1306			
1307			if (!element.find('.live-search-results').length) {
1308				element.append($('<div class="live-search-results"></div>'));
1309			}
1310			
1311			var container = element.find('.live-search-results');
1312
1313			if (!result) {
1314				container.removeClass('fade-in');
1315				return;
1316			}
1317			
1318			// add the html result
1319			container.html(result);
1320			
1321			requestAnimationFrame(function() {
1322				container.addClass('fade-in');
1323			});
1324			
1325		}
1326	};
1327	
1328})(jQuery);
1329
1330// fire up when ready
1331jQuery(function() {
1332	Bunyad_Live_Search.init();
1333});
1334
1335/**
1336 * Plugins and 3rd Party Libraries
1337 */
1338
1339/**
1340 * Author Christopher Blum
1341 * Based on the idea of Remy Sharp, http://remysharp.com/2009/01/26/element-in-view-event-plugin/
1342 * 
1343 * License: WTFPL
1344 */
1345!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){function i(){var b,c,d={height:f.innerHeight,width:f.innerWidth};return d.height||(b=e.compatMode,(b||!a.support.boxModel)&&(c="CSS1Compat"===b?g:e.body,d={height:c.clientHeight,width:c.clientWidth})),d}function j(){return{top:f.pageYOffset||g.scrollTop||e.body.scrollTop,left:f.pageXOffset||g.scrollLeft||e.body.scrollLeft}}function k(){if(b.length){var e=0,f=a.map(b,function(a){var b=a.data.selector,c=a.$element;return b?c.find(b):c});for(c=c||i(),d=d||j();e<b.length;e++)if(a.contains(g,f[e][0])){var h=a(f[e]),k={height:h[0].offsetHeight,width:h[0].offsetWidth},l=h.offset(),m=h.data("inview");if(!d||!c)return;l.top+k.height>d.top&&l.top<d.top+c.height&&l.left+k.width>d.left&&l.left<d.left+c.width?m||h.data("inview",!0).trigger("inview",[!0]):m&&h.data("inview",!1).trigger("inview",[!1])}}}var c,d,h,b=[],e=document,f=window,g=e.documentElement;a.event.special.inview={add:function(c){b.push({data:c,$element:a(this),element:this}),!h&&b.length&&(h=setInterval(k,250))},remove:function(a){for(var c=0;c<b.length;c++){var d=b[c];if(d.element===this&&d.data.guid===a.guid){b.splice(c,1);break}}b.length||(clearInterval(h),h=null)}},a(f).on("scroll resize scrollstop",function(){c=d=null}),!g.addEventListener&&g.attachEvent&&g.attachEvent("onfocusin",function(){d=null})});
1346
1347/**
1348* Bootstrap.js by @fat & @mdo
1349* plugins: bootstrap-tooltip.js
1350* Copyright 2012 Twitter, Inc.
1351* http://www.apache.org/licenses/LICENSE-2.0.txt
1352*/
1353!function(a){var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger=="click"?this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this)):this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f+"."+this.type,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!c.options.delay||!c.options.delay.hide)return c.hide();c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.detach().css({top:0,left:0,display:"block"}).insertAfter(this.$element),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.offset(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).detach()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.detach()})}var b=this,c=this.tip();return c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.detach(),this},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);c[c.tip().hasClass("in")?"hide":"show"]()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0,html:!1},a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(window.jQuery);
1354
1355/**
1356* Bootstrap.js by @fat & @mdo
1357* plugins: bootstrap-modal.js
1358* Copyright 2013 Twitter, Inc.
1359* http://www.apache.org/licenses/LICENSE-2.0.txt
1360*/
1361!function(a){var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal
1361-body").load(this.options.remote)};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.backdrop(function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in").attr("aria-hidden",!1),b.enforceFocus(),c?b.$element.one(a.support.transition.end,function(){b.$element.focus().trigger("shown")}):b.$element.focus().trigger("shown")})},hide:function(b){b&&b.preventDefault();var c=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,this.escape(),a(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),a.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var b=this;a(document).on("focusin.modal",function(a){b.$element[0]!==a.target&&!b.$element.has(a.target).length&&b.$element.focus()})},escape:function(){var a=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(b){b.which==27&&a.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),b.hideModal()},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),b.hideModal()})},hideModal:function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.$backdrop.click(this.options.backdrop=="static"?a.proxy(this.$element[0].focus,this.$element[0]):a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!b)return;e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b):b()):b&&b()}};var c=a.fn.modal;a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f).one("hide",function(){c.focus()})})}(window.jQuery);
1362
1363/*!
1364* FitVids 1.1
1365*
1366* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
1367* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
1368* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
1369*
1370*/
1371;(function($){$.fn.fitVids=function(options){var settings={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var head=document.head||document.getElementsByTagName("head")[0];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%;}";var div=document.createElement("div");div.innerHTML='<p>x</p><style id="fit-vids-style">'+css+"</style>";head.appendChild(div.childNodes[1])}if(options){$.extend(settings,options)}return this.each(function(){var selectors=['iframe[src*="player.vimeo.com"]','
1371iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];if(settings.customSelector){selectors.push(settings.customSelector)}var ignoreList=".fitvidsignore";if(settings.ignore){ignoreList=ignoreList+", "+settings.ignore}var $allVideos=$(this).find(selectors.join(","));$allVideos=$allVideos.not("object object");$allVideos=$allVideos.not(ignoreList);$allVideos.each(function(){var $this=$(this);if($this.parents(ignoreList).length>0){return}if(this.tagName.toLowerCase()==="embed"&&$this.parent("object").length||$this.parent(".fluid-width-video-wrapper").length){return}if((!$this.css("height")&&!$this.css("width"))&&(isNaN($this.attr("height"))||isNaN($this.attr("width")))){$this.attr("height",9);$this.attr("width",16)}var height=(this.tagName.toLowerCase()==="object"||($this.attr("height")&&!isNaN(parseInt($this.attr("height"),10))))?parseInt($this.attr("height"),10):$this.height(),width=!isNaN(parseInt($this.attr("width"),10))?parseInt($this.attr("width"),10):$this.width(),aspectRatio=height/width;if(!$this.attr("id")){var videoID="fitvid"+Math.floor(Math.random()*999999);$this.attr("id",videoID)}$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",(aspectRatio*100)+"%");$this.removeAttr("height").removeAttr("width")})})}})(window.jQuery||window.Zepto);
1372
1373/**
1374 * Plus/minus polyfill for numbers - used in WooCommerce
1375 * 
1376 * Author Bryce Adams
1377 */
1378!function($){$("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />'),$(document).on("click",".plus, .minus",function(){var t=$(this).closest(".quantity").find(".qty"),a=parseFloat(t.val()),n=parseFloat(t.attr("max")),s=parseFloat(t.attr("min")),e=t.attr("step");a&&""!==a&&"NaN"!==a||(a=0),(""===n||"NaN"===n)&&(n=""),(""===s||"NaN"===s)&&(s=0),("any"===e||""===e||void 0===e||"NaN"===parseFloat(e))&&(e=1),$(this).is(".plus")?t.val(n&&(n==a||a>n)?n:a+parseFloat(e)):s&&(s==a||s>a)?t.val(s):a>0&&t.val(a-parseFloat(e)),t.trigger("change")})}(jQuery);
1379
1380
1381/*! http://mths.be/placeholder v2.0.7 by @mathias */
1382(function(q,f,d){function r(b){var a={},c=/^jQuery\d+$/;d.each(b.attributes,function(b,d){d.specified&&!c.test(d.name)&&(a[d.name]=d.value)});return a}function g(b,a){var c=d(this);if(this.value==c.attr("placeholder")&&c.hasClass("placeholder"))if(c.data("placeholder-password")){c=c.hide().next().show().attr("id",c.removeAttr("id").data("placeholder-id"));if(!0===b)return c[0].value=a;c.focus()}else this.value="",c.removeClass("placeholder"),this==m()&&this.select()}function k(){var b,a=d(this),c=this.id;if(""==this.value){if("password"==this.type){if(!a.data("placeholder-textinput")){try{b=a.clone().attr({type:"text"})}catch(e){b=d("<input>").attr(d.extend(r(this),{type:"text"}))}b.removeAttr("name").data({"placeholder-password":a,"placeholder-id":c}).bind("focus.placeholder",g);a.data({"placeholder-textinput":b,"placeholder-id":c}).before(b)}a=a.removeAttr("id").hide().prev().attr("id",c).show()}a.addClass("placeholder");a[0].value=a.attr("placeholder")}else a.removeClass("placeholder")}function m(){try{return f.activeElement}catch(b){}}var h="placeholder"in f.createElement("input"),l="placeholder"in f.createElement("textarea"),e=d.fn,n=d.valHooks,p=d.propHooks;h&&l?(e=e.placeholder=function(){return this},e.input=e.textarea=!0):(e=e.placeholder=function(){this.filter((h?"textarea":":input")+"[placeholder]").not(".placeholder").bind({"focus.placeholder":g,"blur.placeholder":k}).data("placeholder-enabled",!0).trigger("blur.placeholder");return this},e.input=h,e.textarea=l,e={get:function(b){var a=d(b),c=a.data("placeholder-password");return c?c[0].value:a.data("placeholder-enabled")&&a.hasClass("placeholder")?"":b.value},set:function(b,a){var c=d(b),e=c.data("placeholder-password");if(e)return e[0].value=a;if(!c.data("placeholder-enabled"))return b.value=a;""==a?(b.value=a,b!=m()&&k.call(b)):c.hasClass("placeholder")?g.call(b,!0,a)||(b.value=a):b.value=a;return c}},h||(n.input=e,p.value=e),l||(n.textarea=e,p.value=e),d(function(){d(f).delegate("form","submit.placeholder",function(){var b=d(".placeholder",this).each(g);setTimeout(function(){b.each(k)},10)})}),d(q).bind("beforeunload.placeholder",function(){d(".placeholder").each(function(){this.value=""})}))})(this,document,jQuery);
1383
1384// requestAnimationFrame pollyfill by paulirish - MIT
1385(function(){for(var e=0,b=["ms","moz","webkit","o"],a=0;a<b.length&&!window.requestAnimationFrame;++a)window.requestAnimationFrame=window[b[a]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[a]+"CancelAnimationFrame"]||window[b[a]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a,b){var c=(new Date).getTime(),d=Math.max(0,16-(c-e)),f=window.setTimeout(function(){a(c+d)},d);e=c+d;return f});window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)})})();
1386
1387/*! npm.im/object-fit-images */
1388var objectFitImages=function(){"use strict";function t(t){for(var e,r=getComputedStyle(t).fontFamily,i={};null!==(e=c.exec(r));)i[e[1]]=e[2];return i}function e(e,i){if(!e[n].parsingSrcset){var s=t(e);if(s["object-fit"]=s["object-fit"]||"fill",!e[n].s){if("fill"===s["object-fit"])return;if(!e[n].skipTest&&l&&!s["object-position"])return}var c=e[n].ios7src||e.currentSrc||e.src;if(i)c=i;else if(e.srcset&&!u&&window.picturefill){var o=window.picturefill._;e[n].parsingSrcset=!0,e[o.ns]&&e[o.ns].evaled||o.fillImg(e,{reselect:!0}),e[o.ns].curSrc||(e[o.ns].supported=!1,o.fillImg(e,{reselect:!0})),delete e[n].parsingSrcset,c=e[o.ns].curSrc||c}if(e[n].s)e[n].s=c,i&&(e[n].srcAttr=i);else{e[n]={s:c,srcAttr:i||f.call(e,"src"),srcsetAttr:e.srcset},e.src=n;try{e.srcset&&(e.srcset="",Object.defineProperty(e,"srcset",{value:e[n].srcsetAttr})),r(e)}catch(t){e[n].ios7src=c}}e.style.backgroundImage='url("'+c+'")',e.style.backgroundPosition=s["object-position"]||"center",e.style.backgroundRepeat="no-repeat",/scale-down/.test(s["object-fit"])?(e[n].i||(e[n].i=new Image,e[n].i.src=c),function t(){return e[n].i.naturalWidth?void(e[n].i.naturalWidth>e.width||e[n].i.naturalHeight>e.height?e.style.backgroundSize="contain":e.style.backgroundSize="auto"):void setTimeout(t,100)}()):e.style.backgroundSize=s["object-fit"].replace("none","auto").replace("fill","100% 100%")}}function r(t){var r={get:function(){return t[n].s},set:function(r){return delete t[n].i,e(t,r),r}};Object.defineProperty(t,"src",r),Object.defineProperty(t,"currentSrc",{get:r.get})}function i(){a||(HTMLImageElement.prototype.getAttribute=function(t){return!this[n]||"src"!==t&&"srcset"!==t?f.call(this,t):this[n][t+"Attr"]},HTMLImageElement.prototype.setAttribute=function(t,e){!this[n]||"src"!==t&&"srcset"!==t?g.call(this,t,e):this["src"===t?"src":t+"Attr"]=String(e)})}function s(t,r){var i=!A&&!t;if(r=r||{},t=t||"img",a&&!r.skipTest)return!1;"string"==typeof t?t=document.querySelectorAll("img"):"length"in t&&(t=[t]);for(var c=0;c<t.length;c++)t[c][n]=t[c][n]||r,e(t[c]);i&&(document.body.addEventListener("load",function(t){"IMG"===t.target.tagName&&s(t.target,{skipTest:r.skipTest})},!0),A=!0,t="img"),r.watchMQ&&window.addEventListener("resize",s.bind(null,t,{skipTest:r.skipTest}))}var n="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",c=/(object-fit|object-position)\s*:\s*([-\w\s%]+)/g,o=new Image,l="object-fit"in o.style,a="object-position"in o.style,u="string"==typeof o.currentSrc,f=o.getAttribute,g=o.setAttribute,A=!1;return s.supportsObjectFit=l,s.supportsObjectPosition=a,i(),s}();
1389
1390/*! waitForImages - Custom Modified Version */
1391(function(a){"function"===typeof define&&define.amd?define(["jquery"],a):"object"===typeof exports?module.exports=a(require("jquery")):a(jQuery)})(function(a){a.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage","cursor"],hasImageAttributes:["srcset"]};a.expr[":"]["has-src"]=function(c){return a(c).is('img[src][src!=""]')};a.expr[":"].uncached=function(c){return a(c).is(":has-src")?!c.complete:!1};a.fn.waitForImages=function(){var c=0,l=0,m=a.Deferred(),e,g,d;a.isPlainObject(arguments[0])?(d=arguments[0].waitForAll,g=arguments[0].each,e=arguments[0].finished):1===arguments.length&&"boolean"===a.type(arguments[0])?d=arguments[0]:(e=arguments[0],g=arguments[1],d=arguments[2]);e=e||a.noop;g=g||a.noop;d=!!d;if(!a.isFunction(e)||!a.isFunction(g))throw new TypeError("An invalid callback was supplied.");this.each(function(){var h=a(this),k=[],n=a.waitForImages.hasImageProperties||[],p=a.waitForImages.hasImageAttributes||[],q=/url\(\s*(['"]?)(.*?)\1\s*\)/g;d?h.find("*").addBack().each(function(){var b=a(this);b.is("img:has-src")&&!b.is("[srcset]")&&k.push({src:b.attr("src"),element:b[0]});a.each(n,function(a,c){var e=b.css(c),f;if(!e)return!0;for(;f=q.exec(e);)k.push({src:f[2],element:b[0]})});a.each(p,function(a,c){if(!b.attr(c))return!0;k.push({src:b.attr("src"),srcset:b.attr("srcset"),sizes:b.attr("sizes"),element:b[0]})})}):h.find("img:has-src").each(function(){k.push({src:this.src,element:this})});c=k.length;l=0;0===c&&(e.call(h[0]),m.resolveWith(h[0]));var t="srcset"in document.createElement("img")&&"sizes"in document.createElement("img");a.each(k,function(b,f){var d=new Image;a(d).one("load.waitForImages error.waitForImages",function r(b){b=[l,c,"load"==b.type];l++;g.apply(f.element,b);m.notifyWith(f.element,b);a(this).off("load.waitForImages error.waitForImages",r);
1391if(l==c)return e.call(h[0]),m.resolveWith(h[0]),!1});f.srcset&&t&&(d.srcset=f.srcset,d.sizes=f.sizes);d.src=f.src})});return m.promise()}});

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.