PageSourceSearch

https://www.stevenmillerpix.com/wp-content/themes/morphis/js/custom.portfolio.js?ver=1.0

js stevenmillerpix.com collected 2026-10-04 20:31:08 UTC 13,639 bytes, 416 lines download raw bytes

1jQuery(document).ready(function( $ ) {
2		
3	/* Portfolio Page Loading using Ajax */
4	function initializePortfolio() {
5   
6		var urlQuery = location.search;
7		urlQuery = urlQuery.replace('?', '');
8		var split = urlQuery.split('=');
9   
10		var intRegex = /^\d+$/;
11   
12		if(intRegex.test(split[1])) {			
13			item_id = split[1];
14       
15			item_to_initialize = $("#items").find("a[data-post_id='" + item_id + "']:first");
16       
17			$(item_to_initialize).trigger("click");			
18	    }
19    }    
20	
21	active_post_id = '';
22	var $portfolioDetail = $("#portfolio-content-detail"); 
23   		
24   	getPortfolio = function(e) {
25      	
26		var post_id = $( this ).attr( "data-post_id" );
27   		active_post_id = post_id;
28      
29	  var $next = '';
30	  var $prev = '';
31	  
32	  var  $parentElement = '';
33	  var $the_portfolio_data ='';
34	  var $portfolio_first_child ='';
35	  var $portfolio_last_child ='';
36	  
37	  $the_portfolio_data = $( '.portfolio-content-link[data-post_id="' + post_id + '"]' ).closest('.portfolio-data');
38	  
39	  $parentElementCopy = $('#items').clone();
40	  $parentElementCopy.children('li.clearer').detach();
41	  
42	  $portfolio_first_child = $parentElementCopy.find('li:first-child');
43	  $portfolio_last_child = $parentElementCopy.find('li:last-child');
44	  
45		if($the_portfolio_data.hasClass('omega')) {			
46			 $notNext = $the_portfolio_data.next('li:not(.portfolio-data)');
47			 $possibleNext = $notNext.next('.portfolio-data');
48			 $possiblePrev = $the_portfolio_data.prev('.portfolio-data');
49			 
50			 //if this is the last item, add first item link to its next link.
51			 if( $the_portfolio_data.find('.portfolio-content-link').attr( "data-post_id" ) == $portfolio_last_child.find('.portfolio-content-link').attr( "data-post_id" ) ){
52				$next = $portfolio_first_child;
53			 } else {
54				$next = $possibleNext;
55			 }
56			 
57			 //if this is the first item, add last item link to its previous link. 
58			 if( $the_portfolio_data.find('.portfolio-content-link').attr( "data-post_id" ) == $portfolio_first_child.find('.portfolio-content-link').attr( "data-post_id" ) ){
59				$prev = $portfolio_last_child;
60			 } else {
61				$prev = $possiblePrev;
62			 }
63			 
64		} else if($the_portfolio_data.hasClass('alpha')) {			
65			 $notPrev = $the_portfolio_data.prev('li:not(.portfolio-data)');
66			 $possiblePrev = $notPrev.prev('.portfolio-data');
67			 $possibleNext = $the_portfolio_data.next('.portfolio-data');
68			 
69			  //if this is the last item, add first item link to its next link.
70			 if( $the_portfolio_data.find('.portfolio-content-link').attr( "data-post_id" ) == $portfolio_last_child.find('.portfolio-content-link').attr( "data-post_id" ) ){
71				$next = $portfolio_first_child;
72			 } else {
73				$next = $possibleNext;
74			 }
75			 
76			 //if this is the first item, add last item link to its previous link. 
77			 if( $the_portfolio_data.find('.portfolio-content-link').attr( "data-post_id" ) == $portfolio_first_child.find('.portfolio-content-link').attr( "data-post_id" ) ){
78				$prev = $portfolio_last_child;
79			 } else {
80				$prev = $possiblePrev;
81			 }
82			 
83		} else {
84			$possiblePrev = $the_portfolio_data.prev('.portfolio-data');
85			$possibleNext = $the_portfolio_data.next('.portfolio-data');
86			
87			 //if this is the last item, add first item link to its next link.
88			 if( $the_portfolio_data.find('.portfolio-content-link').attr( "data-post_id" ) == $portfolio_last_child.find('.portfolio-content-link').attr( "data-post_id" ) ){
89				$next = $portfolio_first_child;
90			 } else {
91				$next = $possibleNext;
92			 }
93			 
94			 //if this is the first item, add last item link to its previous link. 
95			 if( $the_portfolio_data.find('.portfolio-content-link').attr( "data-post_id" ) == $portfolio_first_child.find('.portfolio-content-link').attr( "data-post_id" ) ){
96				$prev = $portfolio_last_child;
97			 } else {
98				$prev = $possiblePrev;
99			 }
100			
101		}
102	  
103      	var previous_item_id = '';
104      	var next_item_id = '';
105      	
106      	// Get the id's of previous and next projects
107      	if ( $prev.length !== 0 && $next.length !== 0 ) {
108      		previous_item_id = $prev.find('.portfolio-content-link').attr( "data-post_id" );
109      		next_item_id = $next.find('.portfolio-content-link').attr( "data-post_id" );
110      	}
111      	else if ( $prev.length !== 0 ) {
112      		previous_item_id = $prev.find('.portfolio-content-link').attr( "data-post_id" );
113      	}
114      	else if ( $next.length !== 0 ) {
115      		next_item_id = $next.find('.portfolio-content-link').attr( "data-post_id" );
116      	}	
117      	
118		
119		closePortfolioItem();		
120		
121		// add current-portfolio class if this is a currently opened item
122		$the_portfolio_data.addClass('current-portfolio');
123	
124		
125		$.ajax({        	      
126			dataType: "html",
127			type: "get",
128         	url : customAjax.ajaxurl + "?action=retrieve_portfolio_item&nonce=" + customAjax.nonce,
129			data : { post_id : post_id, prev_post_id : previous_item_id, next_post_id : next_item_id },
130         	beforeSend: function() {
131         		
132				//$.scrollTo(0, 600, { easing: 'easeOutCubic' });
133				$("html, body").animate({ scrollTop: 0 }, "slow");
134			
135         	},
136         	success: function(response) {
137				$portfolioDetail.html( response );
138				
139            	$("#shownPortfolio").load(function () { 
140            		$(this).stop().animate({ opacity: 1 }, 300); 
141            		
142            	});
143				
144         	},
145         	complete: function() {
146				
147				initializeSlider(post_id);
148				initializeVideo();
149				openProject($portfolioDetail);
150				$( ".previous-portfolio, .next-portfolio" ).click( getPortfolio );
151				$( '.previous-portfolio, .next-portfolio' ).click( displayLoading );
152				$( ".close-portfolio" ).click( closePortfolioItem );				
153				$( '#loader-img' ).fadeOut(500);
154				$portfolioDetail.find('#shownPortfolio').stop().animate({ opacity: 1 }, 400);
155				
156				
157				if($( '.next-portfolio' ).attr( "data-post_id" ) == '') {
158					$( '.next-portfolio' ).css("display", "none");
159				}
160				if($( '.previous-portfolio' ).attr( "data-post_id" ) == '') {
161					$( '.previous-portfolio' ).css("display", "none");
162				}
163				
164				$('.slide-hover-effect').find('img').hover(
165					function(){
166						$(this).stop().animate({opacity: 0.8}, 750, 'easeOutCubic');					
167					},function(){
168						$(this).stop().animate({opacity: 1}, 750, 'easeOutCubic');										
169					}
170				);	
171				
172				$("a[rel^='prettyPhoto']").prettyPhoto({	
173					callback: function() {
174						
175					},
176					changepicturecallback: function(){					
177						$pp_pic_holder = $(".pp_pic_holder");		
178						$media_src = encodeURI($pp_pic_holder.find('#pp_full_res').children(':first-child').attr('src'));		
179						$encoded_URL = encodeURI(location.origin + location.pathname);
180						$('.pp_social').append('<div class="pinterest-posts"><a href="http://pinterest.com/pin/create/button/?url=' + $encoded_URL + '&media=' + $media_src + '" class="pin-it-button" count-layout="horizontal">Pin It</a><script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script></div>');
181						
182					}, /* Called everytime an item is shown/changed */			
183				});	
184				
185				/* -------------- Image Overlay Effects  --------------*/			
186				$('.overlay').hover(			
187					function(){				
188						$(this).find('img').animate({ opacity:'0.8' }, 450, 'easeInOutCubic');
189						$(this).find('.icon-view').stop(true, true).animate({ opacity: '0.75' }, 10, 'swing'); //, marginTop: '-0.5em'
190						$(this).find('.icon-link').stop(true, true).animate({ opacity: '0.75' }, 10, 'swing'); //, marginTop: '-0.5em'
191						$(this).find('h5').animate({ opacity: '1' }, 10, 'linear');
192					},function(){					
193						$(this).find('h5').animate({ opacity: '0.0' }, 300, 'linear');
194						$(this).find('.icon-view').stop(true, true).animate({ opacity: '0.0' }, 10, 'swing'); //, marginTop: parentHeight
195						$(this).find('.icon-link').stop(true, true).animate({ opacity: '0.0' }, 10, 'swing');//, marginTop: parentHeight					
196						$(this).find('img').animate({ opacity: '1' }, 450, 'easeInOutCubic');
197					}
198				);	
199				/* Overlay icons hover effect */
200				$('.overlay .icon-view, .overlay .icon-link').hover(			
201					function(){				
202						$(this).stop(true, true).animate({ opacity: '1' }, 20);					
203					},function(){
204						$(this).stop(true, true).animate({ opacity: '0.75' }, 20);	
205					}
206				);		
207				
208				
209				/* -------------- Accordion  --------------*/	
210				
211				// Hide first All Div Content
212				$(".accordion-content").hide();
213				
214				//Add Inactive Class To All Accordion Headers
215				$('.accordion-button').toggleClass('inactive-header');
216						
217				//Open The First Accordion Section When Page Loads
218				$('.accordion-button').first().toggleClass('active-header').toggleClass('inactive-header');
219				$('.accordion-content').first().slideDown().toggleClass('open-content');
220				
221				//The Accordion Effect
222				$('.accordion-button').click(function ( event ) {
223					event.preventDefault();
224					if($(this).is('.inactive-header')) {
225						$('.active-header').toggleClass('active-header').toggleClass('inactive-header').next().slideToggle().toggleClass('open-content');
226						$(this).toggleClass('active-header').toggleClass('inactive-header');
227						$(this).next().slideToggle().toggleClass('open-content');
228					}
229					
230					else {
231						$(this).toggleClass('active-header').toggleClass('inactive-header');
232						$(this).next().slideToggle().toggleClass('open-content');
233					}
234				});
235				
236				/* Tabs Activiation
237				================================================== */
238
239				var tabs = $('ul.tabs');
240
241				tabs.each(function(i) {
242
243					//Get all tabs
244					var tab = $(this).find('> li > a');
245					$($(tab).first().attr('href')).show().addClass('active').siblings().hide().removeClass('active');
246					tab.click(function(e) {
247
248						//Get Location of tab's content
249						var contentLocation = $(this).attr('href');
250
251						//Let go if not a hashed one
252						if(contentLocation.charAt(0)=="#") {
253
254							e.preventDefault();
255
256							//Make Tab Active
257							tab.removeClass('active');
258							$(this).addClass('active');
259
260							//Show Tab Content & add active class
261							$(contentLocation).show().addClass('active').siblings().hide().removeClass('active');
262
263						}
264					});
265				});
266				
267			} /* end complete method */
268      	});
269      	
270      	e.preventDefault();
271   		
272   	}
273   	
274 
275	$( ".portfolio-content-link" ).click( getPortfolio );   		
276	
277	initializePortfolio();
278
279		   	
280   	function closePortfolioItem() {
281   		
282		//$.scrollTo(0, 600, { easing: 'easeOutCubic' });
283		$("html, body").animate({ scrollTop: 0 }, "slow");
284		
285   		var $clickedObject = $(this);
286   		
287   		if( $clickedObject.hasClass('close-current-post') ) {
288   			$portfolioDetail.addClass('closedPortfolio');
289   		}
290   		
291		$portfolioDetail.find('#shownPortfolio, #shownPortfolioMeta').stop().animate({ opacity: 0 }, 200);
292			
293		$portfolioDetail.stop().animate({ height: 0 }, 800, 'easeOutQuart', function() { $(this).css('overflow', 'hidden');			
294			if( $clickedObject.hasClass('close-current-post') ) {
295   				$(this).empty();
296   			}
297		});
298		
299		
300		var $currentItem = $('#items').find('.current-portfolio');
301		$currentItem.removeClass('current-portfolio');
302		
303	}
304	
305	function openProject(portfolioDoor) {
306		
307		var portfolioHeight = 0;
308			portfolioDoor.imagesLoaded( function( $images, $proper, $broken ) {
309			portfolioHeight = portfolioDoor.find('#shownPortfolio').outerHeight( true ) + portfolioDoor.find('.portfolio-single').next('hr').outerHeight(true);
310
311			$portfolioDetail.animate({
312				height: portfolioHeight
313			}, 2000, 'easeOutQuart', function() {
314				$(this).css({ 'height': 'auto' });
315			});
316		});
317		
318		
319	}
320   	
321    /* Initialize carouFredSel slider for Portfolio */	
322   	function initializeSlider(the_post_id) {
323	
324		/* -------------- "Portfolio Page" Gallery slider --------------*/
325		if(jQuery().carouFredSel) {		
326				
327				$("#post-format-slides img:first").load(function() {
328					
329					$('#post-format-slides').carouFredSel({							
330						responsive: true,						
331						items 		: { 
332							width : 520,
333							height: 'variable',
334							visible: 1
335						},						
336						prev	: {	
337							button	: "#slider-down",
338							key		: "down"
339						},
340						next	: { 
341							button	: "#slider-up",
342							key		: "up"
343						},
344						pagination: "#slider-pagination",
345						auto : {
346							easing		: "easeInOutBack",
347							duration	: 1000,
348							pauseDuration: 5000,
349							pauseOnHover: true
350						},
351						scroll : {
352							fx : 'crossfade'
353						}
354					});		
355
356				});
357		}		
358	}
359	
360	/* Initialize fitVids for videos */	
361   	function initializeVideo() {
362		if(jQuery().fitVids) {
363			$(".video-figure").fitVids();
364		}
365	}
366	
367	/* Display Loading Image  */
368	
369	function displayLoading() {
370		$( '#loader-img' ).css('visibility', 'visible').fadeIn(1200); }
371		$( '.portfolio-content-link' ).click( displayLoading );
372	
373	
374	
375	/*---*/
376	
377	initializeSlider();
378	initializeVideo();
379	
380	$( ".close-portfolio, .previous-portfolio, .next-portfolio" ).click( function() {		
381		
382		
383		if ( !$( 'html' ).hasClass('ie8') ) {
384			
385			var $clickedObject = $(this);
386			
387			if( $clickedObject.hasClass('close-current-post') ) {
388	   			$portfolioDetail.addClass('closedPortfolio');
389	   		}
390	   		
391			$portfolioDetail.find('#shownPortfolio, #shownPortfolioMeta').stop().animate({
392				opacity: 0
393			}, 200);
394				
395			$portfolioDetail.stop().animate({
396				height: 0
397			}, 600, 'easeOutQuart', function() {
398				$(this).css('overflow', 'hidden');
399				
400				if( $clickedObject.hasClass('close-current-post') ) {
401   					$(this).empty();
402   				}
403			});
404		
405		}
406		
407	});
408	
409	if ( !$( 'html' ).hasClass('ie8') ) {
410		$( ".previous-portfolio, .next-portfolio" ).click( getPortfolio );	
411	}
412	
413	$( '.previous-portfolio, .next-portfolio' ).click( displayLoading );
414	
415	
416});

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.