PageSourceSearch

https://grain-academy.com/assets/scripts/scripts.js?r=94

js grain-academy.com collected 2026-09-24 13:27:56 UTC 13,268 bytes, 378 lines download raw bytes

1(function ($) {
2	$(document).ready(function() {
3					   $('.mmhide').hide();
4					});
5					
6					
7		/*$('body').on('input', 'input', function(e){	
8			let cyrillic = $(this).val().split('').some(char => char.codePointAt(0) >= 0x0400 && char.codePointAt(0) <= 0x052f);
9			
10			if(cyrillic){
11				$(this).val($(this).val().replace(/[\u0400-\u04FF]/gi, ''))
12			}
13			
14		});*/
15				
16		 
17		var o = $('.phone_validate');
18		if (o.length > 0) {
19			$('body').on('input', '.phone_validate', function(e){
20				let value = $(this).val();
21				let numbersplus = value.replace(/[^0-9+]/g, "");
22				$(this).val(numbersplus);
23			});
24		}
25	
26	 if (window.innerWidth <= 768) {
27		 $('.parent_filter').removeClass('expand');
28	 }
29	
30	$('.styled-select select').SumoSelect();
31	
32	/*$(window).load(function() { */
33	  /*if ($('html').hasClass('desktop')) {
34		  $('#stuck_container').TMStickUp({
35		  })
36	  }*/  
37	  
38	  wrapEl();
39		dropDown();
40		
41	/*});*/
42	
43	
44	
45	function dropDown() 
46	{
47		
48		elementClick = '#header_assets .current';
49		elementSlide =  '.toogle_content';       
50		activeClass = 'active';			 
51
52		$(elementClick).on('click', function(e){
53			e.stopPropagation();
54			var subUl = $(this).next(elementSlide);
55			if(subUl.is(':hidden'))
56			{
57				subUl.slideDown();
58				$(this).addClass(activeClass);	
59			}
60			else
61			{
62				subUl.slideUp();
63				$(this).removeClass(activeClass);
64			}
65			$(elementClick).not(this).next(elementSlide).slideUp();
66			$(elementClick).not(this).removeClass(activeClass);
67			e.preventDefault();
68		});
69
70		$(elementSlide).on('click', function(e){
71			e.stopPropagation();
72		});
73
74		$(document).on('click', function(e){
75			e.stopPropagation();
76			if (e.which != 3)
77			{
78				var elementHide = $(elementClick).next(elementSlide);
79				$(elementHide).slideUp();
80				$(elementClick).removeClass('active');
81			}
82		});
83	}
84	
85	
86	
87	$(document).ready(function(){
88
89	/* roll over cart */
90	var cart_block = new HoverWatcher('#header .cart_block');
91	var shopping_cart = new HoverWatcher('#header .shopping_cart');
92	var is_touch_enabled = false;
93
94	if ('ontouchstart' in document.documentElement)
95		is_touch_enabled = true;
96
97		$(document).on('click', '#header .shopping_cart > a:first', function(e){
98			e.preventDefault();
99			e.stopPropagation();
100
101			// Simulate hover when browser says device is touch based
102			if (is_touch_enabled)
103			{
104				if ($(this).next('.cart_block:visible').length && !cart_block.isHoveringOver())
105					$("#header .cart_block").stop(true, true).slideUp(450);
106				else if (parseInt($('.ajax_cart_quantity').html()) > 0)
107					$("#header .cart_block").stop(true, true).slideDown(450);
108
109				return;
110			}
111			else
112				window.location.href = $(this).attr('href');
113		});
114
115		$("#header .shopping_cart a:first").hover(
116			function(){
117				if (parseInt($('.ajax_cart_quantity').html()) > 0)
118					$("#header .cart_block").stop(true, true).slideDown(450);
119			},
120			function(){
121				setTimeout(function(){
122					if (!shopping_cart.isHoveringOver() && !cart_block.isHoveringOver())
123						$("#header .cart_block").stop(true, true).slideUp(450);				
124				}, 200);
125			}
126		);
127
128		$("#header .cart_block").hover(
129			function(){
130			},
131			function(){
132				setTimeout(function(){
133					if (!shopping_cart.isHoveringOver())
134						$("#header .cart_block").stop(true, true).slideUp(450);
135				}, 200);
136			}
137		);
138		$("#header .isStuck .shopping_cart a:first").hover(
139			function(){
140				if (parseInt($('.ajax_cart_quantity').html()) > 0)
141					$("#header .isStuck .cart_block").stop(true, true).slideDown(450);
142			},
143			function(){
144				setTimeout(function(){
145					if (!shopping_cart.isHoveringOver() && !cart_block.isHoveringOver())
146						$("#header .isStuck .cart_block").stop(true, true).slideUp(450);				
147				}, 200);
148			}
149		);
150
151		$("#header .isStuck .cart_block").hover(
152			function(){
153			},
154			function(){
155				setTimeout(function(){
156					if (!shopping_cart.isHoveringOver())
157						$("#header .isStuck .cart_block").stop(true, true).slideUp(450);
158				}, 200);
159			}
160		);
161
162		
163	});
164
165
166	function HoverWatcher(selector)
167	{
168		this.hovering = false;
169		var self = this;
170
171		this.isHoveringOver = function(){
172			return self.hovering;
173		}
174
175		$(selector).hover(function(){
176			self.hovering = true;
177		}, function(){
178			self.hovering = false;
179		})
180	}
181	
182	function wrapEl(){
183		$( "table" ).each(function( index ) {
184			if(!$(this).hasClass('responsive')){
185				$(this).wrap('<div class="table_div"></div>');
186				if($(this).width()>$(window).width()){
187					$( "<div class='slide_icon generated_el'></div>" ).insertBefore( $(this).parent() );
188					$( "<div class='spacer10 generated_el'></div>" ).insertBefore( $(this).parent() );
189					$( "<div class='slide_icon generated_el'></div>" ).insertAfter( $(this).parent() );
190					$( "<div class='spacer10 generated_el'></div>" ).insertAfter( $(this).parent() );
191				}
192			}
193		});
194	}
195	
196	function checkEl(){
197		$('.generated_el').remove();
198		$( "table" ).each(function( index ) {
199			if(!$(this).hasClass('responsive')){
200				$(this).unwrap();
201			}
202		});
203		
204		wrapEl();
205	}
206	
207	$( window ).resize(function() {
208		checkEl();
209	});	
210	
211	
212	
213	
214		/* EqualHeights
215	 ========================================================*/
216		var o = $('.equal');
217		if (o.length > 0) {
218			$(document).ready(function () {
219				$('.equal').matchHeight();
220			});
221		}
222		
223		
224		
225	var o = $('#tabs');
226		if (o.length > 0) {
227			$(document).ready(function () {
228				$( "#tabs" ).tabs(); 
229			});
230		}
231		
232		
233		var o = $('.add_to_cart_list');
234	if (o.length > 0) {
235		$('.add_to_cart_list').click(function(){
236			if($(this).data('vid')>0){
237
238				var values = {};
239					values['qty'] = 1;		
240					values['variation_id'] = $(this).data('vid');
241					
242
243				
244				var offsetLeft = $(this).offset().left - $(this).closest('body').offset().left;
245				var offsetTop = $(this).offset().top - $(this).closest('body').offset().top;
246				var finoffsetLeft = $('.ajax_cart_quantity').offset().left - $(this).closest('body').offset().left;
247				var finsetTop = $('.ajax_cart_quantity').offset().top - $(this).closest('body').offset().top;
248				//var timeout = 10;
249				buyAnimation($(this).closest(".topoffer").find(".topofferpic img").attr('src'), offsetTop, offsetLeft, finsetTop, finoffsetLeft);
250				var timeout = 800;
251				
252				
253				setTimeout(function() {
254					
255					$.post(BASE_HREF+'bg/cart/addToCart', values, function(res){
256						$('.ajax_cart_quantity').html(res);	
257						$.get(BASE_HREF+LANGUAGE+'/cart/updateCartPreview', '', function(ress){
258							$(".cart_block").html(ress);
259						});
260					});
261				}, timeout);
262			}else {
263					//alert("ТРЯБВА ДА ИЗБЕРЕТЕ ДАТА")
264			}
265		});
266
267	}
268	
269	
270	var o = $('.btn-buy');
271	if (o.length > 0) {
272		$('.btn-buy').click(function(){
273			if($('#qty').val()>0){
274
275				var values = {};
276					values['qty'] = $('#qty').val();		
277					values['variation_id'] = $(this).data('vid');
278					//values['date'] = $('#date').val();
279					
280
281				
282				var offsetLeft = $(this).offset().left - $(this).closest('body').offset().left;
283				var offsetTop = $(this).offset().top - $(this).closest('body').offset().top;
284				var finoffsetLeft = $('.ajax_cart_quantity').offset().left - $(this).closest('body').offset().left;
285				var finsetTop = $('.ajax_cart_quantity').offset().top - $(this).closest('body').offset().top;
286				//var timeout = 10;
287				
288				buyAnimation($('.mainpic').attr('src'), offsetTop, offsetLeft, finsetTop, finoffsetLeft);
289				var timeout = 800;
290				
291				
292				setTimeout(function() {
293					
294					$.post(BASE_HREF+'bg/cart/addToCart', values, function(res){
295						$('.ajax_cart_quantity').html(res);	
296						$.get(BASE_HREF+LANGUAGE+'/cart/updateCartPreview', '', function(ress){
297							$(".cart_block").html(ress);
298						});
299					});
300				}, timeout);
301			}else {
302					//alert("ТРЯБВА ДА ИЗБЕРЕТЕ ДАТА")
303			}
304		});
305
306	}
307
308	var buyAnimation = function(img, top, left, fintop, finleft) {
309	  var top2 = top-10;
310	  var top3 = top+70;
311	  $('#animation').text('@keyframes gwd-gen-pm9ogwdanimation_animation { 0% { animation-timing-function: linear; left: '+left+'px; top: '+top+'px; transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); width: 50px; height: 50px; } 37.5% { animation-timing-function: linear; left: 700px; top: '+top2+'px; transform: matrix3d(0.9958049276, -0.0147082049, 0.0903117652, 0, -0.0747240242, 0.43892183, 0.8954
311127246, 0, -0.0528097191, -0.8984048619, 0.4359814649, 0, 36.7222510404, -0.5423937739, 3.3304226778, 1); width: 100px; height: 100px; } 62.5% { animation-timing-function: linear; left: 550px;; top: '+top3+'px; transform: matrix3d(0.9958049276, -0.0147082049, 0.0903117652, 0, -0.0878520156, -0.4296555981, 0.8987091245, 0, 0.0255845575, -0.9028730452, -0.4291453071, 0, 179.4266171105, -103.558374793, 5.6527440389, 1); width: 100px; height: 100px; } 100% { animation-timing-function: linear; left: '+finleft+'px; top:'+fintop+'px; transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); width: 0px; height: 0px; }} @-webkit-keyframes gwd-gen-pm9ogwdanimation_animation { 0% { -webkit-animation-timing-function: linear; left: '+left+'px; top: '+top+'px; -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); width: 50px; height: 50px; } 37.5% { -webkit-animation-timing-function: linear; left: 700px; top: '+top2+'px; -webkit-transform: matrix3d(0.9958049276, -0.0147082049, 0.0903117652, 0, -0.0747240242, 0.43892183, 0.8954
311127246, 0, -0.0528097191, -0.8984048619, 0.4359814649, 0, 36.7222510404, -0.5423937739, 3.3304226778, 1); width: 100px; height: 100px; } 62.5% { -webkit-animation-timing-function: linear; left: 550px;; top: '+top3+'px; -webkit-transform: matrix3d(0.9958049276, -0.0147082049, 0.0903117652, 0, -0.0878520156, -0.4296555981, 0.8987091245, 0, 0.0255845575, -0.9028730452, -0.4291453071, 0, 179.4266171105, -103.558374793, 5.6527440389, 1); width: 100px; height: 100px; } 100% { -webkit-animation-timing-function: linear; left: '+finleft+'px; top:'+fintop+'px; -webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); width: 0px; height: 0px; }} @-moz-keyframes gwd-gen-pm9ogwdanimation_animation { 0% { -moz-animation-timing-function: linear; left: '+left+'px; top: '+top+'px; -moz-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); width: 50px; height: 50px; } 37.5% { -moz-animation-timing-function: linear; left: 700px; top: '+top2+'px; -moz-transform: matrix3d(0.9958049276, -0.0147082049, 0.0903117652, 0, -0.0747240242, 0.43892183, 0.8954
311127246, 0, -0.0528097191, -0.8984048619, 0.4359814649, 0, 36.7222510404, -0.5423937739, 3.3304226778, 1); width: 100px; height: 100px; } 62.5% { -moz-animation-timing-function: linear; left: 550px;; top: '+top3+'px; -moz-transform: matrix3d(0.9958049276, -0.0147082049, 0.0903117652, 0, -0.0878520156, -0.4296555981, 0.8987091245, 0, 0.0255845575, -0.9028730452, -0.4291453071, 0, 179.4266171105, -103.558374793, 5.6527440389, 1); width: 100px; height: 100px; } 100% { -moz-animation-timing-function: linear; left: '+finleft+'px; top:'+fintop+'px; -moz-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); width: 0px; height: 0px; }}');  
312	  var environment$Config$ = {"id":"environment"};
313	  var environment = new rad.environment.Browser(environment$Config$);
314	  var $ad$$Config$ = {"environment":environment,"id":"$ad$"};
315	  var $ad$ = new rad.ad.RichMedia($ad$$Config$);
316	  var intropage1$Config$ = {"cssClass":"gwd-gen-oa91","elementCount":1,"id":"intropage1"};
317	  var intropage1 = new rad.animation.CSSAnimation(intropage1$Config$, $ad$);
318	  var page1$Config$ = {"introAnimationSequence":intropage1,"isDefault":true,"id":"page_anim"};
319	  var page1 = new rad.ui.Page(page1$Config$, $ad$);
320	  page1.setElement(document.querySelector('[data-gwd-component-id="page_anim"]'));
321	  var img20$Config$ = {"src":img,"id":"img20"};
322	  var img20 = new rad.ui.Image(img20$Config$, $ad$);
323	  img20.setElement(document.querySelector('[data-gwd-component-id="img20"]'));
324	  page1.addChild(img20,0);
325	  $ad$.addChild(page1);
326	  $ad$.init();
327	};
328	
329	var o = $('.favorite');
330	if (o.length > 0) {
331		$('body').on('click', '.btn-add', function (e) {
332			var values = {};
333				values['variation_id'] = $(this).data('vid');		
334				values['favorite'] = 1;		
335				console.log(values);
336			that = $(this);
337			
338			$.post(BASE_HREF+LANGUAGE+'/ajax/favorite', values, function(res){
339				if(res){
340					that.removeClass('btn-add');
341					that.addClass('btn-added');
342					if ($('.favorite span').length > 0) {
343						$('.favorite span').html(PRODUCT_ADDED_TO_FAVORITES);
344					}	
345					$('.favorite i').attr('title', PRODUCT_ADDED_TO_FAVORITES);
346					
347					$('.favorites_quantity').html(parseInt($('.favorites_quantity').html())+1);
348					
349				} else {
350					alert(MUST_LOGGED)
351				}
352			});
353		});
354
355		$('body').on('click', '.btn-added', function (e) {
356			var values = {};
357				values['variation_id'] = $(this).data('vid');		
358				values['favorite'] = 0;		
359			that = $(this);
360
361			$.post(BASE_HREF+LANGUAGE+'/ajax/favorite', values, function(res){
362				if(res){
363					that.removeClass('btn-added');
364					that.addClass('btn-add');
365					if ($('.favorite span').length > 0) {
366						$('.favorite span').html(PRODUCT_ADD_TO_FAVORITES);
367					}	
368					$('.favorite i').attr('title', PRODUCT_ADD_TO_FAVORITES);
369					$('.favorites_quantity').html(parseInt($('.favorites_quantity').html())-1);
370				}
371			});
372		});	
373	}		
374	
375	
376	
377})(jQuery);
378

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.