PageSourceSearch

https://mexicoha.com/wp-content/themes/Nexus/includes/page_templates/js/et-ptemplates-frontend.js?ver=1.1

js mexicoha.com collected 2026-09-24 13:47:04 UTC 7,216 bytes, 205 lines download raw bytes

1/* <![CDATA[ */
2jQuery(document).ready(function() {
3	// remove autoplay from all videos, except the first one, in the slider
4	jQuery( '.et_embedded_videos iframe' ).each( function( index ) {
5		var $this_frame = jQuery(this),
6			frame_src	= $this_frame.attr( 'src' );
7
8		if ( -1 !== frame_src.indexOf( 'autoplay=1' ) ) {
9			frame_src = frame_src.replace( /autoplay=1/g, '' );
10			$this_frame
11				.addClass( 'et_autoplay_removed' )
12				.attr( 'src', '' )
13				.attr( 'src', frame_src );
14		}
15	} );
16
17	jQuery( 'a[class*=fancybox]' ).magnificPopup( {
18		type: 'image',
19		removalDelay: 500,
20		mainClass: 'mfp-fade',
21		gallery: {
22			enabled: true,
23			navigateByImgClick: true
24		},
25		zoom: {
26			enabled: true,
27			duration: 500,
28			opener: function(openerElement) {
29				// openerElement is the element on which popup was initialized, in this case its <a> tag
30				// you don't need to add "opener" option if this code matches your needs, it's defailt one.
31				var $opener_el = openerElement.is( 'img' ) ? openerElement : openerElement.closest( 'div' ).find( 'img' );
32
33				return $opener_el.length ? $opener_el : openerElement;
34			}
35		},
36		callbacks: {
37			elementParse: function( item ) {
38				// Function will fire for each target element
39				// "item.el" is a target DOM element (if present)
40				// "item.src" is a source that you may modify
41
42				// replace the item.src for video posts to include the actual URL for the iframe
43				if ( -1 !== item.src.indexOf( 'et_video_post_' ) && jQuery( item.src ).find( 'iframe' ).length ) {
44					item.src = jQuery( item.src ).find( 'iframe' ).attr( 'src' );
45				}
46			},
47			change: function() {
48				if ( 'image' === this.currItem.type ) {
49					return;
50				}
51
52				var $this_frame 	= this.contentContainer.find( 'iframe' ),
53					this_frame_src 	= $this_frame.attr( 'src' );
54
55				$this_frame.data( 'et_video_embed', this_frame_src );
56
57				// if we removed autoplay previously, let's add it back
58				if ( jQuery( this.currItem.el[0].hash ).find( 'iframe' ).hasClass( 'et_autoplay_removed' ) ) {
59					$this_frame.attr( 'src', this_frame_src + '&autoplay=1' );
60				}
61			},
62			beforeClose: function() {
63				if ( 'image' === this.currItem.type ) {
64					return;
65				}
66
67				var video_href = this.currItem.el[0].hash,
68					$this_frame = jQuery( video_href ).find( 'iframe.et_autoplay_removed' ),
69					this_frame_src,
70					$frame = jQuery( video_href ).find( 'iframe' );
71
72				$frame.attr( 'src', $frame.data( 'et_video_embed' ) )
73
74				if ( $this_frame.length ) {
75					// delete autoplay after closing the fancybox window to prevent videos from playing in background
76					frame_src = $this_frame.attr( 'src' ).replace( /autoplay=1/g, '' );
77					$this_frame
78						.attr( 'src', '' )
79						.attr( 'src', frame_src );
80				}
81			}
82		},
83		iframe: {
84			patterns: {
85				youtube: {
86					index: 'youtube.com/', // String that detects type of video (in this case YouTube). Simply via url.indexOf(index).
87
88					id: null, // String that splits URL in a two parts, second part should be %id%
89					// Or null - full URL will be returned
90					// Or a function that should return %id%, for example:
91					// id: function(url) { return 'parsed id'; }
92
93					src: '%id%' // URL that will be set as a source for iframe.
94				},
95				vimeo: {
96					index: 'vimeo.com/',
97					id: null,
98					src: '%id%'
99				}
100  			},
101			srcAction: 'iframe_src'
102		}
103	} );
104
105	jQuery( "a[class*='et_video_lightbox']" ).magnificPopup( {
106		type: 'iframe',
107		removalDelay: 500,
108		mainClass: 'mfp-fade',
109		gallery: {
110			enabled: true,
111			navigateByImgClick: true
112		}
113	});
114
115	var $portfolioItem = jQuery('.et_pt_gallery_entry');
116	$portfolioItem.find('.et_pt_item_image').css('background-color','#000000');
117	jQuery('.zoom-icon, .more-icon').css({'opacity':'0','visibility':'visible'});
118
119	$portfolioItem.hover(function(){
120		jQuery(this).find('.et_pt_item_image').stop(true, true).animate({top: -10}, 500).find('img.portfolio').stop(true, true).animate({opacity: 0.7},500);
121		jQuery(this).find('.zoom-icon').stop(true, true).animate({opacity: 1, left: 43},400);
122		jQuery(this).find('.more-icon').stop(true, true).animate({opacity: 1, left: 110},400);
123	}, function(){
124		jQuery(this).find('.zoom-icon').stop(true, true).animate({opacity: 0, left: 31},400);
125		jQuery(this).find('.more-icon').stop(true, true).animate({opacity: 0, left: 128},400);
126		jQuery(this).find('.et_pt_item_image').stop(true, true).animate({top: 0}, 500).find('img.portfolio').stop(true, true).animate({opacity: 1},500);
127	});
128
129
130	//contact page
131	var $et_contact_container = jQuery('#et-contact'),
132		$et_contact_form = $et_contact_container.find('form#et_contact_form'),
133		$et_contact_submit = $et_contact_container.find('input#et_contact_submit'),
134		$et_inputs = $et_contact_form.find('input[type=text],textarea'),
135		et_email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,
136		et_contact_error = false,
137		$et_contact_message = jQuery('#et-contact-message'),
138		et_message = '';
139
140	$et_inputs.on('focus', function(){
141		if ( jQuery(this).val() === jQuery(this).siblings('label').text() ) jQuery(this).val("");
142	}).on('blur', function(){
143		if (jQuery(this).val() === "") jQuery(this).val( jQuery(this).siblings('label').text() );
144	});
145
146	$et_contact_form.on('submit', function() {
147		et_contact_error = false;
148		et_message = '<ul>';
149
150		$et_inputs.removeClass('et_contact_error');
151
152		$et_inputs.each(function(index, domEle){
153			if ( jQuery(domEle).val() === '' || jQuery(domEle).val() === jQuery(this).siblings('label').text() ) {
154				jQuery(domEle).addClass('et_contact_error');
155				et_contact_error = true;
156
157				var default_value = jQuery(this).siblings('label').text();
158				if ( default_value == '' ) default_value = et_ptemplates_strings.captcha;
159
160				et_message += '<li>' + et_ptemplates_strings.fill + ' ' + default_value + ' ' + et_ptemplates_strings.field + '</li>';
161			}
162			if ( (jQuery(domEle).attr('id') == 'et_contact_email') && !et_email_reg.test(jQuery(domEle).val()) ) {
163				jQuery(domEle).removeClass('et_contact_error').addClass('et_contact_error');
164				et_contact_error = true;
165
166				if ( !et_email_reg.test(jQuery(domEle).val()) ) et_message += '<li>' + et_ptemplates_strings.invalid + '</li>';
167			}
168		});
169
170		if ( !et_contact_error ) {
171			$href = jQuery(this).attr('action');
172
173			$et_contact_container.fadeTo('fast',0.2).load($href+' #et-contact', jQuery(this).serializeArray(), function() {
174				$et_contact_container.fadeTo('fast',1);
175			});
176		}
177
178		et_message += '</ul>';
179
180		if ( et_message != '<ul></ul>' )
181			$et_contact_message.html(et_message);
182
183		return false;
184	});
185
186	var $et_searchinput = jQuery('#et-searchinput');
187		etsearchvalue = $et_searchinput.val();
188
189	$et_searchinput.focus(function(){
190		if (jQuery(this).val() === etsearchvalue) jQuery(this).val("");
191	}).blur(function(){
192		if (jQuery(this).val() === "") jQuery(this).val(etsearchvalue);
193	});
194
195	var $et_template_portfolio_thumb = jQuery('.et_pt_portfolio_entry');
196	$et_template_portfolio_thumb.hover(function(){
197		jQuery(this).find('img').fadeTo('fast', 0.8);
198		jQuery(this).find('.et_portfolio_more_icon,.et_portfolio_zoom_icon').fadeTo('fast', 1);
199	}, function(){
200		jQuery(this).find('img').fadeTo('fast', 1);
201		jQuery(this).find('.et_portfolio_more_icon,.et_portfolio_zoom_icon').fadeTo('fast', 0);
202	});
203
204});
205/* ]]> */

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.