PageSourceSearch

https://a-prizvanie.ru/wp-content/themes/richer/framework/js/functions.js?ver=1.0

js a-prizvanie.ru collected 2026-10-06 09:01:46 UTC 12,726 bytes, 347 lines download raw bytes

1/* ------------------------------------------------------------------------ */
2/* Javascripts
3/* ------------------------------------------------------------------------ */
4function home_parallax() {
5	"use strict";
6    jQuery(window).scroll(function() {
7        var coords, yPos = -(jQuery(window).scrollTop() / 2); 
8         
9        // Put together our final background position
10        coords = 'center '+ yPos + 'px !important';
11
12        // Move the background
13        //$('.page-title-wrapper').css({ backgroundPosition: coords });
14        jQuery('.parallax-bg').css({ backgroundPosition: coords });
15    
16    }); 
17}
18function header_size()
19{
20    var win	            = jQuery(window),
21        header          = jQuery('#fixed_header'),
22        dropdown_menu	= jQuery('#header:not(.fixed_header) #navigation ul.menu > li .sub-menu'),
23        dropdown_elem	= jQuery('#header:not(.fixed_header) #navigation .cart-contents, #header:not(.fixed_header) #navigation .search-area'),
24        elements        = jQuery('#fixed_header .my-table, #fixed_header .menu > li'),
25        el_height       = jQuery(elements).filter(':first').height(),
26        isMobile        = function() {
27        	var windowWidth = window.screen.width < window.outerWidth ? window.screen.width : window.outerWidth;
28			if( (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) || windowWidth < 768 ){
29				return true;
30			} else {
31				return false;
32			}
33		},
34        scroll_top		= jQuery('#scroll-top-link'),
35        logo_height		= jQuery('.logo a img').filter(':first').height(),
36        set_height      = function()
37        {
38            var st = win.scrollTop(), newH = 0, newLH=0;
39
40            if(st < el_height)
41            {
42                newH = el_height/2;
43                header.removeClass('header-scrolled');
44
45            } else {
46                newH = el_height/2;
47                if(!dropdown_menu.is(':visible'))
48                	header.addClass('header-scrolled');
49               	if(dropdown_elem.is(':visible'))
50                	dropdown_elem.hide();
51            }
52            elements.css({height: newH + 'px'});
53        }
54        
55    	if(!header.length) return false;
56        if(isMobile())
57        {
58            return false;
59        }
60        win.scroll(set_height);
61        set_height();
62}
63
64function set_slider_effect (slider)
65{
66    var win = jQuery(window);
67    el_height  = jQuery(slider).height();
68    var st = win.scrollTop(), newH = 0, newBg = 0;
69    if(st > 0)
70    {
71        newH = el_height - st;
72        newBg = 0.3*st;
73        jQuery(slider).css({'overflow':'hidden'});
74        jQuery(slider).children("div:first").find('.slotholder div').css({'top':newBg+'px'});
75    } else {
76    	jQuery(slider).children("div:first").find('.slotholder div').css({'top':'0px'});
77    }
78}					
79jQuery(document).ready(function($){
80	var regMob = /ipod|ipad|iphone/gi,
81	resMob = navigator.userAgent.match(regMob);
82	if(!resMob) {
83		home_parallax();
84	}
85
86	header_size();
87
88	$('#header a[href*="#"]:not([href="#"]), #fixed_header a[href*="#"]:not([href="#"]), a.button[href*="#"]:not([href="#"])').click(function() {
89	    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
90	      var target = $(this.hash);
91	      target = target.length ? target : $('[id=' + this.hash.slice(1) +']');
92	      if (target.length) {
93	      	$tmp = $('#fixed_header');
94	        if ($.contains(document, $tmp[0])) {
95			    $('html,body').animate({
96		          scrollTop: target.offset().top - ($('#fixed_header').height() + $('#wpadminbar').height())
97		        }, 900);
98			} else {
99				$('html,body').animate({
100		          scrollTop: target.offset().top - ($('#header:not(.fixed_header)').height() + $('#wpadminbar').height())
101		        }, 900);
102			}
103	        
104	        return false;
105	      }
106	    }
107	});
108	$(window).load(function(){
109		// Remove the # from the hash, as different browsers may or may not include it
110		var hash = location.hash
111		var myId = hash.split('#');
112		if(hash != ''){
113			$tmp = $('#fixed_header');
114	        if ($.contains(document, $tmp[0])) {
115			    $('html,body').animate({
116		          scrollTop: $('#'+myId[1]).offset().top - ($('#fixed_header').height() + $('#wpadminbar').height())
117		        }, 700);
118			} else {
119				$('html,body').animate({
120		          scrollTop: $('#'+myId[1]).offset().top - ($('#header:not(.fixed_header)').height() + $('#wpadminbar').height())
121		        }, 700);
122			}
123		}
124	});
125	var drag_fw = $('#flexslider-portfolio');
126	  var drag_start, drag_end;
127	  drag_fw.mousedown(function(e){
128	    drag_start = e.pageX;
129	    drag_fw.addClass('dragging');
130	    return drag_start;
131	  });
132	  drag_fw.mouseup(function(e){
133	    drag_fw.removeClass('dragging');
134	  });
135	  drag_fw.mousemove(function(e){
136	    if (drag_fw.hasClass('dragging')) {
137	      if(drag_start - e.pageX < -100) {
138	            drag_fw.flexslider('prev')
139	    drag_fw.removeClass('dragging');
140	      } else if (drag_start - e.pageX > 100) {
141	            drag_fw.flexslider('next')
142	    drag_fw.removeClass('dragging');
143	      }
144	    }
145	  });
146
147	/* ------------------------------------------------------------------------ */
148	/* Top bar sliding */
149	/* ------------------------------------------------------------------------ */
150	
151	if( $(".toparea-content").hasClass('active') ){
152		$(".toparea-content").show();
153		$(".toparea-sb").find('i.fa').removeClass('fa-plus').addClass('fa-minus');
154	}
155
156	$(".toparea-sb").click(function(){
157		if( $(".toparea-content").hasClass('active') ){
158			$(".toparea-content").removeClass("active").slideUp(200);
159			$(this).find('i.fa').removeClass('fa-minus').addClass('fa-plus');
160		}
161		else{
162			$(".toparea-content").addClass("active").slideDown(300);
163			$(this).find('i.fa').removeClass('fa-plus').addClass('fa-minus');
164		}
165	});
166     // Clear Input Fields value
167	 $('input[type=text]').each(function() {
168		var default_value = this.value;
169		$(this).focus(function(){
170		   if(this.value == default_value) {
171		           this.value = '';
172		   }
173		});
174		$(this).blur(function(){
175		       if(this.value == '') {
176		               this.value = default_value;
177		       }
178		});
179	});
180	
181	jQuery('.sidenav .children').parent('li').addClass('parent');
182	jQuery('.sidenav li.parent:not(.current_page_parent)').hover(
183		function(){jQuery(this).find('.children').stop().slideDown('normal');},
184		function(){jQuery(this).find('.children').stop().slideUp('fast');
185	});
186	/* ------------------------------------------------------------------------ */
187	/* Image Hovers */
188	/* ------------------------------------------------------------------------ */
189
190	$(".post-image a, .post-gallery a, #portfolio-slider li a, .portfolio-image a").hover(function(){
191		$(this).has('img').append('<div class="overlay"></div>').stop();
192		$(this).find('.overlay').stop().animate({opacity : '1'}, 300);
193	}, function(){
194		$(this).find('.overlay').animate({opacity : '0'}, 300).remove();
195	});
196
197	$('.blog-item').hover(function() {
198		$(this).find('.blog-overlay').stop().animate({'opacity' : 1}, 200, 'easeOutSine');
199		$(this).find('.post-icon').stop().animate({'top' : 50, 'opacity' : 1}, 160, 'easeOutSine');
200	}, function(){
201		$(this).find('.blog-overlay').stop().animate({'opacity' : 0}, 300, 'easeInSine');
202		$(this).find('.post-icon').stop().animate({'top' : -25, 'opacity' : 0}, 260, 'easeOutSine');
203	});
204
205	jQuery('a.add_to_cart_button:not(.product_type_variable)').click(function(e) {
206		var link = this;
207		jQuery(link).parents('li.product').find('.cart-loading').find('i').removeClass('fa-check').addClass('fa-spinner fa-spin');
208		jQuery(this).parents('li.product').find('.cart-loading').fadeIn();
209		setTimeout(function(){
210			jQuery(link).parents('li.product').find('.product-images img').animate({opacity: 0.75});
211			jQuery(link).parents('li.product').find('.cart-loading').find('i').hide().removeClass('fa-spinner fa-spin').addClass('fa-check').fadeIn();
212			setTimeout(function(){
213				jQuery(link).parents('li.product').find('.cart-loading').fadeOut().parents('li.product').find('.product-images img').animate({opacity: 1},200);
214			},1000);
215		}, 1000)
216			
217		
218	});	
219	
220	jQuery('li.product').hover(
221		function() {if(jQuery(this).find('.cart-loading').find('i').hasClass('fa-check')) {jQuery(this).find('.cart-loading').stop().fadeIn()} },
222		function() {if(jQuery(this).find('.cart-loading').find('i').hasClass('fa-check')) {jQuery(this).find('.cart-loading').stop().fadeOut()} }
223	);
224
225	/* ------------------------------------------------------------------------ */
226	/* Back To Top */
227	/* ------------------------------------------------------------------------ */
228
229	$(window).scroll(function(){
230		if($(window).scrollTop() > 200){
231			$("#back-to-top").fadeIn(200);
232		} else{
233			$("#back-to-top").fadeOut(200);
234		}
235	});
236	
237	$('#back-to-top, .back-to-top').click(function() {
238		  $('html, body').animate({ scrollTop:0 }, '800');
239		  return false;
240	});
241
242	$('.toggleMenu').click(function(){
243		$(this).children('i.fa').toggleClass('fa-bars fa-times');
244		$('.side-navigation-overlay').toggleClass('show');
245		$('aside.side-navigation.side-navigation-toggle .navbar-menu').toggleClass('show');
246	});
247	$(document).on('click touchstart', '.side-navigation-overlay', function(){
248		$(this).removeClass('show');
249		$('.toggleMenu i.fa').toggleClass('fa-bars fa-times');
250		$('aside.side-navigation.side-navigation-toggle .navbar-menu').removeClass('show');
251	});
252	$(window).resize(function(){
253		$('.side-navigation-overlay').removeClass('show');
254		$('.toggleMenu i.fa').addClass('fa-bars').removeClass('fa-times');
255		$('aside.side-navigation.side-navigation-toggle .navbar-menu').removeClass('show');
256	});
257	/*$('#side-nav-toggle li').hover(
258	function(){
259		if($(this).find(' > .sub-menu').is(':hidden')) {
260			$(this).find(' > .sub-menu').stop().slideDown('normal');
261		}
262	},
263	function(){$(this).find(' > .sub-menu').stop().delay(500).slideUp('normal');}
264	);*/
265	$('#side-nav-toggle li').hover(
266	  function () {
267	     $(this).children('ul.sub-menu').stop(true,true).delay(300).slideDown('medium');
268	  }, 
269	  function () {
270	     $(this).children('ul.sub-menu').stop(true,true).delay(800).slideUp('medium');
271	  }
272	);
273	
274	// Quantity buttons
275	$("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass('buttons_added').append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');
276	
277	// Target quantity inputs on product pages
278	$("input.qty:not(.product-quantity input.qty)").each(function(){
279		
280		var min = parseInt($(this).attr('data-min'));
281		
282		if (min && min > 1 && parseInt($(this).val()) < min) {
283			$(this).val(min);
284		}
285		
286	});
287	
288	$(".plus").live('click', function() {
289	    var currentVal = parseInt($(this).prev(".qty").val());
290	    if (!currentVal || currentVal=="" || currentVal == "NaN") currentVal = 0;
291	    
292	    $qty = $(this).prev(".qty");
293	    
294	    var max = parseInt($qty.attr('data-max'));
295	    if (max=="" || max == "NaN") max = '';
296	    
297	    if (max && (max==currentVal || currentVal>max)) {
298	    	$qty.val(max); 
299	    } else {
300	    	$qty.val(currentVal + 1); 
301	    }
302	    
303	    $qty.trigger('change');
304	});
305	
306	$(".minus").live('click', function() {
307		var currentVal = parseInt($(this).next(".qty").val());
308	    if (!currentVal || currentVal=="" || currentVal == "NaN") currentVal = 0;
309	    
310	    $qty = $(this).next(".qty");
311	    
312	    var min = parseInt($qty.attr('data-min'));
313	    if (min=="" || min == "NaN") min = 0;
314	    
315	    if (min && (min==currentVal || currentVal<min)) {
316	    	$qty.val(min); 
317	    } else if (currentVal > 0) {
318	    	$qty.val(currentVal - 1);
319	    }
320	    
321	    $qty.trigger('change');
322	});
323	/* ------------------------------------------------------------------------ */
324});
325jQuery(document).ready(function(e) {
326	jQuery(document).click(function() {
327        jQuery(".search-link .search-area").fadeOut('fast');
328        jQuery('li.cart, li.cart-main').find('> div').stop().fadeOut('fast');
329    });
330    jQuery(".search-link .search-area, .cart-contents, .cart-empty").click(function (e) {
331        e.stopPropagation();
332        //do redirect or any other action on the content
333    });    
334    jQuery(".search-link a").click(function(e) {
335        e.stopPropagation();
336        jQuery('li.cart, li.cart-main').find('> div').stop().fadeOut('fast');
337        jQuery(this).next().stop().fadeIn('fast');
338    });
339    jQuery("li.cart, li.cart-main").click(function(e) {
340        e.stopPropagation();
341        jQuery(".search-link .search-area").fadeOut('fast');
342        jQuery(this).find('> div').stop().fadeIn('fast');
343    });
344});
345/* ------------------------------------------------------------------------ */
346/* EOF
347/* ------------------------------------------------------------------------ */

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.