PageSourceSearch

https://www.carengineering.ru/catalog/view/javascript/gen.js

js carengineering.ru collected 2026-10-07 16:43:25 UTC 9,615 bytes, 353 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function() {
2    var lazyloadImages = document.querySelectorAll("img.lazy");
3    var lazyloadThrottleTimeout;
4
5    function lazyload () {
6        if(lazyloadThrottleTimeout) {
7            clearTimeout(lazyloadThrottleTimeout);
8        }
9
10        lazyloadThrottleTimeout = setTimeout(function() {
11            var scrollTop = window.pageYOffset;
12            lazyloadImages.forEach(function(img) {
13                if(img.offsetTop < (window.innerHeight + scrollTop)) {
14                    img.src = img.dataset.src;
15                    img.classList.remove('lazy');
16                }
17            });
18            if(lazyloadImages.length == 0) {
19                document.removeEventListener("scroll", lazyload);
20                window.removeEventListener("resize", lazyload);
21                window.removeEventListener("orientationChange", lazyload);
22            }
23        }, 20);
24    }
25
26    document.addEventListener("scroll", lazyload);
27    window.addEventListener("resize", lazyload);
28    window.addEventListener("orientationChange", lazyload);
29});
30
31
32var icon = $('.show_menu');
33 	$(".show_menu").click(function(){
34	  if ( $(".mobi_top_menu_box, body").hasClass("open")) {
35      	 $(".mobi_top_menu_box, body").removeClass("open");
36      }else{
37
38         $(".mobi_top_menu_box, body").addClass("open");
39
40      }
41});
42
43var icon = $('.show_cat');
44 	$(".show_cat").click(function(){
45	  if ( $(".box_mobi_catalog, body").hasClass("open")) {
46      	 $(".box_mobi_catalog, body").removeClass("open");
47      }else{
48
49         $(".box_mobi_catalog, body").addClass("open");
50
51      }
52});
53
54var icon = $('.open_close');
55 	$(".open_close, .search_close").click(function(){
56	  if ( $("#search, body").hasClass("open")) {
57      	 $("#search, body").removeClass("open");
58      }else{
59
60         $("#search, body").addClass("open");
61
62      }
63});
64
65
66// if($('.mobile .category_menu').length){
67//   $('.mobile .category_menu .category-link.active').click(function(){
68//     $('.box_menu_pro_seo_page .box.category_menu .box-category > ul > li').slideToggle();
69//     return false;
70//   })
71// }
72
73function display(view) {
74	if (view == 'list') {
75		$('.product-grid ').attr('class', 'product-list');
76
77		$('.product-list ul li').each(function(index, element) {
78			html  = '<div class="right">';
79
80			html += '  <div class="cart">' + $(element).find('.cart').html() + '</div>';
81
82			html += '</div>';
83
84			html += '<div class="left">';
85			html += '  <div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
86			var image = $(element).find('.image').html();
87
88			if (image != null) {
89				html += '<div class="image">' + image + '</div>';
90			}
91
92			html += '<div class="ico_box">' + $(element).find('.ico_box').html() + '</div>';
93			html += '<div class="attrib">' + $(element).find('.attrib').html() + '</div>';
94
95
96			html += '  <div class="price">' + $(element).find('.price').html() + '</div>';
97
98
99
100			html += '  <div class="name">' + $(element).find('.name').html() + '</div>';
101			html += '  <div class="description">' + $(element).find('.description').html() + '</div>';
102
103
104
105
106
107
108			html += '</div>';
109
110
111			$(element).html(html);
112		});
113
114		$('.display').html('<div id="list_b"></div> <a id="grid_a" onclick="display(\'grid\');"></a>');
115
116		$.cookie('display', 'list');
117	} else {
118		$('.product-list').attr('class', 'product-grid');
119
120		$('.product-grid ul li').each(function(index, element) {
121			html = '';
122			var image = $(element).find('.image').html();
123
124			if (image != null) {
125				html += '<div class="image">' + image + '</div>';
126			}
127
128			html += '<div class="ico_box">' + $(element).find('.ico_box').html() + '</div>';
129			html += '<div class="attrib">' + $(element).find('.attrib').html() + '</div>';
130
131			var price = $(element).find('.price').html();
132
133			if (price != null) {
134				html += '<div class="price">' + price;
135        html += '  <div class="wishlist">' + $(element).find('.wishlist').html() + '</div>';
136        html += '</div>';
137			}
138
139
140
141		html += '<div class="name">' + $(element).find('.name').html() + '</div>';
142
143
144		html += '<div class="description">' + $(element).find('.description').html() + '</div>';
145
146
147
148
149			html += '<div class="cart">' + $(element).find('.cart').html() + '</div>';
150
151			$(element).html(html);
152		});
153
154		$('.display').html('<a id="list_a" onclick="display(\'list\');"></a>  <div id="grid_b"></div>');
155
156		$.cookie('display', 'grid');
157	}
158}
159
160view = $.cookie('display');
161
162if (view) {
163	display(view);
164} else {
165	display('list');
166}
167
168
169if($('.our-works-slider ul').length){
170  $('.our-works-slider ul').slick({
171    slidesToShow: 2,
172    // variableWidth: true,
173    slidesToScroll: 1,
174    prevArrow:'<button class="slick-prev slick-arrow" aria-label="Previous" type="button" style=""></button>',
175    nextArrow:'<button class="slick-next slick-arrow" aria-label="Next" type="button" style=""></button>',
176    responsive: [
177      {
178        breakpoint: 1160,
179        settings: {
180          slidesToShow: 1,
181        }
182      }
183    ]
184  });
185}
186if($('#scroller_about1 ul').length){
187  $('#scroller_about1 ul').slick({
188    slidesToShow: 1,
189    // variableWidth: true,
190    slidesToScroll: 1,
191    prevArrow:'<button class="slick-prev slick-arrow" aria-label="Previous" type="button" style=""></button>',
192    nextArrow:'<button class="slick-next slick-arrow" aria-label="Next" type="button" style=""></button>',
193  });
194}
195if($('#scroller_about2 ul').length){
196  $('#scroller_about2 ul').slick({
197    // slidesToShow: 3,
198    variableWidth: true,
199    slidesToScroll: 1,
200    prevArrow:'<button class="slick-prev slick-arrow" aria-label="Previous" type="button" style=""></button>',
201    nextArrow:'<button class="slick-next slick-arrow" aria-label="Next" type="button" style=""></button>',
202  });
203}
204if($('#scroller_about3 ul').length){
205  $('#scroller_about3 ul').slick({
206    // slidesToShow: 3,
207    variableWidth: true,
208    slidesToScroll: 1,
209    prevArrow:'<button class="slick-prev slick-arrow" aria-label="Previous" type="button" style=""></button>',
210    nextArrow:'<button class="slick-next slick-arrow" aria-label="Next" type="button" style=""></button>',
211  });
212}
213
214
215
216if($('.tab-content').length){
217  $('.htabs a').click(function(){
218    $('.htabs a').removeClass('selected');
219    $(this).addClass('selected');
220    let h = $(this).attr('href');
221    $('.tab-content').hide();
222    $('.tab-content' + h).show();
223    return false;
224  })
225}
226
227/*Detailing start*/
228if($('.det-item-more').length){
229  $('.det-item-more').click(function(){
230    $(this).parent('.det-item-btn').prev('.det-item-content').toggleClass('show');
231  })
232}
233if($('.pt-all').length){
234  $('.pt-all').click(function(){
235    $('.price-table.hidden').slideDown();
236    $(this).remove();
237  })
238}
239if($('.pt-link').length){
240  $('.pt-link').click(function(){
241    let d = $(this).data('link');
242    if($('.' + d).css('display') == 'block'){
243      $('.pt-text').hide();
244    } else{
245      $('.pt-text').hide();
246      $('.' + d).toggle();
247    }
248  })
249
250  $('.pt-text-close').click(function(){
251    $('.pt-text').hide();
252  })
253
254}
255
256
257/*Detailing end*/
258
259function addToWishList(product_id) {
260	$.ajax({
261		url: 'index.php?route=account/wishlist/add',
262		type: 'post',
263		data: 'product_id=' + product_id,
264		dataType: 'json',
265		success: function(json) {
266			$('.success, .warning, .attention, .information').remove();
267
268			if (json['success']) {
269				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<span class="close-span" onclick="modalClose()"></span></div>');
270
271				$('.success').fadeIn('slow');
272
273				$('#wishlist-total').html(json['total']);
274
275			}
276		}
277	});
278}
279
280function modalClose(){
281  $('.success').fadeOut('slow');
282}
283
284
285
286if($('.jcarousel').length){
287	$('.jcarousel ul').slick({
288		slidesToShow: 1,
289		slidesToScroll: 1,
290		prevArrow:'<button class="slick-prev slick-arrow" aria-label="Previous" type="button" id="cl"></button>',
291		nextArrow:'<button class="slick-next slick-arrow" aria-label="Next" type="button"></button>'
292	});
293
294}
295
296function goToReviews()
297{
298  $('.htabs a[href="#tab-review"]').click();
299  let scrollTo = $('#tabs');
300  let position = scrollTo.offset().top;
301  $('html, body').animate({
302    scrollTop: position
303  }, 500, function(){
304    window.location.hash = '#tabs';
305  });
306  return false;
307}
308
309
310if($('.description').length && $('.box_fixed_desk_price').length){
311  var blockTop = $('.box_fixed_desk_price').offset().top;
312  scrollCartBlock();
313  $(window).on('scroll', function(){
314    scrollCartBlock();
315  })
316  
317  function scrollCartBlock(){
318    if($('.description').length && $('.box_fixed_desk_price').length){
319      let top = $(window).scrollTop();
320      if(top > blockTop){
321        $('.box_fixed_desk_price:not(.fixed)').addClass('fixed');
322      } else{
323        $('.box_fixed_desk_price.fixed').removeClass('fixed');
324      }
325    }
326  }
327
328}
329
330
331if($('.description').length && $('.mobi_price_row').length){
332  var blockTop = $('.mobi_price_row').offset().top;
333  scrollCartBlock();
334  $(window).on('scroll', function(){
335    scrollCartBlock();
336  })
337  
338  function scrollCartBlock(){
339    if($('.description').length && $('.mobi_price_row').length){
340      let top = $(window).scrollTop();
341      if(top > blockTop){
342        $('.mobi_price_row:not(.fixed)').addClass('fixed');
343      } else{
344        $('.mobi_price_row.fixed').removeClass('fixed');
345      }
346    }
347  }
348
349}
350
351
352
353

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.