1 2 3$(function () { 4 5 $('.showPopupForm').click(function () { 6 var title = $(document).prop('title'); 7 var url = window.location.href; 8 var subj = $(this).attr('id'); 9 var promoId = $(this).data('promo'); 10 var formTitle = $(this).data('title'); 11 var note = $(this).data('note'); 12 var action = $(this).data('action'); 13 14 $(this).prop('disabled', true).addClass('loading'); 15 16 $.ajax({ 17 url: '/moto/form/getPopupForm/', 18 type: 'post', 19 data: { 20 'title': title, 21 'url': url, 22 'promoId': promoId, 23 'subj': subj, 24 'formTitle': formTitle, 25 'note': note, 26 'action': action, 27 }, 28 success: function (data) { 29 if (!$('#request').length) { 30 $('body').append(data); 31 $('#request').fadeIn(200); 32 } 33 34 var fancybox = function () { 35 36 $.fancybox.open({ 37 src: '#request', 38 touch: false, 39 backFocus: false, 40 beforeClose: function () { 41 $('.showPopupForm').prop('disabled', false).removeClass('loading'); 42 43 }, 44 afterClose: function () { 45 $('#request, #fancyboxId, #phoneMaskId').remove(); 46 } 47 }); 48 49 } 50 loadScript("/static/libs/jquery.fancybox.min.js", fancybox, id = "fancyboxId"); 51 52 var phoneMask = function () { 53 var listCountries = $.masksSort($.masksLoad("/static/libs/data/phone-codes.json"), ['#'], /[0-9]|#/, "mask"); 54 var maskOpts = { 55 inputmask: { 56 definitions: { 57 '#': { 58 validator: "[0-9]", 59 cardinality: 1 60 } 61 }, 62 showMaskOnHover: false, 63 autoUnmask: true, 64 clearMaskOnLostFocus: false 65 }, 66 match: /[0-9]/, 67 replace: '#', 68 listKey: "mask" 69 }; 70 var maskChangeWorld = function (maskObj, determined) { 71 if (determined) { 72 var hint = maskObj.name_ru; 73 if (maskObj.desc_ru && maskObj.desc_ru != "") { 74 hint += " (" + maskObj.desc_ru + ")"; 75 } 76 $("#country").html(hint); 77 } else { 78 $("#country").html("СÑÑана"); 79 } 80 } 81 $('.phone-mask').keyup(function () { 82 $(this).inputmasks($.extend(true, {}, maskOpts, { 83 list: listCountries 84 })); 85 }); 86 } 87 loadScript("/static/libs/multi-phoneMask.js", phoneMask, id = "phoneMaskId"); 88 89 } 90 }); 91 92 return false; 93 }); 94 95}); 96 97$(document).ready(function () { 98 if ($(window).width() > 768) { 99 $(".nav__item") 100 .on("mouseenter", function () { 101 $(this).addClass("active"); 102 }) 103 .on("mouseleave", function () { 104 $(".nav__item").removeClass("active"); 105 }); 106 } 107 108 if ($(window).width() <= 768) { 109 $(".dropdown__link").off("click").on("click", function (e) { 110 e.preventDefault(); 111 $(this).parent(".nav__item").toggleClass("active"); 112 }); 113 114 115 $('.header_panel').appendTo('#header_menu'); 116 } 117 118 function toggleNavigationButtons(swiper) { 119 if (swiper && swiper.slides) { 120 if (swiper.slides.length <= 1) { 121 swiper.navigation.nextEl.style.display = 'none'; 122 swiper.navigation.prevEl.style.display = 'none'; 123 } else { 124 swiper.navigation.nextEl.style.display = ''; 125 swiper.navigation.prevEl.style.display = ''; 126 } 127 } 128 } 129 130 131 const instaSlider = new Swiper("#instaSlider", { 132 slidesPerView: isMobile() ? 1.5 : 3.5, 133 spaceBetween: 20.15, 134 initialSlide: isMobile() ? 0 : 2, 135 freeMode: true, 136 }); 137 138 var stockSlider = new Swiper("#stockSlider", { 139 slidesPerView: isMobile() ? 1.2 : 4.5, 140 spaceBetween: 20, 141 }); 142 143 var galleryCarousel = new Swiper("#gallery_container", { 144 slidesPerView: isMobile() ? 1.5 : 'auto', 145 observer: true, 146 observeParents: true, 147 spaceBetween: 20, 148 resistanceRatio: false, 149 navigation: { 150 nextEl: '#gallery_container .swiper-button-next', 151 prevEl: '#gallery_container .swiper-button-prev', 152 }, 153 154 on: { 155 init: function () { 156 toggleNavigationButtons($(this)); 157 }, 158 } 159 }); 160 161 var mainModelSlider = new Swiper("#mainModelsSlider", { 162 slidesPerView: 1, 163 spaceBetween: 20, 164 autoHeight: isMobile(), 165 on: { 166 slideChange: function () { 167 var activeIndex = this.activeIndex; 168 $("#modelLine .series_select .tab").removeClass("active"); 169 $("#modelLine .series_select .tab").eq(activeIndex).addClass("active"); 170 }, 171 }, 172 }); 173
174 // var benefitsSlider = new Swiper(".benefits_slider", { 175 // slidesPerView: isMobile() ? 1.1 : 3, 176 // spaceBetween: 20, 177 // navigation: { 178 // nextEl: '.benefits_slider .swiper-button-next', 179 // prevEl: '.benefits_slider .swiper-button-prev', 180 // }, 181 // }) 182 183 $(".nested-slider").each(function (index, element) { 184 new Swiper(element, { 185 slidesPerView: 1, 186 type: "mousemove", 187 observer: true, 188 observeParents: true, 189 observeSlideChildren: true, 190 pagination: { 191 el: $(element).find(".swiper-pagination")[0], 192 clickable: true, 193 }, 194 nested: true, 195 }); 196 }); 197 198 var thumbsPreview = new Swiper(".thumbsPreview", { 199 slidesPerView: 4, 200 speed: 300, 201 freeMode: true, 202 }); 203 204 var modelSlider = new Swiper(".modelSlider", { 205 slidesPerView: 1, 206 speed: 400, 207 navigation: { 208 nextEl: ".swiper-button-next", 209 prevEl: ".swiper-button-prev", 210 }, 211 thumbs: { 212 swiper: thumbsPreview, 213 }, 214 }); 215 216 $(".pageUp").on("click", function (e) { 217 e.preventDefault(); 218 $("html, body").animate({ scrollTop: 0 }, "smooth"); 219 }); 220 221 $(".tab_parent").each(function () { 222 const $section = $(this); 223 const $form = $('.tab_parent.form_container'); 224 const $tabSelect = $form.find(".tabs__select"); 225 const $sectionName = $form.find(".section_name"); 226 227 228 if ($section.hasClass('form_container')) { 229 $sectionName.html($section.find('.tabs__select .tab[tab="1"]').html()); 230 } 231 232 $section.find(".tabs__select .tab").on("click", function () { 233 $section.find(".tabs__select .tab").removeClass("active"); 234 235 $section.find("[tabindex]").addClass("hidden"); 236 237 $(this).addClass("active"); 238 239 const tabIndex = $(this).attr("tab"); 240 const tabTitle = $(this).data("title") ?? $(this).text(); 241 242 $sectionName.html(tabTitle); 243 244 if (tabIndex == 0) { 245 $section.find(`[tabindex]`).removeClass("hidden"); 246 } 247 248 $section.find(`[tabindex="${tabIndex}"]`).removeClass("hidden"); 249 }); 250 251 $section.find(".btn[tab]").on("click", function () { 252 $section.find(`[tabindex]`).removeClass("hidden"); 253 $(this).text($(this).text == "ÐоказаÑÑ Ð²Ñе" ? "СкÑÑÑÑ" : "ÐоказаÑÑ Ð²Ñе"); 254 }); 255 }); 256 257 const $prevSection = $(".pageUp").prev("section"); 258 const $pageUp = $(".pageUp"); 259 260 if ($prevSection.attr("bg") === "dark") { 261 $pageUp.attr("bg", "dark"); 262 } else if ($pageUp.attr("bg") != "light") { 263 $pageUp.removeAttr("bg"); 264 } 265 266 $(".open_menu").click(function () { 267 $(".burger_menu").addClass("active"); 268 $("body").addClass("noscroll"); 269 $(this).fadeOut(function () { 270 $(".close_menu").fadeIn(); 271 }); 272 }); 273 274 $(".close_menu").click(function () { 275 $(".burger_menu").removeClass("active"); 276 $("body").removeClass("noscroll"); 277 $(this).fadeOut(function () { 278 $(".open_menu").fadeIn(); 279 }); 280 }); 281 282 $(".search").click(function (e) { 283 if (e.target.tagName === "INPUT") { 284 return; 285 } 286 287 if ($("#site_search").is(":visible")) { 288 $("#site_search").fadeOut(function () { 289 $(".search").find("span").fadeIn(); 290 }); 291 } else { 292 $(this) 293 .find("span") 294 .fadeOut(function () { 295 $("#site_search").fadeIn(); 296 }); 297 } 298 }); 299 300 // if (isMobile()) { 301 // var $header = $(".header"); 302 // var $modelPanel = $(".model_panel"); 303 // var originalHeight = $modelPanel.outerHeight(); 304 // var headerBottom = $header.offset().top + $header.outerHeight(); 305 306 // $(window).on("scroll", function () { 307 // if ($(window).scrollTop() >= headerBottom) { 308 // $modelPanel.css("height", originalHeight + "px"); 309 // $modelPanel.addClass("sticky"); 310 // $modelPanel.css("top", $header.outerHeight() + "px"); 311 // } else { 312 // $modelPanel.css("height", originalHeight + "px"); 313 // $modelPanel.removeClass("sticky"); 314 // $modelPanel.css("bottom", "0"); 315 // $modelPanel.css("top", "revert"); 316 // } 317 // }); 318 // } 319 320 var items = $(".pagination_item"); 321 var itemsPerPage = 12; 322 var numItems = items.length; 323 var numPages = Math.ceil(numItems / itemsPerPage); 324 var currentPage = 1; 325 326 function showPage(page) { 327 items.hide(); 328 items.slice((page - 1) * itemsPerPage, page * itemsPerPage).fadeIn(); 329 $(".page-link").removeClass("active"); 330 $(`#page-links-container [data-page="${page}"]`).addClass("active"); 331 currentPage = page; 332 333 if (currentPage === 1) { 334 $(".prev-link").addClass("disabled").prop("disabled", true); 335 } else { 336 $(".prev-link").removeClass("disabled").prop("disabled", false); 337 } 338 339 if (currentPage === numPages) { 340 $(".next-link").addClass("disabled").prop("disabled", true); 341 } else { 342 $(".next-link").removeClass("disabled").prop("disabled", false); 343 } 344 } 345 346 function createPagination() { 347 $("#prev-container, #page-links-container, #next-container").empty(); 348 349 var prevLink = $( 350 '<button class="prev-link"><img src="/static/img/chevron.svg" alt="" /></button>' 351 ); 352 prevLink.click(function () { 353 if (currentPage > 1) { 354 showPage(currentPage - 1); 355 createPagination(); 356 } 357 });
358 $("#prev-container").append(prevLink); 359 360 var firstPageLink = $('<span class="page-link"></span>'); 361 firstPageLink.text(1); 362 firstPageLink.attr("data-page", 1); 363 firstPageLink.click(function () { 364 var page = $(this).attr("data-page"); 365 showPage(page); 366 createPagination(); 367 }); 368 $("#page-links-container").append(firstPageLink); 369 370 if (numPages > 5) { 371 var secondPageLink = $('<span class="page-link"></span>'); 372 secondPageLink.text(2); 373 secondPageLink.attr("data-page", 2); 374 secondPageLink.click(function () { 375 var page = $(this).attr("data-page"); 376 showPage(page); 377 createPagination(); 378 }); 379 $("#page-links-container").append(secondPageLink); 380 381 var thirdPageLink = $('<span class="page-link"></span>'); 382 thirdPageLink.text(3); 383 thirdPageLink.attr("data-page", 3); 384 thirdPageLink.click(function () { 385 var page = $(this).attr("data-page"); 386 showPage(page); 387 createPagination(); 388 }); 389 $("#page-links-container").append(thirdPageLink); 390 391 if (currentPage > 3 && currentPage < numPages - 2) { 392 $("#page-links-container").append( 393 '<span class="ellipsis page-link">...</span>' 394 ); 395 396 var currentPageLink = $('<span class="page-link"></span>'); 397 currentPageLink.text(currentPage); 398 currentPageLink.attr("data-page", currentPage); 399 currentPageLink.addClass("active"); 400 currentPageLink.click(function () { 401 var page = $(this).attr("data-page"); 402 showPage(page); 403 createPagination(); 404 }); 405 $("#page-links-container").append(currentPageLink); 406 407 $("#page-links-container").append( 408 '<span class="ellipsis page-link">...</span>' 409 ); 410 } else { 411 $("#page-links-container").append( 412 '<span class="ellipsis page-link">...</span>' 413 ); 414 } 415 416 var lastPageLink = $('<span class="page-link"></span>'); 417 lastPageLink.text(numPages); 418 lastPageLink.attr("data-page", numPages); 419 lastPageLink.click(function () { 420 var page = $(this).attr("data-page"); 421 showPage(page); 422 createPagination(); 423 }); 424 $("#page-links-container").append(lastPageLink); 425 } else { 426 for (var i = 2; i <= numPages; i++) { 427 var pageLink = $('<span class="page-link"></span>'); 428 pageLink.text(i); 429 pageLink.attr("data-page", i); 430 pageLink.click(function () { 431 var page = $(this).attr("data-page"); 432 showPage(page); 433 createPagination(); 434 }); 435 $("#page-links-container").append(pageLink); 436 } 437 } 438 439 var nextLink = $( 440 '<button class="next-link"><img src="/static/img/chevron.svg" alt="" /></button>' 441 ); 442 nextLink.click(function () { 443 if (currentPage < numPages) { 444 showPage(currentPage + 1); 445 createPagination(); 446 } 447 }); 448 $("#next-container").append(nextLink); 449 $(`#page-links-container [data-page="${currentPage}"]`).addClass("active"); 450 } 451 452 if (numPages > 1) { 453 createPagination(); 454 showPage(1); 455 } else { 456 showPage(1); 457 } 458 459 $(".news_slider").each(function () { 460 const newsSlider = new Swiper(".news_slider", { 461 slidesPerView: 1, 462 speed: 400, 463 navigation: { 464 nextEl: ".swiper-button-next", 465 prevEl: ".swiper-button-prev", 466 }, 467 468 pagination: { 469 el: ".swiper-pagination", 470 type: "fraction", 471 }, 472 }); 473 }); 474 475 $(".sort li").click(function () { 476 $(".sort li").each(function () { 477 $(this).removeClass("active"); 478 }); 479 480 $(this).addClass("active"); 481 482 $(this).prependTo(".sort ul"); 483 }); 484 485 $(".icon-menu").click(function (e) { 486 e.preventDefault(); 487 $(".header").toggleClass("active"); 488 $('body').toggleClass('noscroll'); 489 }); 490 491 $("#modelLine .series_select .tab").each(function () { 492 $(this).click(function () { 493 mainModelSlider.slideTo($(this).attr("tab") - 1); 494 });
495 }); 496 497 if ($(document).find('.phone-mask')) { 498 var phoneMask = function () { 499 var listCountries = $.masksSort($.masksLoad("/static/libs/data/phone-codes.json"), ['#'], /[0-9]|#/, "mask"); 500 var maskOpts = { 501 inputmask: { 502 definitions: { 503 '#': { 504 validator: "[0-9]", 505 cardinality: 1 506 } 507 }, 508 showMaskOnHover: false, 509 autoUnmask: true, 510 clearMaskOnLostFocus: false 511 }, 512 match: /[0-9]/, 513 replace: '#', 514 listKey: "mask" 515 }; 516 $('.phone-mask').keyup(function () { 517 $(this).inputmasks($.extend(true, {}, maskOpts, { 518 list: listCountries 519 })); 520 }); 521 } 522 loadScript("/static/libs/multi-phoneMask.js", phoneMask, id = "uploadedMask"); 523 } 524 525 526}); 527 528function isMobile() { 529 return ( 530 /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( 531 navigator.userAgent 532 ) || $(window).width() <= 768 533 ); 534} 535function loadScript(url, callback, id) { 536 var body = document.getElementsByTagName('body')[0]; 537 var script = document.createElement('script'); 538 script.type = 'text/javascript'; 539 script.src = url; 540 script.id = id, 541 script.onreadystatechange = callback; 542 script.onload = callback; 543 body.appendChild(script); 544} 545
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.