PageSourceSearch

https://assettocorsa.club/assets/template/js/scripts-new-4.js?v=1.6

js assettocorsa.club collected 2026-10-03 22:59:36 UTC 6,970 bytes, 245 lines download raw bytes

1$(document).ready(function() {
2
3  $('a.source:not([href*="http"])').hide(); /* Убираем пустые ссылки на ресурсы */
4  
5  $(".item > span").each(function() {  /* Добавляем 0, если в рейтинге пусто */
6      if ($(this).html() == "") {
7        $(this).html(0);
8      }
9    });
10  
11  /* Фильтры */
12  
13  var allContent = $('.items').html(); /* Все в переменной */  
14  
15  function filter(x) {   
16    $('div.item').filter(function (){ return !this.querySelector('img[alt="' + x + '"]') }).hide();
17  }
18  
19  function filterInterface() { /* Убираем заголовки, оглавление, фон кнопок сортировки и отображаем клавишу очистки */
20    $('.items h2').hide();
21    $('.left span.close').css('display', 'inline-block');
22    $('ul.contents').hide();    
23    $('.sort span').css('background-color', '#fff');
24  }
25  
26  $('.filter img').click(function() { /* Запускаем фильтр */
27    var fliteratr = $(this).attr('alt');
28    $(this).css('background-color', '#eee');
29    if ($(this).parent().attr('class') !== "multiple") {
30      $(this).siblings().hide();
31    }
32    filterInterface();
33    filter(fliteratr);
34    if ($('.items').css('height') == '0px') {
35      $('.no-results').show();
36    }
37  });
38   
39  $('body').click(function(e){
40    if ($(e.target).hasClass('close')) {
41    /* Возвращаем все на свои места нажатием clear */
42    $('.close').hide();    
43    $('.filter img').show();
44    $('.filter img').css('background', 'none');
45    $('.sort span').css('background-color', '#fff');
46    $('.items').empty().append(allContent);
47    $('ul.contents').show();
48    }
49  });
50 
51  $('.sort span.sort-az').click(function() {  
52    filterInterface();
53    $(this).css('background-color', '#E0E0E0');
54    sortAZ();
55   });
56 
57  $('.sort span.sort-rating').click(function() {
58    filterInterface();
59    $(this).css('background-color', '#E0E0E0');
60    sortRating();
61   });
62
63  $('.sort span.sort-hotlap').click(function() {
64    filterInterface();
65    $(this).css('background-color', '#E0E0E0');
66    sortHotlap();
67   });   
68 
69  function sortAZ() {
70    $('.item > div > h4').sort(function (a, b){ return a.textContent > b.textContent ? 1 : -1 }).each(function (){ $('.items')[0].appendChild(this.parentNode.parentNode) });
71  }
72
73  function sortRating() {
74    $('.item > span').sort(function (a, b){ return +a.textContent < +b.textContent ? 1 : -1 }).each(function (){ $('.items')[0].appendChild(this.parentNode) });
75  }
76  
77  function sortHotlap() {       
78    var emptyHotlaps = $('.item:has(span.hotlap:contains("--"))').detach();  
79    var soonHotlaps = $('.item:has(span.hotlap:contains("soon"))').detach();
80    $('.item span.hotlap').sort(function (a,b){a=a.textContent.split(/\D+/);b=b.textContent.split(/\D+/);for(var i=0,q;a[i]&&b[i];i++)if(q=+a[i]-+b[i])return q}).each(function (){ $('.items')[0].appendChild(this.parentNode.parentNode.parentNode.parentNode) });
81    $('.items').append(soonHotlaps);
82    $('.items').append(emptyHotlaps);
83  }
84    
85  /* Содержание */
86  
87  $('a[href^="#"]').on('click', function(event) {
88
89      var target = $( $(this).attr('href') );
90
91      if( target.length ) {
92          event.preventDefault();
93          $('html, body').animate({
94              scrollTop: target.offset().top
95          }, 600);
96      }
97
98  });
99  
100  /* Фиксирование меню */
101  
102  var h_hght = 45; // высота шапки
103  var h_mrg = 0;    // отступ когда шапка уже не видна
104  $(function(){
105   $(window).scroll(function(){
106      var top = $(this).scrollTop();
107      var elem = $('.left');
108      if (top+h_mrg < h_hght) {
109       elem.css('top', (h_hght-top));
110      } else {
111       elem.css('top', h_mrg);
112      }
113    });
114  });
115
116  /* Видео в галерее */
117  
118  if ($('div.gallery').is(':has(iframe)')) {
119    var videoGallery = $('.gallery iframe');
120    $('.gallery iframe').detach();
121    
122    $('#nav-thumbnails img.thumbnail-image:last').attr('src', 'assets/template/images/decor/play-back-active.png');
123    $('#nav-buttons a.gallery-button:last').attr('id', 'play-gallery');    
124    
125      
126    $('#nav-buttons a.gallery-button:not([id="play-gallery"])').click(function() {
127      $('.gallery iframe').detach();
128    });
129    }
130  
131  $('#play-gallery').click(function() {
132    $('.gallery').append(videoGallery);
133    $('.gallery-view img').attr('src', 'assets/template/images/decor/pre-video.jpg');
134    
135    
136  });
137  
138  /* Кнопка яндекс */
139  
140  $('#yandex-many img').click(function() {
141    $('#yandex-many div').fadeToggle(300);
142  });
143  
144  
145  
146  
147  
148  /* Лайк */
149  
150  $("span.like-min").each(function() {
151    if ($(this).html() == "") {
152      $(this).html(0);
153    }
154  });
155  
156  
157  /* Увелинение картинок */
158  
159  $('.cm-img img').click(function() {
160    var a = $(this).attr('src');
161    a = a.replace(/([0-9])/, '$1b');
162    $('.lic-big').fadeIn(300).append('<img src="' + a + '" alt="">');
163  });
164  
165  $('.lic-big').click(function() {
166    $(this).fadeOut(300);
167    $('.lic-big img').remove();
168  });
169  
170  
171  /* Кнопка donate */
172  
173  $('div.donate').click(function() {
174    $('div.donate > div').fadeToggle(100);
175  });
176  
177  /* Google Disk */
178  
179  /* $('[href*="drive.google.com/file/d/"]').each(function (){ 
180  if (/\/d\/(\w+)/.test(this.href)) this.href = 'https://drive.google.com/uc?export=download&id=' + RegExp.$1;
181  });  */
182  
183    /* Дрифт Меню */
184  
185  $('#dstreet').click(function() {
186    $(this).children('span').toggle();
187    $('.dstreet').toggle();
188  });
189  
190  $('#dsemi').click(function() {
191    $(this).children('span').toggle();
192    $('.dsemi').toggle();
193  });
194
195  $('#dpro').click(function() {
196    $(this).children('span').toggle();
197    $('.dpro').toggle();
198  });
199  
200  
201  /* слайдер в меню */
202  
203  var interval;
204   
205  
206  function startSlider() {    
207    stopSlider()
208    interval = setInterval(function() {
209        slider_right();
210      }, 	
211      3000
212    );
213  }
214  
215  function stopSlider()	{
216	  window.clearInterval(interval);
217  }   
218  
219  window.onblur = stopSlider;
220	window.onfocus = startSlider;
221	startSlider();
222  
223  var counts = 1;
224  
225  function slider_right() {
226    if (counts < 3) {
227      $('.items-ds .ditem img:nth-child(' + counts + ')').fadeOut(300).next().fadeIn(300);
228      counts += 1;      
229    }      
230    else {
231      $('.items-ds .ditem img:nth-child(' + counts + ')').fadeOut(300);
232      $('.items-ds .ditem img:nth-child(1)').fadeIn(300);
233      counts = 1;
234    }    
235  }
236  
237  
238  /*if (!localStorage.accAbTest) localStorage.accAbTest=Math.random();	
239	if (+localStorage.accAbTest < 0.7) {
240		$('#stripe').hide();
241  }*/
242  
243});
244
245  

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.