PageSourceSearch

https://answer-cloud.com/js/script.js

js answer-cloud.com collected 2026-10-02 15:40:42 UTC 7,436 bytes, 255 lines download raw bytes

1(function($) {
2	
3	'use strict';
4	
5	var ShowApp = {
6		
7		// Initialization the functions
8		init: function() {
9			ShowApp.Preloader();
10			ShowApp.AffixMenu();
11			ShowApp.MobileMenu();
12			ShowApp.ScrollSpy();
13			ShowApp.SmoothScroll();
14			ShowApp.FitVids();
15			ShowApp.PlaceHolder();
16			ShowApp.Carousel();
17			ShowApp.Lightbox();
18			ShowApp.Subscribe();
19		},
20		
21		// Page loading process
22		Preloader: function() {
23			$(window).load(function() {
24				$('#preloader .spinner').delay(100).fadeOut(300, function() {
25					$('#header, .row-section').animate({
26						opacity: 1
27					}, 300);
28					$(this).parent().delay(300).fadeOut(500, function() {
29						ShowApp.Animated();
30					});
31				});
32			});
33		},
34		
35		// Navigation menu affix
36		AffixMenu: function() {
37			var navMenu	= '<nav id="navigation_affix">';
38			navMenu		+= $('#navigation').html();
39			navMenu		+= '</nav>';
40			
41			$('#header').before(navMenu);
42			
43			$('#navigation').waypoint(function() {
44				$('#navigation_affix').removeClass('show');
45			}, {
46				offset: -89
47			});
48			
49			$('#navigation').waypoint(function() {
50				$('#navigation_affix').addClass('show');
51			}, {
52				offset: -90
53			});
54		},
55		
56		// Add mobile navigation
57		MobileMenu: function() {
58			var navMenu	= '<nav class="nav-menu-mobile">';
59			navMenu		+= '<div class="nav-menu-links">';
60			navMenu		+= '<ul>';
61			navMenu		+= $('#navigation .nav').html();
62			navMenu		+= '</ul>';
63			navMenu		+= '</div>';
64			navMenu		+= '<div class="nav-menu-button">';
65			navMenu		+= '<button class="nav-menu-toggle"><i class="fa fa-navicon"></i></button>';
66			navMenu		+= '</div>';
67			navMenu		+= '</nav>';
68			
69			$('#header').prepend(navMenu);
70			
71			$('.nav-menu-toggle').on('click', function() {
72				$(this).parent('.nav-menu-button').prev('.nav-menu-links').slideToggle(300);
73			});
74		},
75		
76		// Navigation menu scrollspy to anchor section
77		ScrollSpy: function() {
78			$('body').scrollspy({
79				target: '#navigation_affix',
80				offset: parseInt($('#navigation_affix').height(), 0)
81			});
82		},
83		
84		// Smooth scrolling to anchor section
85		SmoothScroll: function() {
86			$('a.smooth-scroll').on('click', function(event) {
87				var $anchor		= $(this);
88				var offsetTop	= '';
89				var elemHeight	= parseInt($('#navigation_affix').height() - 1, 0);
90				
91				if (window.Response.band(768)) {
92					offsetTop = parseInt($($anchor.attr('href')).offset().top - elemHeight, 0);
93				} else {
94					offsetTop = parseInt($($anchor.attr('href')).offset().top, 0);
95				}
96				
97				$('html, body').stop().animate({
98					scrollTop: offsetTop
99				}, 1500,'easeInOutExpo');
100				
101				event.preventDefault();
102			});
103		},
104		
105		// Responsive video size
106		FitVids: function() {
107			$('body').fitVids();
108		},
109		
110		// Placeholder compatibility for IE8
111		PlaceHolder: function() {
112			$('input, textarea').placeholder();
113		},
114		
115		// Slider with Slick carousel
116		Carousel: function() {
117			// Header slider
118			$('.carousel-slider.header-slider').each(function() {
119				$(this).slick({
120					dots: true,
121					autoplay: true,
122					autoplaySpeed: 5000,
123					draggable: false,
124					responsive: [{
125						breakpoint: 768,
126						settings: { draggable: true }
127					}]
128				});
129			});
130			
131			// Gallery slider
132			$('.carousel-slider.gallery-slider').each(function() {
133				$(this).slick({
134					dots: true,
135					slidesToShow: 4,
136					slidesToScroll: 1,
137					draggable: false,
138					responsive: [
139						{
140							breakpoint: 768,
141							settings: {
142								slidesToShow: 2,
143								draggable: true
144							}
145						},
146						{
147							breakpoint: 480,
148							settings: {
149								slidesToShow: 1,
150								draggable: true
151							}
152						}
153					]
154				});
155			});
156			
157			// General slider
158			$('.carousel-slider.general-slider').each(function() {
159				$(this).slick({
160					dots: true,
161					adaptiveHeight: true,
162					draggable: false,
163					responsive: [{
164						breakpoint: 768,
165						settings: { draggable: true }
166					}]
167				});
168			});
169		},
170		
171		// Preview images popup gallery with Fancybox
172		Lightbox: function() {
173			$('.fancybox').fancybox({
174				loop: false
175			});
176		},
177		
178		// Email subscribe process with AJAX
179		Subscribe: function() {
180			// Checking subcribe form when focus event
181			$('.affa-form-subscribe input[type="text"], .affa-form-subscribe input[type="email"]').live('focus keypress', function() {
182				var $email = $(this);
183				
184				if ($email.hasClass('error')) {
185					$email.val('').removeClass('error');
186				}
187				if ($email.hasClass('success')) {
188					$email.val('').removeClass('success');
189				}
190			});
191			
192			// Subscribe form when submit to database
193			$('.affa-form-subscribe').submit(function() {
194				var $email		  = $(this).find('input[name="email"]');
195				var $submit		  = $(this).find('input[name="submit"]');
196				var email_pattern = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
197				
198				if (email_pattern.test($email.val()) === false) {
199					$email.val('Please enter a valid email address!').addClass('error');
200				} else {
201					var submitData = $(this).serialize();
202					$email.attr('disabled','disabled');
203					$submit.attr('disabled','disabled');
204					$.ajax({ // Subcribe process with AJAX
205						type: 'POST',
206						url: 'process-subscribe.php',
207						data: submitData + '&action=add',
208						dataType: 'html',
209						success: function(msg) {
210							if (parseInt(msg, 0) !== 0) {
211								var msg_split = msg.split('|');
212								
213								if (msg_split[0] === 'success') {
214									$submit.removeAttr('disabled');
215									$email.removeAttr('disabled').val(msg_split[1]).addClass('success');
216								} else {
217									$submit.removeAttr('disabled');
218									$email.removeAttr('disabled').val(msg_split[1]).addClass('error');
219								}
220							}
221						}
222					});
223				}
224				
225				return false;
226			});
227		},
228		
229		// Embed animation effects to HTML elements with CSS3
230		Animated: function() {
231			$('.animation, .animation-visible').each(function() {
232				var $element = $(this);
233				$element.waypoint(function() {
234					var delay = 0;
235					if ($element.attr('data-delay')) delay = parseInt($element.attr('data-delay'), 0);
236					if (!$element.hasClass('animated')) {
237						setTimeout(function() {
238							$element.addClass('animated ' + $element.attr('data-animation'));
239						}, delay);
240					}
241					delay = 0;
242				}, {
243					offset: '95%'
244				});
245			});
246		}
247		
248	};
249	
250	// Run the main function
251	$(function() {
252		ShowApp.init();
253	});
254	
255})(window.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.