PageSourceSearch

https://portlandheadlight.com/wp-content/themes/slickfish/js/theme_trust.js?ver=1.0

js portlandheadlight.com collected 2026-10-02 09:56:39 UTC 17,880 bytes, 692 lines download raw bytes

1var $j = jQuery.noConflict();
2    windowHeight 	= $j(window).height(),
3	adminOffset 	= $j('body').hasClass('admin-bar') ? 32 : 0,
4    navOffset       = $j('#logo').outerHeight(),
5    bannerType      = $j('.top-banner').attr('id'),
6	scroll 			= $j(window).scrollTop(),
7    navHeight       = $j("#main-nav").height(),
8    finalOffset     = navOffset + adminOffset,
9	headerBreakPoint = 0,
10	headerContentWidth = 0,
11	mobileBreakPoint = 780,
12	masonry        = $j('.masonry').length,
13	parallaxSkroll = false,
14	breakpoints     = {
15        "Large": [9999, 3], // *3* columns for all larger screens
16        "Medium":[800, 2], // For *Medium* screens of *1100 to 700*, set Isotope to *2* columns
17        "Small": [500,  1] // For *Small* screens below *700*, set Isotope to *1* column
18    };
19
20
21/**
22* Mobile Detection
23*/
24
25var isMobile = {
26    Android: function() {
27        return navigator.userAgent.match(/Android/i);
28    },
29    BlackBerry: function() {
30        return navigator.userAgent.match(/BlackBerry/i);
31    },
32    iOS: function() {
33        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
34    },
35    Opera: function() {
36        return navigator.userAgent.match(/Opera Mini/i);
37    },
38    Windows: function() {
39        return navigator.userAgent.match(/IEMobile/i);
40    },
41    any: function() {
42        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
43    }
44};
45
46/**
47* Check if browser is IE
48*/
49function isIE(){
50	if($j('body').hasClass('ie')){
51		ie = true;
52	}else{
53		ie = false;
54	}
55	return ie;
56}
57
58/**
59* Check if browser is Edge
60*/
61
62function isEdge(){
63	if(!!navigator.userAgent.match(/Edge/)){
64		return true;
65	}
66}
67
68/**
69* Header Setup
70*/
71function menuSetup(){  
72    // Misc.
73    // -- Hover menus
74    $j('ul.sf-menu').superfish({
75		cssArrows:     false,
76	});
77}
78
79
80/**
81 * Masonry Blog Initialization
82 *
83 * Check to see if the layout mode is set to masonry, and
84 * defaults to fitRows if the .masonry class is not found.
85 * Initializes Isotope on the $gridContainer var
86 */
87
88function initMasonryBlog() {
89	var gridContainer = $j('.blog .masonry');
90	if(gridContainer.length){
91		gridContainer.each(function(){
92			var $this = $j(this);
93			$this.waitForImages(function(){
94				
95                $this.isotope({
96					itemSelector: '.post.small',
97					resizable: true,
98					masonry: {
99						columnWidth: ''
100					}
101				});
102				$j('.post.small').addClass('show');
103			});
104		});
105	}
106}
107
108
109
110/**
111 * Filter Navigation
112 *
113 * Binds the Isotope filtering function to clicks on the
114 * portfolio filter links using the data-filter attribute
115 */
116
117function filterInit() {
118	var $filterNavA = $j( '#filter-nav a' );
119	$filterNavA.click( function(){
120		var selector = $j(this).attr( 'data-filter' );
121		$j(this).parents( '.projects' ).find('.thumbs').isotope({filter: selector});
122		if ( ! $j(this).hasClass( 'selected' ) ) {
123			$j(this).parents( '#filter-nav' ).find( '.selected' ).removeClass( 'selected' );
124			$j(this).addClass( 'selected' );
125			//$j(this).parent.addClass( 'selected' );
126		}
127		return false;
128	});
129}
130
131/**
132 * Portfolio Initialization
133 *
134 * Check to see if the layout mode is set to masonry, and
135 * defaults to fitRows if the .masonry class is not found.
136 * Initializes Isotope on the $gridContainer var
137 */
138
139function initPortfolio() {
140	var gridContainer = $j('.projects .thumbs');
141	if(gridContainer.length){
142		
143		masonryProjectResize();
144		
145		gridContainer.each(function(){
146			var $this = $j(this);
147			$this.waitForImages(function(){
148				
149                $this.isotope({
150					itemSelector: '.project.small',
151					resizable: false,
152					masonry: {
153						columnWidth: '.grid-sizer'
154					}
155				});
156				$j('.projects .thumbs .project.small').addClass('show');
157			});
158		});
159		gridContainer.one( 'arrangeComplete', function( event, filteredItems ) {
160			
161		});
162	}
163	
164}
165
166/**
167 * Resize Masonry Grid Items
168 *
169 */
170
171function masonryProjectResize() {
172	if($j('.masonry-with-gutter').length || $j('.masonry-without-gutter').length){
173	var defaultSize = $j('.projects .grid-sizer').width();
174	var projectDefault = $j('.projects .project.small');
175	var projectMasonryDefault = $j('.projects .masonry-default');	
176	var projectMasonryWide = $j('.projects .masonry-wide');
177	var projectMasonryTall = $j('.projects .masonry-tall');
178	var projectMasonryWideTall = $j('.projects .masonry-wide_tall');
179	
180	projectDefault.css('height', defaultSize);
181    projectMasonryDefault.css('height', defaultSize);
182	projectMasonryWide.css('height', defaultSize);
183	projectMasonryTall.css('height', defaultSize*2);
184	projectMasonryWideTall.css('height', defaultSize*2);
185	projectMasonryWideTall.css('width', defaultSize*2);
186	}
187}
188
189
190/*
191 **	Load More Projects
192 */
193
194function loadMoreProjects(){
195    if($j('.projects .load-more-button').length){
196	
197    var i = 1;
198
199    $j('.load-more-button a').on('click', function(e)  {
200        e.preventDefault();
201		
202		var gridContainer = $j('.projects .thumbs');
203        var link = $j(this).attr('href');
204        var $content = '.projects .thumbs';
205        var $anchor = '.projects .load-more-button a';
206        var $next_href = $j($anchor).attr('href'); // Get URL for the next set of projects
207		var loadMoreButton = $j('.projects .load-more-holder .load-more-button');
208		var loading   = $j('.projects .load-more-holder .loading');
209
210		loadMoreButton.addClass('hidden');
211		loading.removeClass('hidden');
212		
213        $j.get(link+'', function(data){
214            
215
216            var $new_content = $j($content, data).wrapInner('').html(); // Load only the projects
217            $next_href = $j($anchor, data).attr('href'); // Get the new href
218
219            $j($content, data).waitForImages(function() {
220
221                $j('.projects .thumbs .project.small:last').after($new_content); // Append the new projects
222				 
223				masonryProjectResize();
224				gridContainer.isotope( 'on', 'layoutComplete',
225				  function( laidOutItems ) {
226				    $j('.project.small:not(.show)').addClass('show');
227				  }
228				);
229				
230                gridContainer.isotope('reloadItems').isotope();
231               
232
233                if($j('.load-more-button').data('rel') > i) {
234                    $j('.load-more-button a').attr('href', $next_href); // Change the next URL
235                } else {
236                    $j('.load-more-button').remove();
237                }
238                
239				loadMoreButton.removeClass('hidden');
240				loading.addClass('hidden');
241            });
242        });
243        i++;
244    });
245	}
246}
247
248
249/**
250* Slide Nav Setup
251*/
252
253function initSlideMenu(){
254	var siteContainer = $j('#site-wrap');
255	slideMenu = $j('#slide-panel');
256	slideMenuWidth = slideMenu.outerWidth();
257	$j('.menu-toggle.open').on('click', function () {
258		slideMenu.css('transform', 'translateX(0)');		
259	});
260	$j('#menu-toggle-close').on('click', function () {		
261		slideMenu.css('transform', 'translateX(' + slideMenuWidth + 'px)');		
262	});
263	var browserWidth = $j(window).width();
264	if(isMobile.any() && browserWidth < 768) {
265		var browserWidth = $j(window).width();
266		slideMenuWidth = browserWidth;
267		slideMenu.css('width', browserWidth + 'px');
268	}
269	slideMenu.css('transform', 'translateX(' + slideMenuWidth + 'px)');	
270	slideMenu.css('visibility', 'visible');	
271}
272
273/**
274 * Mobile Menu Submenus
275 * Set collapsable submenus.
276 */
277// Toggle sub menus
278function initMobileSubMenus(){
279	jQuery( "#slide-panel nav" ).find( "li.menu-item-has-children" ).click( function(){
280		jQuery( "#slide-panel nav" ).not( this ).find( "ul" ).next().slideToggle( 100 );
281		jQuery( this ).find( "> ul" ).stop( true, true ).slideToggle( 100 );
282		jQuery( this ).toggleClass( "active-sub-menu" );
283		return false;
284	});
285
286	// Don't fire sub menu toggle if a user is trying to click the link
287	jQuery( ".menu-item-has-children a" ).click( function(e) {
288		e.stopPropagation();
289		return true;
290	});
291}
292
293
294
295/**
296* Header Search Setup
297*/
298
299function initHeaderSearch(){
300	var headerSearchBar = $j('.header-search');
301	$j('.search-toggle.open').on('click', function () {
302		headerSearchBar.addClass('open');
303		headerSearchBar.find('#s').focus();	
304	});
305	$j('.search-toggle.close').on('click', function () {
306		headerSearchBar.removeClass('open');
307		headerSearchBar.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
308		  headerSearchBar.addClass('finished');
309		});		
310	});
311}
312
313/**
314* Single Page Nav Links
315*/
316
317function initSinglePageNav(){
318	
319	lastId = "";
320	topMenu = $j('#site-header .main-nav');
321	headerHeight = 0;
322	adminBarHeight = $j('body').hasClass('admin-bar') ? 32 : 0;
323	scrollOffest = adminBarHeight + headerHeight - 10;
324	
325	// All list items
326	menuItems = topMenu.find("a");
327	// Anchors corresponding to menu items
328	scrollItems = menuItems.map(function(){
329	   var target = this.hash.replace(/^.*#/, '');
330	   var item = $j('div[data-row-id="'+target+'"]');
331	   if (item.length) { return item; }
332	});
333	
334	$j('.main-nav a[href^="#"], #slide-mobile-menu a[href^="#"]').click(function(e) {
335		// Shut the slide panel if it is open
336		slideMenu.css('transform', 'translateX(' + slideMenuWidth + 'px)');
337	    e.preventDefault();
338		var target = this.hash.replace(/^.*#/, '');
339		var targetElement = $j('div[data-row-id="'+target+'"]');
340	   $j(window).scrollTo(targetElement, {duration:500, interrupt:false, offset: -(scrollOffest-15) });
341	 });	
342}
343
344function singlePageNavScroll(){
345	// Get container scroll position
346	
347	var fromTop = $j(this).scrollTop()+scrollOffest+140;
348	
349	// Get id of current scroll item
350	var cur = scrollItems.map(function(){
351	if ($j(this).offset().top <= fromTop)
352		return this;
353	});
354	// Get the id of the current element
355	cur = cur[cur.length-1];
356	
357	
358	var id = cur && cur.length ? cur.data("rowId") : "";
359
360	if (lastId !== id) {
361		//alert(cur.data("rowId"));
362	    lastId = id;
363	    // Set/remove active class
364	    menuItems
365	      .parent().removeClass("active")
366	      .end().filter("[href=#"+id+"]").parent().addClass("active");
367	}
368}
369
370/**
371* Init lightbox links
372*/
373
374function initLightbox(){
375	$j("a[data-rel^='prettyPhoto']").prettyPhoto({
376		hook: 'data-rel',
377		social_tools:'',
378		autoplay: false,
379		show_title: false,
380		deeplinking: false,
381		overlay_gallery: false,
382		markup: '<div class="pp_pic_holder"> \
383								<div class="ppt">&nbsp;</div> \
384								<div class="pp_top"> \
385									<div class="pp_left"></div> \
386									<div class="pp_middle"></div> \
387									<div class="pp_right"></div> \
388								</div> \
389								<div class="pp_content_container"> \
390									<div class="pp_left"> \
391									<div class="pp_right"> \
392										<div class="pp_content"> \
393											<div class="pp_loaderIcon"></div> \
394											<div class="pp_fade"> \
395												<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
396												<div class="pp_hoverContainer"> \
397													<a class="pp_next" href="#"></a> \
398													<a class="pp_previous" href="#"></a> \
399												</div> \
400												<div id="pp_full_res"></div> \
401												<div class="pp_details"> \
402													<p class="currentTextHolder">0/0</p> \
403													<a class="pp_close" href="#"></a> \
404												</div> \
405											</div> \
406										</div> \
407									</div> \
408									</div> \
409								</div> \
410								<div class="pp_bottom"> \
411									<div class="pp_left"></div> \
412									<div class="pp_middle"></div> \
413									<div class="pp_right"></div> \
414								</div> \
415							</div> \
416							<div class="pp_overlay"></div>',
417	});
418}
419
420/**
421* Parallax
422*/
423
424function initParallax(){
425		
426	if(isEdge()){
427		return false;
428	}	
429		
430	$j( '.parallax-inner' ).remove();
431	$j( '.parallax-section' ).each( function () {
432		var skrollrSpeed,
433			skrollrSize,
434			skrollrStart,
435			skrollrEnd,
436			parallaxSectionId,
437			$parallaxElement,
438			parallaxSectionHeight,
439			parallaxImage;
440		parallaxSectionId = $j( this ).data( 'parallaxId' );
441		parallaxSection = $j( this );
442		var pOffset = parallaxSection.offset(); //Get the offset of the parallax section
443		var pOffsetTop = pOffset.top;
444		$parallaxElement = $j( '<div />' ).addClass( 'parallax-inner' ).appendTo( $j( this ) );
445		if(pOffsetTop<100){
446			parallaxSection.addClass('top');
447		}
448		$parallaxElement.attr('data-parallax', '{"y": 330, "distance": 2000, "smoothness": 0}');
449		
450		parallaxImage = $j( this ).data( 'parallaxImage' );
451		if ( parallaxImage !== undefined ) {
452			$parallaxElement.backstretch(parallaxImage);
453			//$parallaxElement.css( 'background-image', 'url(' + parallaxImage + ')' );
454		}
455		
456		if ( !isMobile.any()) {
457		
458		}
459	});
460	
461}
462
463
464function ieParallax(){	
465	$j( '.parallax-section' ).each( function () {
466		var parallaxSection = $j(this);
467		parallaxSection.css({'background-attachemnt' : 'fixed'});
468	});
469}
470
471
472/**
473* Megamenu width
474*/
475
476function megamenuWidth(){
477	var headerWidth = $j('#site-header .logo-and-nav').outerWidth();
478	$j('.mega-menu.full-width ul').css('width', headerWidth+'px');
479}
480
481
482/**
483* Equal Height Page Builder Columns
484*/
485function equalizePageBuilderColumnHeights(){
486	if($j(window).width() > mobileBreakPoint){
487		
488	var tallestColumnHeight = 0;
489	var currentColumnHeight = 0;
490	var currentColumn;
491	var columns = [];
492	var lastRow = "";
493	$j(".panel-grid .equal-column-height .panel-grid-cell:not(.panel-grid-cell .panel-grid-cell)").each(function(intIndex) {
494		
495		currentColumn = $j('.so-panel.widget:first', this);
496		var currentRow = currentColumn.closest(".panel-grid").attr("id");
497		
498		if(currentRow != lastRow) {
499			lastRow = currentRow;
500			tallestColumnHeight = 0;
501			currentColumnHeight = 0;
502			columns = [];
503		}
504		
505		currentColumn.find('div:first').css('min-height', '0');
506		currentColumnHeight = currentColumn.height();
507		
508		if(currentColumnHeight >= tallestColumnHeight){
509			tallestColumnHeight = currentColumnHeight;
510			
511		}
512		columns.push(currentColumn);
513		$j.each(columns, function() {
514			$j(this).find('div:first').css('min-height', tallestColumnHeight);
515		});
516		
517	});
518	}
519	
520	if(isIE()){
521		$j(".v-center").each(function() {
522			var outerHeight = $j(this).height();
523			var inner = $j(this).find("div:first");
524			var innerHeight = inner.height();
525			var topOffset = (outerHeight/2) - (innerHeight/2);
526			inner.css('margin-top', topOffset);
527		});
528	};
529}
530
531
532/**
533* Scroll to top button
534*/
535
536function initScrollToTopButton(){
537	if($j('#scroll-to-top')){
538		$j('#scroll-to-top').click(function(e) {	
539			$j(window).scrollTo(0, {duration:500, interrupt:false });
540		})
541	}
542}
543
544function scrollToTopButton(){
545	if($j('#scroll-to-top')){	
546		var fromTop = $j(document).scrollTop();
547		$j('#scroll-to-top').toggleClass("active", (fromTop > 200));
548	}
549}
550
551
552/**
553* Set poster image for background videos in Slider Revolution
554*/
555function revSliderMobilePoster() {
556	var mobile = 'ontouchend' in window;
557	 $j('.tp-videolayer').each(function() {
558	 	var $this = $j(this);
559	 	if(!mobile) {
560	 		// to keep the video poster for desktop, comment out or remove the line below
561	 		$this.attr('data-videoposter', '');
562	 		return;
563	 	}
564	 	$this.removeClass('fullscreenvideo tp-videolayer').addClass('mobile-video-fallback-image').css(
565	 		'background-image', 'url(' + $this.attr('data-videoposter') + ')'
566	 	);
567	 });
568}
569
570/**
571* Fix mouse wheel zoom on Google Maps
572*/
573function fixGoogleMapMouseWheelZoom() {
574	$j('.sow-google-map-canvas').addClass('scroll-off'); // set the pointer events to none on doc ready
575	$j('.widget_sow-google-map').on('click', function () {
576		$j('.sow-google-map-canvas').removeClass('scroll-off'); // set the pointer events true on click
577	});
578	// disable pointer events when the mouse leave the canvas area;
579	$j(".widget_sow-google-map").mouseleave(function () {
580		$j('.sow-google-map-canvas').addClass('scroll-off'); // set the pointer events to none when mouse leaves the map area
581	});
582}
583
584
585/**
586* Fade out preloader
587*/
588$j(window).load(function(){
589	$j('body').addClass('loaded');
590	$j('#loader-container').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
591	  $j('#loader-container').addClass('finished');
592	});
593})
594
595
596/**
597* Fix mouswheel scroll in IE for fixed backgrounds
598*/
599
600if(navigator.userAgent.match(/Trident\/7\./)) { // if IE
601        $j('body').on("mousewheel", function () {
602            // remove default behavior
603            event.preventDefault(); 
604
605            //scroll without smoothing
606            var wheelDelta = event.wheelDelta;
607            var currentScrollPosition = window.pageYOffset;
608            window.scrollTo(0, currentScrollPosition - wheelDelta);
609        });
610}
611
612/**
613* Canvas Animation Effects
614*/
615function setUpCanvasAnimations(){
616	if ( !isMobile.any() && $j('.canvas-constellation').length) {
617	var newCanvas = $j('<canvas/>',{
618                   'class':'constellation',
619                    id: ''                   
620                }).prop({
621                    width: '100%',
622                    height: '100%'
623                });
624	$j('.canvas-constellation').prepend(newCanvas);
625
626	$j('canvas.constellation').constellation({
627		star: {
628			width: 3
629		},
630		line: {
631			color: 'rgba(255, 255, 255, .7)'
632		},
633		radius: 250
634	});
635	}
636}
637
638
639/**
640* Initialize Everything
641*/
642
643$j(document).ready(function(){
644	initSlideMenu();
645    $j(".content-area").fitVids();		
646	menuSetup();																				
647	filterInit();		
648	loadMoreProjects();
649	initSinglePageNav();
650	initLightbox();
651	initHeaderSearch();
652	megamenuWidth();
653	initMobileSubMenus();
654	revSliderMobilePoster();
655	initScrollToTopButton();
656	fixGoogleMapMouseWheelZoom();
657	setUpCanvasAnimations();
658	
659	//Scroll events
660	$j(window).scroll(function() {		
661		singlePageNavScroll();
662		scrollToTopButton();
663	});
664	
665	$j(window).bind('resize', function(e)
666	{
667	    window.resizeEvt;
668	    $j(window).resize(function()
669	    {
670	        clearTimeout(window.resizeEvt);
671	        window.resizeEvt = setTimeout(function()
672	        {
673				initPortfolio();
674				equalizePageBuilderColumnHeights();
675				megamenuWidth();
676	        }, 250);
677	    });
678	});
679});
680
681$j(window).load(function(){
682	initMasonryBlog();
683	initPortfolio();	
684	equalizePageBuilderColumnHeights();
685	if(!isMobile.any() && !isIE()){
686		initParallax();
687	}
688	if(isIE() || isEdge()){
689		ieParallax();
690	}
691	singlePageNavScroll();
692})

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.