PageSourceSearch

https://cpepesc.org/wp-content/themes/cpepesc/assets/js/lib/gdlr-portfolio-script.js?ver=1.12.4

js cpepesc.org collected 2026-09-24 23:02:11 UTC 5,256 bytes, 144 lines download raw bytes

1(function($){
2	"use strict";
3
4	// get portfolio using ajax
5	function greennature_portfolio_ajax(port_holder, ajax_info, category, paged){
6
7		var args = new Object();
8		args['num-fetch'] = ajax_info.attr('data-num-fetch');
9		args['num-excerpt'] = ajax_info.attr('data-num-excerpt');
10		args['order'] = ajax_info.attr('data-order');
11		args['orderby'] = ajax_info.attr('data-orderby');
12		args['thumbnail-size'] = ajax_info.attr('data-thumbnail-size');
13		args['thumbnail-size-featured'] = ajax_info.attr('data-thumbnail-size-featured');
14		args['portfolio-style'] = ajax_info.attr('data-port-style');
15		args['portfolio-size'] = ajax_info.attr('data-port-size');
16		args['portfolio-layout'] = ajax_info.attr('data-port-layout');
17		args['pagination'] = ajax_info.attr('data-pagination');
18		args['category'] = (category)? category: ajax_info.attr('data-category');
19		args['paged'] = (paged)? paged: 1;
20
21		// hide the un-used elements
22		var animate_complete = false;
23		port_holder.slideUp(500, function(){
24			animate_complete = true;
25		});
26		port_holder.siblings('.greennature-pagination').slideUp(500, function(){
27			$(this).remove();
28		});
29		
30		var now_loading = $('<div class="greennature-now-loading"></div>');
31		now_loading.insertBefore(port_holder);
32		now_loading.slideDown();
33		
34		// call ajax to get portfolio item
35		$.ajax({
36			type: 'POST',
37			url: ajax_info.attr('data-ajax'),
38			data: {'action': 'greennature_get_portfolio_ajax', 'args': args},
39			error: function(a, b, c){ console.log(a, b, c); },
40			success: function(data){
41				now_loading.css('background-image','none').slideUp(function(){ $(this).remove(); });	
42			
43				var port_item = $(data).hide();
44				if( animate_complete ){
45					greennature_bind_portfolio_item(port_holder, port_item);
46				}else{
47					setTimeout(function() {
48						greennature_bind_portfolio_item(port_holder, port_item);
49					}, 500);
50				}	
51			}
52		});		
53		
54	}
55	
56	function greennature_bind_portfolio_item(port_holder, port_item){
57		if( port_holder ){
58			port_holder.replaceWith(port_item);
59		}
60		port_item.slideDown();
61		
62		// bind events
63		port_item.each(function(){
64			if( $(this).hasClass('greennature-pagination') ){
65				$(this).children().greennature_bind_portfolio_pagination();
66			}
67		});	
68		port_item.greennature_fluid_video();		
69		port_item.find('.greennature-portfolio-item').greennature_portfolio_hover();
70		port_item.find('.flexslider').greennature_flexslider();
71		port_item.find('.greennature-isotope').greennature_isotope();
72		port_item.find('[data-rel="fancybox"]').greennature_fancybox();
73		
74		if( port_item.closest('.greennature-portfolio-link-lightbox').length > 0 ){
75			port_item.find('a[data-lightbox]').click(function(){
76				$(this).greennature_portfolio_lightbox(); return false;
77			});
78		}
79		port_item.find('img').load(function(){ $(window).trigger('resize'); });
80	}
81	
82	$.fn.greennature_bind_portfolio_pagination = function(){
83		$(this).click(function(){
84			if($(this).hasClass('current')) return;
85			var port_holder = $(this).parent('.greennature-pagination').siblings('.portfolio-item-holder');
86			var ajax_info = $(this).parent('.greennature-pagination').siblings('.greennature-ajax-info');
87			
88			var category = $(this).parent('.greennature-pagination').siblings('.portfolio-item-filter');
89			if( category ){
90				category = category.children('.active').attr('data-category');
91			}
92
93			greennature_portfolio_ajax(port_holder, ajax_info, category, $(this).attr('data-paged'));
94			return false;
95		});		
96	}
97	
98	$.fn.greennature_portfolio_hover = function(){
99		$(this).each(function(){
100			var port_item = $(this);
101			
102			$(this).find('.portfolio-thumbnail').hover(function(){
103				$(this).children('img').transition({ scale: 1.1, duration: 200 });
104				$(this).find('.portfolio-overlay').animate({opacity: 0.6}, 200);
105				$(this).find('.portfolio-overlay-content, .portfolio-overlay-icon').animate({opacity: 1}, 200);
106			}, function(){
107				$(this).children('img').transition({ scale: 1, duration: 200 });
108				$(this).find('.portfolio-overlay').animate({opacity: 0}, 200);
109				$(this).find('.portfolio-overlay-content, .portfolio-overlay-icon').animate({opacity: 0}, 200);
110			});		
111
112			function set_portfolio_height(){
113				
114				port_item.find('.portfolio-overlay-content').each(function(){
115					$(this).css('margin-top', -($(this).height()/2));
116				});		
117			}	
118			set_portfolio_height();
119			$(window).resize(function(){ set_portfolio_height(); });
120		});		
121	}
122
123	$(document).ready(function(){
124
125		// script for portfolio item
126		$('.greennature-portfolio-item').greennature_portfolio_hover();
127		
128		// script for calling ajax portfolio when selecting category
129		$('.portfolio-item-filter a').click(function(){
130			if($(this).hasClass('active')) return false;
131			$(this).addClass('active').siblings().removeClass('active');
132		
133			var port_holder = $(this).parent('.portfolio-item-filter').siblings('.portfolio-item-holder');
134			var ajax_info = $(this).parent('.portfolio-item-filter').siblings('.greennature-ajax-info');
135
136			greennature_portfolio_ajax(port_holder, ajax_info, $(this).attr('data-category'));
137			return false;
138		});
139		
140		// script for calling ajax portfolio when using pagination
141		$('.greennature-pagination.greennature-ajax .page-numbers').greennature_bind_portfolio_pagination();
142	});
143
144})(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.