PageSourceSearch

https://tidetheknotbeachweddings.com/wp-content/themes/TIDE-new/script/script.js

js tidetheknotbeachweddings.com collected 2026-10-06 23:59:39 UTC 11,439 bytes, 377 lines download raw bytes

1/**
2 * This file contains the functionality for initializing all the scripts in the
3 * site and also there are some main initial settings included here, such as
4 * setting rounded corners automatically, setting the Twitter functionality,
5 * etc.
6 * 
7 * @author Pexeto
8 */
9
10var pexetoSite;
11
12(function(jQuery){
13pexetoSite = {
14	enableCufon:'off',
15	initSite : function() {
16	
17		// sets the colorbox lightbox
18		jQuery(".gallery a").each(function(){
19			var lightbox=jQuery(this).parents('.preview-item').length?'lightbox':'lightbox[group]';
20			jQuery(this).attr("rel", lightbox);
21		});
22		
23		this.setLightbox(jQuery("a[rel^='lightbox']"));
24		
25		this.setTestimonialFunc();
26		
27		//set the tabs functionality
28		jQuery("ul.tabs").tabs("div.panes > div");
29		
30		//set the accordion functionality
31		jQuery('.accordion-container').each(function(){
32			jQuery(this).tabs(jQuery(this).find('div.pane'), {tabs: 'h2', effect: 'slide', initialIndex: 0});
33		});
34		
35		this.set_submit_comment();
36		
37		//SET THE SEARCH BUTTON CLICK HANDLER
38		jQuery('#search_button').click(function(event){
39			event.preventDefault();
40			jQuery('#searchform').submit();
41		});
42		
43		//set the hover animation of the images within anchors
44		jQuery('a img').hover(function(){
45			jQuery(this).stop().animate({opacity:0.85}, 300);
46		},function(){
47			jQuery(this).stop().animate({opacity:1}, 300);
48		});
49		
50		this.setColumns();
51		
52		this.setDropDown();
53		this.loadCufon();
54	},
55		
56	loadCufon:function(){
57		if(this.enableCufon==='on'){
58			Cufon.replace('h1,h2,h3,h4,h5,h6,#portfolio-big-pagination,.showcase-item span,a.button span,.intro-text, a.button-small span,.drop-caps');
59		}
60	},
61	
62	
63	setScrollable:function(){
64		return jQuery('#slider-navigation').scrollable();
65	},
66	
67	setPortfolioLightbox:function(){
68		this.setLightbox(jQuery('a[rel="lightbox"]'));
69	},
70	
71	setLightbox:function(elem){
72		elem.prettyPhoto({animation_speed:'normal', theme:'light_rounded', overlay_gallery: false});
73	},
74	
75	/**
76	 * Adds a drop down functionality.
77	 */
78	setDropDown:function(){
79		var padding=jQuery.browser.msie?5:12;
80		
81		jQuery("#menu ul li").each(function(){
82			if(jQuery(this).children('ul').length>0){
83				jQuery(this).find('a:first').append('<span class="drop-arrow">&raquo;</span>');
84			}
85		});
86		
87		jQuery("#menu ul ul").data('padding', 15);
88		jQuery("#menu ul ul ul").data('padding', 0);
89		
90		jQuery("#menu ul li").hover(function(){
91			if(jQuery(this).children('ul.sub-menu').length>0){
92				var ul = jQuery(this).find('ul:first');
93				ul.stop().css({paddingTop:ul.data('padding'), height:'auto'}).slideDown(300, function()
94				{
95					ul.css({overflow:"visible", visibility:'visible'});
96				});
97			}
98		}, function(){
99			if(jQuery(this).children('ul.sub-menu').length>0){
100				var ul = jQuery(this).find('ul:first');
101				ul.stop().slideUp(300, function()
102				{	
103					ul.css({overflow:"hidden", display:"none"});
104				});
105			}
106		});
107
108		jQuery(".menu > li.menu-item-has-children > a").on('click touchstart', function(e) {
109      e.preventDefault();
110      jQuery('.menu > li').removeClass('menu-show');
111      jQuery(this).parent().toggleClass('menu-show');
112    });
113		
114		if(jQuery.browser.opera){
115			jQuery("#menu ul li").mouseover(function(e){
116				jQuery(this).css({backgroundColor:'#fff'});
117			});
118		}
119		
120		if(jQuery.browser.safari){
121		var hiddenul=jQuery('<ul><li></li></ul>').css({visibility:'hidden',display:'block'});
122		jQuery('#menu ul:first').find('li').not('#menu ul li li').eq(-1).append(hiddenul);
123		}
124	},
125	
126	/**
127	 * Sets the testimonials accordion functionality.
128	 */
129	setTestimonialFunc:function(){
130		jQuery('.testimonial-container').each(function(){
131			jQuery(this).find('div.testim-pane:first').addClass('first');
132			jQuery(this).tabs(jQuery(this).find('div.testim-pane'), {
133				tabs: 'img', 
134				effect: 'horizontal'
135			})
136		});
137	},
138	
139	setColumns:function(){
140		jQuery('#content-container .columns-wrapper').each(function(){
141			if(jQuery(this).find('.nomargin').length!==1){
142				jQuery(this).find('.two-columns').eq(-1).addClass('nomargin');
143				jQuery(this).find('.three-columns').not('.services-box').eq(-1).addClass('nomargin');
144				jQuery(this).find('.four-columns').eq(-1).addClass('nomargin');
145			}
146		});
147	},
148	
149	/**
150	 * Loads the Nivo image slider.
151	 */
152	loadNivoSlider : function(obj, effect, showButtons, showArrows, slices, speed, interval, pauseOnHover, autoplay, columns, rows) {
153		obj.find('img:first').css({zIndex:10000});
154		
155		// load the Nivo slider	
156		jQuery(window)
157				.load(function() {
158					obj.nivoSlider( {
159						effect : effect, // Specify sets like:
160						// 'fold,fade,sliceDown'
161						slices : slices,
162						boxCols: columns, // For box animations
163					    boxRows: rows, // For box animations
164						animSpeed : speed,
165						pauseTime : interval,
166						startSlide : 0, // Set starting Slide (0 index)
167						directionNav : showArrows, // Next & Prev
168						directionNavHide : true, // Only show on hover
169						controlNav : showButtons, // 1,2,3...
170						controlNavThumbs : false, // Use thumbnails for
171						// Control
172						// Nav
173						controlNavThumbsFromRel : false, // Use image rel for
174						// thumbs
175						keyboardNav : true, // Use left & right arrows
176						pauseOnHover : pauseOnHover, // Stop animation while hovering
177						manualAdvance : !autoplay, // Force manual transitions
178						captionOpacity : 0.8, // Universal caption opacity
179						beforeChange : function() {
180						},
181						afterChange : function() {
182						},
183						slideshowEnd : function() {
184						} // Triggers after all slides have been shown
185					});
186
187					// remove numbers from navigation
188						jQuery('.nivo-controlNav a').html('');
189						jQuery('.nivo-directionNav a').html('');
190
191						// center the slider navigation
192						var slideNumber = jQuery('.nivo-controlNav a').length;
193						var slideLeft = 980 / 2 - slideNumber * 21 / 2;
194						jQuery('.nivo-controlNav:first').css( {
195							left : slideLeft
196						});
197		    });
198	},
199	
200	set_submit_comment:function(){
201		jQuery('#submit_comment_button').click(function(event){
202			event.preventDefault();
203			jQuery('#commentform').submit();
204		});
205	}
206
207};
208
209/**
210 * Contains the functionality of the send email form. Makes the validation and
211 * sends the message.
212 */
213pexetoContactForm = {
214	emptyNameMessage : 'Please fill in your name',
215	invalidEmailMessage : 'Please insert a valid email address',
216	emptyQuestionMessage : 'Please write your question',
217	sentMessage : 'Message Sent',
218	actionPath:'',
219	set : function(actionPath, sentMessage, nameError, emailError, questionError) {
220		this.emptyNameMessage=nameError;
221		this.invalidEmailMessage=emailError;
222		this.emptyQuestionMessage=questionError;
223		this.actionPath=actionPath;
224		this.sentMessage=sentMessage;
225		this.setSendButtonClickHandler();
226		this.setInputClickHandler();
227	},
228
229	/**
230	 * Sets the send button click event handler. Validates the inputs and if they are
231	 * not valid, displays error messages. If they are valid- makes an AJAX request to the
232	 * PHP script to send the message.
233	 */
234	setSendButtonClickHandler : function() {
235		jQuery("#send_button")
236				.click(function(event) {
237					
238					event.preventDefault();
239					valid = true;
240
241						// remove previous validation error messages and warning styles
242						jQuery("#name_text_box").removeClass('invalid');
243						jQuery("#email_text_box").removeClass('invalid');
244						jQuery("#question_text_area").removeClass('invalid');
245						jQuery('#invalid_input').hide();
246						jQuery('#sent_successful').hide();
247						jQuery('.question_icon').remove();
248						jQuery('.contact_message').remove();
249
250						// verify whether the name text box is empty
251						var nameTextBox = jQuery("#name_text_box");
252						var name = nameTextBox.val();
253						if (name == '' || name == null) {
254							nameTextBox.addClass('invalid');
255							valid = false;
256							jQuery(
257									'<div class="question_icon"></div><div class="contact_message"><p>' + pexetoContactForm.emptyNameMessage + '</p></div>')
258									.insertAfter(nameTextBox);
259						}
260
261						// verify whether the inserted email address is valid
262						var emailTextBox = jQuery("#email_text_box");
263						var email = emailTextBox.val();
264						if (!pexetoContactForm.isValidEmailAddress(email)) {
265							emailTextBox.addClass('invalid');
266							valid = false;
267							jQuery(
268									'<div class="question_icon"></div><div class="contact_message"><p>' + pexetoContactForm.invalidEmailMessage + '</p></div>')
269									.insertAfter(emailTextBox);
270						}
271
272						// verify whether the question text area is empty
273						var questionTextArea = jQuery("#question_text_area");
274						var question = questionTextArea.val();
275						if (question == '' || question == null) {
276							questionTextArea.addClass('invalid');
277							valid = false;
278							jQuery(
279									'<div class="question_icon"></div><div class="contact_message"><p>' + pexetoContactForm.emptyQuestionMessage + '</p></div>')
280									.insertAfter(questionTextArea);
281						}
282
283						if (!valid) {
284							//the form inputs are not valid
285							jQuery('.contact_message').animate( {
286								opacity : 0
287							}, 0).hide();
288							jQuery('.question_icon').hover(
289									function() {
290										jQuery(this).css( {
291											cursor : 'pointer'
292										});
293										jQuery(this).siblings('.contact_message')
294												.stop().show().animate( {
295													opacity : 1
296												}, 200);
297									},
298									function() {
299										jQuery(this).siblings('.contact_message')
300												.stop().animate( {
301													opacity : 0
302												}).hide();
303									});
304						} else {
305							//the form inputs are valid
306							
307							// show the loading icon
308							jQuery('#contact_status').html(
309									'<div class="contact_loader"></div>');
310
311							var dataString = 'name=' + escape(name) + '&question='
312									+ escape(question) + '&email=' + email;
313
314							jQuery
315									.ajax( {
316										type : "POST",
317										url : pexetoContactForm.actionPath,
318										data : dataString,
319										success : function() {
320											jQuery("#submit_form").each(function() {
321												this.reset();
322											});
323											jQuery('#contact_status')
324													.html(
325															'<div class="check"></div><span>' + pexetoContactForm.sentMessage + '</span>');
326											setTimeout(function() {
327												jQuery('#contact_status').fadeOut(
328														500,
329														function() {
330															jQuery(this).html('')
331																	.show();
332														});
333											}, 3000);
334										}
335									});
336						}
337					});
338	},
339
340	setInputClickHandler : function() {
341		jQuery('.form_input').click(function() {
342			jQuery(this).removeClass('invalid');
343		});
344
345		jQuery('.form_input').live('keydown', function(e) {
346			var keyCode = e.keyCode || e.which;
347
348			if (keyCode == 9) {
349				var index = jQuery('.form_input').index(jQuery(this));
350				jQuery('.form_input').eq(index + 1).removeClass('invalid');
351			}
352		});
353	},
354
355	/**
356	 * Checks if an email address is a valid one.
357	 * 
358	 * @param emailAddress
359	 *            the email address to validate
360	 * @return true if the address is a valid one
361	 */
362	isValidEmailAddress : function(emailAddress) {
363		var pattern = new RegExp(
364				/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
365		return pattern.test(emailAddress);
366	}		
367};
368}(jQuery));
369
370
371
372
373
374
375
376
377

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.