1window.addEventListener('DOMContentLoaded', event => { 2 // console.log('Hello from custom-js.js file'); 3 4 /** 5 * ÐÑа ÑÑнкÑÐ¸Ñ Ð²ÑÐ²Ð¾Ð´Ð¸Ñ ÑиÑÐ¸Ð½Ñ Ð²ÑÑпоÑÑа Ñогда, 6 * когда пÑоиÑÑ Ð¾Ð´Ð¸Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ðµ ÑазмеÑа окна 7 * @date 2021-02-09 8 * @return {void} 9 */ 10 11 window.onresize = () => { 12 /* setTimeout(() => { 13 console.log(window.innerWidth); 14 }, 1); */ 15 16 if (document.querySelector('.screen-size')) { 17 document.querySelector('.screen-size').textContent = window.innerWidth + 'px'; 18 } 19 }; 20 21 /* ÐагаÑовка Ð´Ð»Ñ js в завиÑимоÑÑи Ð¾Ñ ÑиÑÐ¸Ð½Ñ ÑкÑана */ 22 if (window.matchMedia('(max-width: 640px)').matches) { 23 // do functionality on screens smaller than 640px 24 } else { 25 // ÐекÑÑоп 26 } 27 28 if (document.querySelector('.cart-tarif.half-visible')) { 29 Array.from(document.querySelectorAll('.cart-tarif.half-visible')).forEach(element => { 30 element.addEventListener('click', cartTarifHalfVisibleHandler); 31 }); 32 } 33 34 /* ÐÑо каÑÑÑ Ð¿Ð¾ÐºÑÑÑÐ¸Ñ */ 35 if (document.querySelector('#iframe-map')) { 36 window.onload = () => { 37 let iframeMap = document.querySelector('#iframe-map'); 38 39 if (window.matchMedia('(max-width: 640px)').matches) { 40 iframeMap.height = '380'; 41 } else { 42 // ÐекÑÑоп 43 iframeMap.height = '530'; 44 } 45 iframeMap.src = iframeMap.dataset.src; 46 //iframeMap.height = Number(iframeMap.height) + 82; 47 }; 48 } 49 /* ÐÐ¾Ð½ÐµÑ ÐÑо каÑÑÑ Ð¿Ð¾ÐºÑÑÑÐ¸Ñ */ 50 51 /** 52 * ÐÑа ÑÑнкÑÐ¸Ñ Ð´Ð»Ñ Ñого, ÑÑÐ¾Ð±Ñ ÐºÐ¾Ð³Ð´Ð° по ÑлеменÑÑ ".cart-tarif.half-visible" 53 * кликнÑÑ, ÑдалиÑÑ Ñ Ð½ÐµÐ³Ð¾ клаÑÑ ".half-visible", коÑоÑÑй оÑвеÑÐ°ÐµÑ Ð·Ð° 54 * полÑпÑозÑаÑнÑÑ Ð´ÑмкÑ. 55 * @param {e} e ÑобÑÑие клика. 56 */ 57 function cartTarifHalfVisibleHandler(e) { 58 this.classList.remove('half-visible'); 59 this.removeEventListener('click', cartTarifHalfVisibleHandler); 60 } 61 62 $(document).ready(function () { 63 const navLogo = document.createElement('img'); 64 navLogo.src = '/local/templates/.default/assets/svg/header-logo.svg'; 65 navLogo.loading = 'lazy'; 66 67 const currUrl = window.location.href.split('?')[0]; 68 console.log(currUrl); 69 70 var Nav = new hcOffcanvasNav('#main-nav', { 71 disableAt: 901, 72 customToggle: $('#toggle-main-nav'), 73 navTitle: currUrl === 'https://www.gartel.ru/' ? navLogo : '', 74 levelTitles: true, 75 levelTitleAsBack: true, 76 labelBack: 'Ðазад', 77 keepClasses: false, 78 swipeGestures: false 79 }); 80 81 $('.tarifs-row').slick({ 82 slidesToShow: 3, 83 dots: false, 84 arrows: true, 85 infinite: true, 86 nextArrow: `<button type="button" class="slick-next"> 87 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 88 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#49575a"/> 89 </svg> 90 </button>`, 91 prevArrow: `<button type="button" class="slick-prev"> 92 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 93 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#49575a"/> 94 </svg> 95 </button>`, 96 97 responsive: [ 98 { 99 breakpoint: 1100, 100 settings: { slidesToShow: 2, dots: true } 101 }, 102 { 103 breakpoint: 800, 104 settings: { slidesToShow: 2, dots: true } 105 }, 106 { 107 breakpoint: 601,
108 settings: { 109 slidesToShow: 1, 110 dots: true, 111 variableWidth: true 112 /* centerMode: true, */ 113 } 114 } 115 ] 116 }); 117 118 $('.banner-slider').slick({ 119 slidesToShow: 1, 120 dots: false, 121 arrows: false, 122 infinite: true, 123 autoplay: true, 124 adaptiveHeight: true, 125 autoplaySpeed: '8000' 126 127 /* nextArrow: `<button type="button" class="slick-next"> 128 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 129 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#ffffff"/> 130 </svg> 131 </button>`, 132 prevArrow: `<button type="button" class="slick-prev"> 133 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 134 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#ffffff"/> 135 </svg> 136 </button>`, */ 137 }); 138 139 $('.history-slider').slick({ 140 slidesToShow: 3, 141 dots: false, 142 arrows: false, 143 infinite: false, 144 nextArrow: ` 145 <button type="button" class="slick-next"> 146 <svg width="36" height="71" viewBox="0 0 36 71" fill="none" xmlns="http://www.w3.org/2000/svg"> 147 <circle cx="35.5" cy="35.5" r="34" stroke="#49575A" stroke-width="3"/> 148 </svg> 149 </button>`, 150 prevArrow: ` 151 <button type="button" class="slick-prev"> 152 <svg width="21" height="41" viewBox="0 0 21 41" fill="none" xmlns="http://www.w3.org/2000/svg"> 153 <circle cx="0.500055" cy="20.5001" r="17.0352" fill="#49575A"/> 154 <circle cx="0.5" cy="20.5" r="19.5" stroke="#49575A" stroke-width="2"/> 155 </svg> 156 </button>`, 157 responsive: [ 158 { 159 breakpoint: 1024, 160 settings: { 161 slidesToShow: 3, 162 arrows: true 163 } 164 }, 165 { 166 breakpoint: 768, 167 settings: { 168 slidesToShow: 1, 169 arrows: true 170 } 171 } 172 ], 173 }); 174 175 $('.call-slider').slick({ 176 slidesToShow: 1, 177 dots: true, 178 arrows: true, 179 infinite: false, 180 181 nextArrow: `<button type="button" class="slick-next"> 182 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 183 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#ffffff"/> 184 </svg> 185 </button>`, 186 prevArrow: `<button type="button" class="slick-prev"> 187 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 188 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#ffffff"/> 189 </svg> 190 </button>` 191 }); 192 193 $('.address-slider').slick({ 194 slidesToShow: 1, 195 dots: true, 196 arrows: true, 197 infinite: false, 198 199 nextArrow: `<button type="button" class="slick-next"> 200 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 201 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#ffffff"/> 202 </svg> 203 </button>`, 204 prevArrow: `<button type="button" class="slick-prev"> 205 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 206 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#ffffff"/> 207 </svg> 208 </button>` 209 }); 210 211 $('.offers-slider').slick({ 212 slidesToShow: 3, 213 dots: false, 214 arrows: true, 215 infinite: true, 216 nextArrow: `<button type="button" class="slick-next"> 217 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 218 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#49575a"/> 219 </svg> 220 </button>`, 221 prevArrow: `<button type="button" class="slick-prev"> 222 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 223 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#49575a"/> 224 </svg> 225 </button>`, 226 responsive: [ 227 { 228 breakpoint: 1000, 229 settings: { slidesToShow: 3 } 230 }, 231 { 232 breakpoint: 800, 233 settings: { slidesToShow: 2, dots: true } 234 }, 235 { 236 breakpoint: 641,
237 settings: { slidesToShow: 2, dots: true, arrows: false } 238 }, 239 { 240 breakpoint: 451, 241 settings: { 242 slidesToShow: 1, 243 dots: true, 244 arrows: false, 245 variableWidth: true 246 } 247 } 248 ] 249 }); 250 251 $('.know-more-slider').slick({ 252 lazyLoad: 'ondemand', 253 slidesToShow: 3, 254 dots: false, 255 arrows: true, 256 infinite: true, 257 nextArrow: `<button type="button" class="slick-next"> 258 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 259 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#49575A"/> 260 </svg> 261 </button>`, 262 prevArrow: `<button type="button" class="slick-prev"> 263 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 264 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#49575A"/> 265 </svg> 266 </button>`, 267 responsive: [ 268 { 269 breakpoint: 1000, 270 settings: { slidesToShow: 3 } 271 }, 272 { 273 breakpoint: 800, 274 settings: { slidesToShow: 2, dots: false } 275 }, 276 { 277 breakpoint: 640, 278 settings: { slidesToShow: 2, dots: false } 279 }, 280 { 281 breakpoint: 501, 282 settings: { slidesToShow: 1, dots: false } 283 } 284 ] 285 }); 286 $('.majornews-slider').slick({ 287 lazyLoad: 'ondemand', 288 slidesToShow: 2, 289 dots: false, 290 arrows: true, 291 infinite: true, 292 nextArrow: `<button type="button" class="slick-next"> 293 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 294 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#49575A"/> 295 </svg> 296 </button>`, 297 prevArrow: `<button type="button" class="slick-prev"> 298 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 299 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#49575A"/> 300 </svg> 301 </button>`, 302 responsive: [ 303 { 304 breakpoint: 1000, 305 settings: { slidesToShow: 2 } 306 }, 307 { 308 breakpoint: 800, 309 settings: { slidesToShow: 1, dots: false } 310 }, 311 ] 312 }); 313 314 $('.another-services-slider').slick({ 315 slidesToShow: 3, 316 dots: false, 317 arrows: true, 318 infinite: true, 319 nextArrow: `<button type="button" class="slick-next"> 320 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 321 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#49575A"/> 322 </svg> 323 </button>`, 324 prevArrow: `<button type="button" class="slick-prev"> 325 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 326 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#49575A"/> 327 </svg> 328 </button>`, 329 responsive: [ 330 { 331 breakpoint: 1000, 332 settings: { slidesToShow: 3 } 333 }, 334 { 335 breakpoint: 800, 336 settings: { slidesToShow: 2, dots: true } 337 }, 338 { 339 breakpoint: 640, 340 settings: { slidesToShow: 2, dots: true, arrows: false } 341 }, 342 { 343 breakpoint: 501, 344 settings: { slidesToShow: 1, dots: true, arrows: false } 345 } 346 ] 347 }); 348 349 setTimeout(function () { 350 $('.feedbacks-slider').slick({ 351 slidesToShow: 1, 352 // variableWidth: true, 353 // centerMode: true, 354 adaptiveHeight: false, 355 dots: false, 356 arrows: true, 357 infinite: false, 358 nextArrow: `<button type="button" class="slick-next"> 359 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 360 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#ffffff"/> 361 </svg> 362 </button>`, 363 prevArrow: `<button type="button" class="slick-prev"> 364 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 365 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#ffffff"/> 366 </svg> 367 </button>`, 368 responsive: [ 369 { 370 breakpoint: 1150, 371 settings: { slidesToShow: 1, centerMode: true } 372 }, 373 { 374 breakpoint: 799.98, 375 settings: { 376 slidesToShow: 1, 377 centerMode: true, 378 dots: false,
379 arrows: false, 380 variableWidth: true 381 } 382 }, 383 { 384 breakpoint: 699.98, 385 settings: { slidesToShow: 1, dots: false, arrows: false, centerMode: false } 386 } 387 ] 388 }); 389 }, 300); 390 391 let feedbacks_slider_2 = $('.feedbacks-slider-2').slick({ 392 slidesToShow: 1, 393 dots: true, 394 arrows: true, 395 adaptiveHeight: true, 396 infinite: true, 397 nextArrow: `<button type="button" class="slick-next"> 398 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 399 <path d="M2.2922 0L0 2.35734L7.42227 9.99823L0 17.6391L2.2922 20L12 9.99823L2.2922 0Z" fill="#ffffff"/> 400 </svg> 401 </button>`, 402 prevArrow: `<button type="button" class="slick-prev"> 403 <svg width="12" height="20" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 404 <path d="M9.7078 0L12 2.35734L4.57773 9.99823L12 17.6391L9.7078 20L0 9.99823L9.7078 0Z" fill="#ffffff"/> 405 </svg> 406 </button>`, 407 responsive: [ 408 { 409 breakpoint: 1150, 410 settings: { slidesToShow: 1 } 411 }, 412 { 413 breakpoint: 800, 414 settings: { arrows: false } 415 }, 416 { 417 breakpoint: 700, 418 settings: { slidesToShow: 1, arrows: false } 419 } 420 ] 421 }); 422 }); 423 424 /* РабоÑа Ñ ÐккаÑдеонами */ 425 if (document.querySelector('.accardion__header')) { 426 Array.from(document.querySelectorAll('.accardion__header')).forEach(accTitle => { 427 accTitle.addEventListener('click', accHandler); 428 }); 429 } 430 431 /** 432 * ÐÑа ÑÑнкÑÐ¸Ñ Ñоздана Ð´Ð»Ñ ÑаÑкÑÑÑиÑ/закÑÑÑÐ¸Ñ Ð°ÐºÐºÐ°Ñдиона. 433 * по ÐºÐ»Ð¸ÐºÑ Ð½Ð° ÑÐ°Ð¿ÐºÑ Ð°ÐºÐºÐ°Ñдиона, ÑÐ°Ð¼Ð¾Ð¼Ñ Ð°ÐºÐºÐ°ÑÐ´Ð¸Ð¾Ð½Ñ 434 * ÑоглиÑÑÑ ÐºÐ»Ð°ÑÑ "open". 435 * @param {e} e СобÑÑие клика. 436 */ 437 function accHandler(e) { 438 e.target.closest('.accardion').classList.toggle('open'); 439 } 440 /* ÐÐ¾Ð½ÐµÑ Ð Ð°Ð±Ð¾Ñа Ñ ÐккаÑдеонами */ 441 442 /* РабоÑа Ñ ÑазÑиÑÑÑÑимиÑÑ ÑекÑиÑми в вÑÑоÑÑ */ 443 if (document.querySelector('.limited-height__trigger')) { 444 document.querySelectorAll('.limited-height__trigger').forEach(triger => { 445 triger.addEventListener('click', limitedHeightHandler); 446 }); 447 } 448 449 function limitedHeightHandler(e) { 450 e.preventDefault(); 451 let parent = e.target.closest('.limited-height'); 452 parent.classList.add('unlimited'); 453 if (e.target.closest('.feedbacks-slider-2')) { 454 setTimeout(function () { 455 let slideHeight = e.target.closest('.feedbacks-slider-2 .slick-active').offsetHeight; 456 $('.feedbacks-slider-2 .slick-list, .feedbacks-slider-2 .slick-track').animate({ 457 height: slideHeight 458 }); 459 }, 100); 460 } 461 } 462 /* ÐÐ¾Ð½ÐµÑ Ð Ð°Ð±Ð¾Ñа Ñ ÑазÑиÑÑÑÑимиÑÑ ÑекÑиÑми в вÑÑоÑÑ */ 463 464 /* Ð ÑаблиÑе кнопка подÑобнее */ 465 if (document.querySelector('.tarifs-table__cell .show-more')) { 466 document.querySelectorAll('.tarifs-table__cell .show-more').forEach(triger => { 467 triger.addEventListener('click', showMoreTableHandler); 468 }); 469 } 470 471 function showMoreTableHandler(e) { 472 e.preventDefault(); 473 let parent = e.target.closest('.tarifs-table__cell'); 474 parent.querySelector('.mobile-visible').remove(); 475 parent.querySelector('.mobile-hidden').classList.remove('mobile-hidden'); 476 } 477 /* ÐÐ¾Ð½ÐµÑ Ð ÑаблиÑе кнопка подÑобнее */ 478 479 /* Ð¢Ð°Ð±ÐµÑ Ð´Ð»Ñ ÐÑбеÑиÑе Ð½Ð¾Ð¼ÐµÑ */ 480 if (document.querySelector('.list-selectors')) { 481 document.querySelectorAll('.list-selectors a').forEach(element => { 482 element.addEventListener('click', chooseNumberHandler); 483 }); 484 } 485 486 function chooseNumberHandler(e) { 487 e.preventDefault(); 488 489 let parent = e.target.closest('.list-selectors'); 490 parent.querySelectorAll('.list-selectors a').forEach(element => { 491 element.classList.remove('active'); 492 }); 493 this.classList.add('active'); 494 } 495 /* ÐÐ¾Ð½ÐµÑ Ð¢Ð°Ð±ÐµÑ Ð´Ð»Ñ ÐÑбеÑиÑе Ð½Ð¾Ð¼ÐµÑ */ 496 497 /* Ð¢Ð°Ð±ÐµÑ Ð½Ð° ÑÑÑаниÑе вопÑоÑÑ Ð¸ оÑвеÑÑ */ 498 if (document.querySelector('.aside-menu__link.tab')) { 499 document.querySelectorAll('.aside-menu__link.tab').forEach(element => { 500 element.addEventListener('click', faqTabHandler); 501 }); 502 } 503 504 function faqTabHandler(e) { 505 e.preventDefault(); 506 507 let accTarget = this.dataset.target; 508 509 document.querySelectorAll('.accardion').forEach(element => { 510 element.classList.add('hidden'); 511 }); 512 document.querySelectorAll('.accardion[data-acc=' + accTarget + ']').forEach(element => { 513 element.classList.remove('hidden'); 514 }); 515 } 516 /* ÐÐ¾Ð½ÐµÑ Ð¢Ð°Ð±ÐµÑ Ð½Ð° ÑÑÑаниÑе вопÑоÑÑ Ð¸ оÑвеÑÑ */ 517 518 /* ЧекбокÑÑ Ð¿ÐµÑеклÑÑÐµÐ½Ð¸Ñ ÑÐµÐ½Ñ ÐодклÑÑÐµÐ½Ð¸Ñ Ð½Ð° .cart-service */ 519 if (document.querySelector('.cart-service [data-connectprice]')) { 520 document.querySelectorAll('.cart-service [data-connectprice]').forEach(element => { 521 element.addEventListener('change', checkboxChangeHandler); 522 }); 523 } 524 525 function checkboxChangeHandler(e) { 526 let parent = e.target.closest('.cart-service'); 527 parent.querySelector('.price-connection .price-per__number').textContent = 528 this.dataset.connectprice; 529 } 530 /* ÐÐ¾Ð½ÐµÑ Ð§ÐµÐºÐ±Ð¾ÐºÑÑ Ð¿ÐµÑеклÑÑÐµÐ½Ð¸Ñ ÑÐµÐ½Ñ ÐодклÑÑÐµÐ½Ð¸Ñ Ð½Ð° .cart-service */ 531
532 /* ÐеÑеклÑÑалка видимоÑÑи паÑÐ¾Ð»Ñ */ 533 if (document.querySelector('.password-visibility-toggler')) { 534 document.querySelectorAll('.password-visibility-toggler .wrap-input-icon').forEach(toggler => { 535 toggler.addEventListener('click', visibilityPasswordToggler); 536 }); 537 } 538 539 function visibilityPasswordToggler(e) { 540 e.preventDefault(e); 541 542 let parent = e.target.closest('.password-visibility-toggler'); 543 let input = parent.querySelector('input'); 544 545 if (input.type === 'password') { 546 input.type = 'text'; 547 } else if (input.type === 'text') { 548 input.type = 'password'; 549 } 550 551 parent.querySelector('.input-icon-line').classList.toggle('transparent'); 552 } 553 /* ÐÐ¾Ð½ÐµÑ ÐеÑеклÑÑалка видимоÑÑи паÑÐ¾Ð»Ñ */ 554 555 /* .cart-pasport ÑаÑÑÑ ÐºÐ¾Ð´Ð° оÑÑажадÑÑÐ°Ñ Ð¿ÑикÑÐµÐ¿Ð»ÐµÐ½Ð¸Ñ ÑоÑо паÑпоÑÑа */ 556 $(document).on('change', '.cart-pasport__input-file', function (e) { 557 let parent_el = $(this).parent('.cart-pasport__label'), 558 pseudoLink = parent_el.find('.cart-pasport__link-load-img'), 559 infoLink = parent_el.find('.cart-pasport__load-info'); 560 pseudoLink.addClass('dn'); 561 infoLink.html(e.target.files[0].name + ' Ñайл пÑикÑеплÑн.'); 562 }); 563 /* end .cart-pasport */ 564 565 /* my-select */ 566 var x, i, j, l, ll, selElmnt, a, b, c; 567 /* Look for any elements with the class "my-select": */ 568 x = document.getElementsByClassName('my-select'); 569 l = x.length; 570 for (i = 0; i < l; i++) { 571 selElmnt = x[i].getElementsByTagName('select')[0]; 572 ll = selElmnt.length; 573 /* For each element, create a new DIV that will act as the selected item: */ 574 a = document.createElement('DIV'); 575 a.setAttribute('class', 'select-selected'); 576 a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML; 577 if (selElmnt.selectedIndex !== 0) { 578 a.classList.add('dirty'); 579 } else { 580 a.classList.add('clean'); 581 } 582 x[i].appendChild(a); 583 /* For each element, create a new DIV that will contain the option list: */ 584 b = document.createElement('DIV'); 585 b.setAttribute('class', 'select-items select-hide'); 586 for (j = 1; j < ll; j++) { 587 /* For each option in the original select element, 588 create a new DIV that will act as an option item: */ 589 c = document.createElement('DIV'); 590 c.innerHTML = selElmnt.options[j].innerHTML; 591 c.addEventListener('click', function (e) { 592 /* When an item is clicked, update the original select box, 593 and the selected item: */ 594 var y, i, k, s, h, sl, yl; 595 s = this.parentNode.parentNode.getElementsByTagName('select')[0]; 596 sl = s.length; 597 h = this.parentNode.previousSibling; 598 h.classList.remove('clean'); 599 h.classList.add('dirty'); 600 for (i = 0; i < sl; i++) { 601 if (s.options[i].innerHTML == this.innerHTML) { 602 s.selectedIndex = i; 603 h.innerHTML = this.innerHTML; 604 y = this.parentNode.getElementsByClassName('same-as-selected'); 605 yl = y.length; 606 for (k = 0; k < yl; k++) { 607 y[k].removeAttribute('class'); 608 } 609 this.setAttribute('class', 'same-as-selected'); 610 break; 611 } 612 } 613 h.click(); 614 // ТÑигеÑим ÑобÑÑие change на наÑивном select 615 s.dispatchEvent(new Event('change')); 616 }); 617 b.appendChild(c); 618 } 619 x[i].appendChild(b); 620 a.addEventListener('click', function (e) { 621 /* When the select box is clicked, close any other select boxes, 622 and open/close the current select box: */ 623 e.stopPropagation(); 624 closeAllSelect(this); 625 this.nextSibling.classList.toggle('select-hide'); 626 this.classList.toggle('select-arrow-active'); 627 this.closest('.my-select').classList.toggle('open'); 628 }); 629 } 630 631 function closeAllSelect(elmnt) { 632 /* A function that will close all select boxes in the document, 633 except the current select box: */ 634 var x, 635 y, 636 i, 637 xl, 638 yl, 639 arrNo = []; 640 x = document.getElementsByClassName('select-items'); 641 y = document.getElementsByClassName('select-selected'); 642 xl = x.length; 643 yl = y.length; 644 for (i = 0; i < yl; i++) { 645 if (elmnt == y[i]) { 646 arrNo.push(i); 647 } else { 648 y[i].classList.remove('select-arrow-active'); 649 y[i].closest('.my-select').classList.remove('open'); 650 } 651 } 652 for (i = 0; i < xl; i++) { 653 if (arrNo.indexOf(i)) { 654 x[i].classList.add('select-hide'); 655 } 656 } 657 } 658 659 /* If the user clicks anywhere outside the select box, 660 then close all select boxes: */ 661 document.addEventListener('click', closeAllSelect); 662 /* end my-select */ 663 664 /* РабоÑа Ñ .aside-nav */ 665 if (document.querySelector('.aside-nav')) { 666 document 667 .querySelector('.aside-nav__item.last') 668 .addEventListener('click', asideNavTogglerHandler); 669 } 670 671 function asideNavTogglerHandler(e) { 672 e.preventDefault(); 673 674 parent = e.target.closest('.aside-nav'); 675 parent.classList.toggle('open'); 676 } 677 678 window.openAsideNav = function () { 679 if (document.querySelector('.aside-nav')) { 680 document.querySelector('.aside-nav').classList.add('open'); 681 } else { 682 console.log('ÐÐ»ÐµÐ¼ÐµÐ½Ñ .aside-nav не ÑÑÑеÑÑвÑеÑ'); 683 } 684 }; 685 686 window.closeAsideNav = function () { 687 if (document.querySelector('.aside-nav')) { 688 document.querySelector('.aside-nav').classList.remove('open'); 689 } else { 690 console.log('ÐÐ»ÐµÐ¼ÐµÐ½Ñ .aside-nav не ÑÑÑеÑÑвÑеÑ'); 691 } 692 }; 693 694 window.toggleAsideNav = function () { 695 if (document.querySelector('.aside-nav')) { 696 document.querySelector('.aside-nav').classList.toggle('open'); 697 } else { 698 console.log('ÐÐ»ÐµÐ¼ÐµÐ½Ñ .aside-nav не ÑÑÑеÑÑвÑеÑ'); 699 } 700 }; 701 /* end РабоÑа Ñ .aside-nav */ 702 703 /* ÐÐ»Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ ÑлеменÑа "progress" */ 704 window.makeProgress = function (percent) { 705 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð¿ÑогÑеÑÑа 706 if (document.querySelector('.progress__bar')) { 707 document.querySelector('.progress__bar .progress__number').textContent = percent; 708 document.querySelector('.progress__bar .progress__filler').style.transform = `scaleX(${ 709 Number(percent) / 100 710 })`; 711 } else { 712 console.log('ÐлеменÑа .progress__bar не найдено'); 713 } 714 }; 715 /* end ÐÐ»Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ ÑлеменÑа "progress" */ 716 717 /* ÐÑÐ¸Ð¼ÐµÑ Ñмена ТаÑиÑного плана */ 718 if (document.querySelector('.js-tarif__select')) { 719 document.querySelector('.js-tarif__select').addEventListener('change', function (e) { 720 // console.log(e.target.value); 721 let selectValue = e.target.value; 722 let podkl = $(this).find('option:selected').data('podkl'); 723 724 $(this).parents('.how-much__list').find('.js-connect__price').html(podkl); 725 726 let parent = e.target.closest('.cart-how-much'); 727 parent.querySelector('.price-per__number').textContent = selectValue; 728 parent.querySelector('.cart-how-much__price').classList.remove('invisible'); 729 }); 730 } 731 /* ÐÐ¾Ð½ÐµÑ ÐÑÐ¸Ð¼ÐµÑ Ñмена ТаÑиÑного плана */ 732 733 $('.menu__item').click(function (e) { 734 e.stopPropagation(); 735 $(this).toggleClass('open'); 736 }); 737}); 738 739// Ñклонение ÑиÑлиÑелÑнÑÑ 740function declensionNum(num, words) { 741 return words[ 742 num % 100 > 4 && num % 100 < 20 ? 2 : [2, 0, 1, 1, 1, 2][num % 10 < 5 ? num % 10 : 5] 743 ]; 744} 745 746document.addEventListener('DOMContentLoaded', _ => { 747 const YM_CODE = 17913505; 748 const stat = target => { 749 console.log(target); 750 ym(YM_CODE, 'reachGoal', target); 751 }; 752 753 const connectBtn40244 = document.querySelector('.connect-btn-40244'); 754 if (connectBtn40244) { 755 connectBtn40244.addEventListener('click', _ => { 756 stat('zakaz-unlim-internet'); 757 setTimeout(() => { 758 const form40244 = document.querySelector('#connect_gartel [name="SIMPLE_FORM_8"]'); 759 if (form40244) { 760 form40244.addEventListener('submit', _ => { 761 stat('otpravka-zakaza'); 762 }); 763 } 764 }, 1000); 765 }); 766 } 767 768 setTimeout(() => { 769 const transitionToGartelBtn = document.querySelector( 770 'form[name="SIMPLE_FORM_9"] [name="web_form_submit"]' 771 ); 772 if (transitionToGartelBtn) { 773 transitionToGartelBtn.addEventListener('click', _ => { 774 stat('nachat_perehod'); 775 }); 776 } 777 }, 1000); 778 779 const podborBtn = document.querySelector('[data-modal_id="number_podbor"]'); 780 if (podborBtn) { 781 podborBtn.addEventListener('click', _ => { 782 const url = window.location.href.split('?')[0]; 783 if (url === 'https://www.gartel.ru/vybornomera/') stat('kupit_nomer'); 784 else if (url === 'https://www.gartel.ru/besplatniy-nomer/') stat('podobrat_po_telefonu'); 785 }); 786 } 787 788 const tarifConnectBtns = document.querySelectorAll('.utarifs__connect-btn'); 789 tarifConnectBtns.forEach(btn => { 790 btn.addEventListener('click', _ => { 791 stat('click_podcluchit'); 792 setTimeout(() => { 793 const tarifConnectForm = document.querySelector('#connect_gartel [name="SIMPLE_FORM_8"]'); 794 if (tarifConnectForm) { 795 tarifConnectForm.addEventListener('submit', _ => { 796 stat('podcluch_otpr'); 797 }); 798 } 799 }, 1000); 800 }); 801 }); 802 803 const servicesConnectBtns = document.querySelectorAll('.cart-service__connect-btn'); 804 servicesConnectBtns.forEach(btn => { 805 btn.addEventListener('click', _ => { 806 stat('click_usluga'); 807 setTimeout(() => { 808 const serviceConnectForm = document.querySelector( 809 '#connect_gartel [name="SIMPLE_FORM_19"]' 810 ); 811 if (serviceConnectForm) { 812 serviceConnectForm.addEventListener('submit', _ => { 813 stat('usluga_otpr'); 814 }); 815 } 816 }, 1000); 817 }); 818 }); 819 820 const coopBtn = document.querySelector('[data-modal_id="cooperation_popup"]'); 821 if (coopBtn) { 822 coopBtn.addEventListener('click', _ => { 823 stat('click_sotrud'); 824 setTimeout(() => { 825 const coopForm = document.querySelector('#cooperation_popup [name="SIMPLE_FORM_12"]'); 826 if (coopForm) { 827 coopForm.addEventListener('submit', _ => { 828 stat('sotrud_otpr'); 829 }); 830 } 831 }, 1000); 832 }); 833 } 834}); 835 836document.addEventListener('DOMContentLoaded', _ => { 837 $('.relative-articles__list').slick({ 838 slidesToShow: 3, 839 slidesToScroll: 1, 840 prevArrow: '<div class="nslick-arrow nslick-arrow--prev"></div>', 841 nextArrow: '<div class="nslick-arrow nslick-arrow--next"></div>', 842 responsive: [ 843 { 844 breakpoint: 991, 845 settings: { 846 slidesToShow: 2 847 } 848 }, 849 { 850 breakpoint: 640, 851 settings: { 852 slidesToShow: 1 853 } 854 } 855 ] 856 }); 857}); 858 859document.addEventListener('DOMContentLoaded', _ => { 860 const currentFullUrl = window.location.href.split('?')[0]; 861 document.querySelectorAll('.footer .list-links a').forEach(a => { 862 if (currentFullUrl === a.href) { 863 a.classList.add('active'); 864 } 865 }); 866});
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.