PageSourceSearch

https://historicjamestowne.org/wp-content/themes/brandon/js/scripts.js?ver=1.9.8

js historicjamestowne.org collected 2026-09-24 09:04:44 UTC 15,775 bytes, 492 lines download raw bytes

1(function($){
2
3    "use strict";
4
5    /* ---------------------------------------------------------------------------
6	 * Sticky header
7	 * --------------------------------------------------------------------------- */
8    var mfn_header_height = $('#Header').innerHeight();
9	function mfn_sticky(){
10		if( $('body').hasClass('sticky-header') ){
11			var start_y = mfn_header_height - 17;
12			var window_y = $(window).scrollTop();
13
14			if( window_y > start_y ){
15				if( ! ($('#Header').hasClass('is-sticky'))) {
16					$('.header_placeholder').css('margin-top', mfn_header_height);
17					$('#Header')
18						.addClass('is-sticky')
19						.css('top', $('#wpadminbar').innerHeight());
20				}
21			}
22			else {
23				if($('#Header').hasClass('is-sticky')) {
24					$('.header_placeholder').css('margin-top',0);
25					$('#Header')
26						.removeClass('is-sticky')
27						.css('top', 0);
28				}
29			}
30		}
31	}
32
33
34	/* ---------------------------------------------------------------------------
35	 * $(document).ready
36	 * --------------------------------------------------------------------------- */
37	$(document).ready(function(){
38
39		/* ---------------------------------------------------------------------------
40		 * Content sliders
41		 * --------------------------------------------------------------------------- */
42		new MfnSlider();
43		new MfnOfferSlider();
44		new MfnPostsSlider();
45		new MfnPortfolioSlider();
46
47
48		/* ---------------------------------------------------------------------------
49		 * Testimonials
50		 * --------------------------------------------------------------------------- */
51		$("ul.testimonials-slider").owlCarousel({
52			autoPlay			: 6000,
53			goToFirst			: true,
54			stopOnHover			: true,
55			items				: 1,
56			itemsDesktop		: false,
57			itemsDesktopSmall	: false,
58			itemsTablet			: false,
59			itemsMobile			: false,
60		});
61
62
63		/* ---------------------------------------------------------------------------
64		 * WP Gallery
65		 * --------------------------------------------------------------------------- */
66		$('.gallery-icon').addClass('hover-mask')
67			.children('a')
68				.attr('rel', 'prettyPhoto[gallery]')
69				.append('<span class="ico"><i class="fa-eye"></i></span>')
70				.children('img' )
71					.css('height', 'auto')
72					.css('width', '100%');
73
74
75		/* ---------------------------------------------------------------------------
76		 * PrettyPhoto
77		 * --------------------------------------------------------------------------- */
78		if( $(window).width() >= 768 ){
79			$('a[rel^="prettyPhoto"], .prettyphoto').prettyPhoto({
80				show_title		: false,
81				deeplinking		: false,
82				social_tools	: false
83			});
84		}
85
86
87		/* ---------------------------------------------------------------------------
88		 * Add classes first/last
89		 * --------------------------------------------------------------------------- */
90		$(".Recent_comments li:last-child, .Recent_posts li:last-child, .Twitter li:last-child, #Footer .container .column:last-child, .pricing-box .plan-inside ul li:last-child").addClass("last");
91		$(".commentlist li li .comment-body:last-child").addClass("last");
92		$(".commentlist li .comment-body:last-child").addClass("lastBorder");
93		$(".widget ul.menu li:last-child, .widget_links ul li:last-child, .widget_meta ul li:last-child").addClass("last");
94
95		// portfolio / blog  -------------------------------------
96		$('.portfolio_item.one-second:nth-child(2n+3), .post.one-second:nth-child(2n+3)').css("clear", "both");
97		$('.portfolio_item.one-third:nth-child(3n+4),  .post.one-third:nth-child(3n+4)' ).css("clear", "both");
98		$('.portfolio_item.one-fourth:nth-child(4n+5), .post.one-fourth:nth-child(4n+5)').css("clear", "both");
99
100
101		/* ---------------------------------------------------------------------------
102		 * Responsive menu
103		 * --------------------------------------------------------------------------- */
104		$('.responsive-menu-toggle').click(function(e){
105			e.preventDefault();
106			$(this).toggleClass('active');
107			$('#Header #menu').stop(true,true).slideToggle(200);
108		});
109
110
111		/* ---------------------------------------------------------------------------
112		 * Main menu
113		 * --------------------------------------------------------------------------- */
114
115		// Muffin Menu -------------------------------
116		$("#Header #menu > ul").mfnMenu({
117			arrows	: true
118		});
119
120		mfn_sticky();
121
122
123		/* ---------------------------------------------------------------------------
124		 * Header search
125		 * --------------------------------------------------------------------------- */
126		$("#Header #searchform .ico").click(function(e){
127			e.preventDefault();
128			$('#searchform').submit();
129		});
130
131
132		/* ---------------------------------------------------------------------------
133		 * Header icons expand
134		 * --------------------------------------------------------------------------- */
135		$("#Header .addons .expand").click(function(){
136			$(this).toggleClass('focus');
137		});
138
139
140		/* ---------------------------------------------------------------------------
141		 * IE fixes
142		 * --------------------------------------------------------------------------- */
143    function checkIE() {
144      // IE 9
145      var ua = window.navigator.userAgent;
146      var msie = ua.indexOf("MSIE ");
147      if (msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 9) {
148        $("body").addClass("browser-ie");
149      }
150    }
151    checkIE();
152
153		/* ---------------------------------------------------------------------------
154		 * Tabs
155		 * --------------------------------------------------------------------------- */
156		$(".jq-tabs").tabs();
157
158
159		/* ---------------------------------------------------------------------------
160		 * Anchor Fix for Sticky header + Smooth scroll
161		 * --------------------------------------------------------------------------- */
162		var hash = window.location.hash;
163		if( hash && $(hash).length ){
164
165			var stickyH = $('#Header.is-sticky').innerHeight();
166			var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight();
167
168			$('html, body').animate({
169				scrollTop: $(hash).offset().top - stickyH - tabsHeaderH
170			}, 500);
171		}
172
173		$('#menu li.scroll > a, a.scroll').click(function(){
174			var url = $(this).attr('href');
175			var hash = '#' + url.split('#')[1];
176
177			var stickyH = $('#Header.is-sticky').innerHeight();
178			var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight();
179
180			if( hash && $(hash).length ){
181				$('html, body').animate({
182					scrollTop: $(hash).offset().top - stickyH - tabsHeaderH
183				}, 500);
184			}
185		});
186
187
188		/* ---------------------------------------------------------------------------
189		 * Muffin Accordion & FAQ
190		 * --------------------------------------------------------------------------- */
191		$(".mfn-acc.open1st .question:first")
192			.addClass("active")
193			.children(".answer")
194				.show();
195
196		$(".mfn-acc .question > h5").append('<span class="icon"></span>');
197		$(".mfn-acc .question > h5").click(function(){
198			if($(this).parent().hasClass("active")) {
199				$(this).parent().removeClass("active").children(".answer").slideToggle(200);
200			}
201			else
202			{
203				$(this).parents(".mfn-acc").children().each(function() {
204					if($(this).hasClass("active")) {
205						$(this).removeClass("active").children(".answer").slideToggle(200);
206					}
207				});
208				$(this).parent().addClass("active");
209				$(this).next(".answer").slideToggle(200);
210			}
211		});
212
213
214		/* ---------------------------------------------------------------------------
215		 * Skills
216		 * --------------------------------------------------------------------------- */
217		$('.bars_list').waypoint({
218			offset		: '100%',
219			triggerOnce	: true,
220			handler		: function(){
221				$(this).addClass('hover');
222			}
223		});
224
225
226		/* ---------------------------------------------------------------------------
227		 * Quick Fact
228		 * --------------------------------------------------------------------------- */
229		$('.animate-math .number').waypoint({
230			offset		: '100%',
231			triggerOnce	: true,
232			handler		: function(){
233				var el			= $(this);
234				var duration	= Math.floor((Math.random()*1000)+1000);
235				var to			= el.attr('data-to');
236
237				$({property:0}).animate({property:to}, {
238					duration	: duration,
239					easing		:'linear',
240					step		: function() {
241						el.text(Math.floor(this.property));
242					},
243					complete	: function() {
244						el.text(this.property);
245					}
246				});
247			}
248		});
249
250
251		/* ---------------------------------------------------------------------------
252		 * Animations
253		 * --------------------------------------------------------------------------- */
254		$('[data-animation]').waypoint({
255			offset		: '100%',
256			triggerOnce	: true,
257			handler		: function(){
258				$(this).addClass('animated ' + $(this).attr('data-animation'));
259			}
260		});
261
262
263		/* ---------------------------------------------------------------------------
264		 * Go to top
265		 * --------------------------------------------------------------------------- */
266		$('#back_to_top').click(function(){
267			$('body,html').animate({
268				scrollTop: 0
269			}, 500);
270			return false;
271		});
272
273
274		/* ---------------------------------------------------------------------------
275		 * Iframe height
276		 * --------------------------------------------------------------------------- */
277		function iframeHeight( item, ratio ){
278			var itemW = item.width();
279			var itemH = itemW * ratio;
280			if( itemH < 147 ) itemH = 147;
281			item.height(itemH);
282		}
283
284		function iframesHeight(){
285			iframeHeight($(".posts_wrapper .post_photo iframe"),0.60);			// blog - list
286			iframeHeight($(".post_header .post_photo iframe"),0.38);			// blog - single
287			iframeHeight($(".single-portfolio .portfolio_photo iframe"),0.66);	// portfolio - single
288			iframeHeight($(".offer_wrapper .image iframe"),0.56);				// offer - item
289		}
290		iframesHeight();
291
292
293		/* ---------------------------------------------------------------------------
294		 * Portfolio - Isotope
295		 * --------------------------------------------------------------------------- */
296		function mfnIsotope(domEl,isoWrapper){
297			var filter = domEl.attr('data-rel');
298			isoWrapper.isotope({ filter: filter });
299
300			domEl.parents('ul').find('li.current-cat').removeClass('current-cat');
301			domEl.parent().addClass('current-cat');
302		}
303
304		$('.portfolio-isotope .Projects_header .categories a').click(function(e){
305			e.preventDefault();
306			mfnIsotope($(this),$('.portfolio-isotope .Projects_inside_wrapper'));
307		});
308
309		$('#Projects .categories a').click(function(e){
310			e.preventDefault();
311			mfnIsotope($(this),$('#Projects .Projects_inside_wrapper'));
312		});
313
314
315		/* ---------------------------------------------------------------------------
316		 * Debouncedresize
317		 * --------------------------------------------------------------------------- */
318		$(window).bind("debouncedresize", function() {
319			iframesHeight();
320		});
321
322	});
323
324	/* ---------------------------------------------------------------------------
325	 * $(window).load
326	 * --------------------------------------------------------------------------- */
327	$(window).load(function(){
328
329		/* ---------------------------------------------------------------------------
330		 * isotope
331		 * --------------------------------------------------------------------------- */
332		$('.portfolio-isotope .Projects_inside_wrapper').isotope({
333			itemSelector: '.column',
334			layoutMode: 'fitRows'
335		});
336		$('#Projects .Projects_inside_wrapper').isotope({
337			itemSelector: '.column',
338			layoutMode: 'fitRows'
339		});
340
341	});
342
343
344	/* ---------------------------------------------------------------------------
345	 * $(window).scroll
346	 * --------------------------------------------------------------------------- */
347	$(window).scroll(function(){
348		mfn_sticky();
349    });
350
351
352	/* ---------------------------------------------------------------------------
353	 * $(document).mouseup
354	 * --------------------------------------------------------------------------- */
355	$(document).mouseup(function(e){
356		if ($("#Header .addons .expand").has(e.target).length === 0){
357			$("#Header .addons .expand").removeClass('focus');
358		}
359		if ($("#searchform").has(e.target).length === 0){
360			$("#searchform").removeClass('focus');
361		}
362	});
363
364
365	/* ---------------------------------------------------------------------------
366	 * Sliders configuration
367	 * --------------------------------------------------------------------------- */
368
369	// --- MfnSlider ---------------------------------------------------------
370	function MfnSlider(){
371//		var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints || $(document).width() <= 767;
372		var mfn_slider = window.mfn_slider_vertical;
373
374		mfn_slider.speed				= 700;
375		mfn_slider.loop					= true;
376		mfn_slider.pagination			= '.swiper-controls';
377		mfn_slider.paginationClickable	= true;
378//		mfn_slider.mode					= supportsTouch ? 'horizontal' : 'vertical';
379
380		var mfnSlider = new Swiper('.swiper-container',mfn_slider);
381
382		$('.swiper-prev').click(function(e){
383			e.preventDefault();
384			mfnSlider.swipePrev();
385		});
386		$('.swiper-next').click(function(e){
387			e.preventDefault();
388			mfnSlider.swipeNext();
389		});
390
391		$('#configurator .text-select a').click(function(){
392			mfnSlider.resizeFix();
393		});
394	}
395
396
397	// --- MfnOfferSlider ---------------------------------------------------------
398	function MfnOfferSliderPager(slider){
399
400		// wrap -----------------------
401		slider.find('.owl-pagination').wrap('<div class="owl-controls-inner"><div class="owl-pagination-wrapper"></div></div>');
402
403		// pager - arrow --------------
404		var pager = slider.find('.owl-controls .owl-page');
405		var itemH = slider.find('.owl-page').height();
406		var count = pager.length;
407		var visible = count < 5 ? count : 4;
408		var firstVisible = 1;
409		var lastVisible = visible;
410
411		if( count > 4 ){
412			// arrows -----------------
413			slider.find('.owl-controls').append('<a class="owl-pagination-arrow owl-arrow-prev" href="#"></a><a class="owl-pagination-arrow owl-arrow-next" href="#"></a>');
414
415			// arrow click prev -------
416			slider.find('.owl-arrow-prev').click(function(e){
417				e.preventDefault();
418				if( firstVisible > 1 ){
419					firstVisible--;
420					lastVisible--;
421					slider.find('.owl-pagination').css('top', - ( (firstVisible-1) * itemH - 5));
422				}
423			});
424
425			// arrow click next -------
426			slider.find('.owl-arrow-next').click(function(e){
427				e.preventDefault();
428				if( lastVisible < count ){
429					firstVisible++;
430					lastVisible++;
431					slider.find('.owl-pagination').css('top', - ( (firstVisible-1) * itemH - 5));
432				}
433			});
434		}
435	}
436
437	// pager - thumbnails
438	function MfnOfferSliderPagerThumbs(slider){
439		var pager = slider.find('.owl-controls .owl-page');
440		pager.each(function( index ) {
441			var thumbnail = slider.find('.owl-item:eq('+index+') .thumbnail img').clone(true,true);
442			$(this).children('span').html(thumbnail);
443		});
444	}
445
446	function MfnOfferSlider(){
447		$("ul.offer-slider").owlCarousel({
448			items				: 1,
449			itemsDesktop		: false,
450			itemsDesktopSmall	: false,
451			itemsTablet			: false,
452			itemsMobile			: false,
453			afterInit			: MfnOfferSliderPager,
454			afterAction			: MfnOfferSliderPagerThumbs
455		});
456	}
457
458
459	// --- MfnPostsSlider ---------------------------------------------------------
460	function MfnPostsSlider(){
461		$("ul.posts-slider").owlCarousel({
462			autoPlay			: false,
463			goToFirst			: true,
464			navigation			: true,
465			pagination			: false,
466			stopOnHover			: true,
467			items				: 1,
468			itemsDesktop		: false,
469			itemsDesktopSmall	: false,
470			itemsTablet			: false,
471			itemsMobile			: false
472		});
473	}
474
475	// --- MfnPortfolioSlider ---------------------------------------------------------
476	function MfnPortfolioSlider(){
477		$("ul.recent-works-slider").owlCarousel({
478			autoPlay			: false,
479			goToFirst			: true,
480			navigation			: true,
481			navigationText		: ["<",">"],
482			pagination			: false,
483			stopOnHover			: true,
484			items				: 3,
485			itemsDesktop		: false,
486			itemsDesktopSmall	: false,
487			itemsTablet			: false,
488			itemsMobile			: [767,1]
489		});
490	}
491
492})(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.