PageSourceSearch

https://blagopar.ru/bitrix/templates/aspro_max/js/turnkey.js?17892269053884

js blagopar.ru collected 2026-10-03 23:48:53 UTC 3,884 bytes, 150 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2  /* Turnkey-carousels */
3  const ttwCarouselConfigs = [
4    { 
5      selector: '#ttw-turnkey-articles-carousel', 
6      options: {
7        loop: true,
8        slidesPerView: 1,
9        spaceBetween: 28,
10        breakpoints: {
11          600: {
12            slidesPerView: 2,
13          },
14          1200: {
15            slidesPerView: 3,
16          }
17        }
18      }
19    },
20    { 
21      selector: '#ttw-turnkey-reviews-carousel', 
22      options: {
23        loop: true,
24        slidesPerView: 1,
25        spaceBetween: 20,
26      }
27    },
28  ];
29  document.querySelectorAll('.ttw-swiper').forEach(el => {
30    if (el.swiper) el.swiper.destroy(true, true);
31  });
32  ttwCarouselConfigs.forEach(({ selector, options }) => {
33    const carouselEl = document.querySelector(selector);
34    if (!carouselEl) return;
35
36    new Swiper(carouselEl.querySelector('.swiper'), {
37      ...options,
38      navigation: {
39        nextEl: carouselEl.querySelector('.swiper-button-next'),
40        prevEl: carouselEl.querySelector('.swiper-button-prev'),
41      },
42    });
43  });
44  /* Turnkey-carousels END */
45
46  /* Youtube video */
47  /* function findVideos() {
48    var videos = document.querySelectorAll(".ttw-video");
49    if(videos !== null && videos.length) {        
50      for (var i = 0; i < videos.length; i++) {
51        setupVideo(videos[i]);
52      }
53    }
54  }
55
56  function setupVideo(video) {
57    var link = video.querySelector(".ttw-video__link"),
58      media = video.querySelector(".ttw-video__media"),
59      button = video.querySelector(".ttw-video__button"),
60      id = parseMediaURL(media);
61
62    video.addEventListener("click", function () {
63      var iframe = createIframe(id);
64
65      link.remove();
66      button.remove();
67      video.appendChild(iframe);
68    });
69
70    link.removeAttribute("href");
71    video.classList.add("ttw-video_enabled");
72  }
73
74  function parseMediaURL(media) {
75    var regexp =
76        /https:\/\/i\.ytimg\.com\/vi\/([a-zA-Z0-9_-]+)\/maxresdefault\.jpg/i,
77      url = media.dataset.src,
78      match = url.match(regexp);
79
80    return match[1];
81  }
82
83  function createIframe(id) {
84    var iframe = document.createElement("iframe");
85
86    iframe.setAttribute("allowfullscreen", "");
87    iframe.setAttribute("allow", "autoplay");
88    iframe.setAttribute("src", generateURL(id));
89    iframe.classList.add("ttw-video__media");
90
91    return iframe;
92  }
93
94  function generateURL(id) {
95    var query = "?rel=0&showinfo=0&autoplay=1&mute=1";
96
97    return "https://www.youtube.com/embed/" + id + query;
98  }
99
100  findVideos(); */
101  /* Youtube video END */
102});
103
104$(function () {
105  /* Feedback form DEMO-validation */
106  
107  /* Feedback form DEMO-validation END */
108  
109  /* Leaves parallax */
110  const ttwTurnkeyLeaves = $('.ttw-turnkey-leaves');
111  let lastScrollTop = $(window).scrollTop();
112
113  ttwTurnkeyLeaves.each(function () {
114    $(this).data('shift', 0);
115  });
116
117  $(window).on('scroll', function () {
118    const scrollTop = $(this).scrollTop();
119    const scrollDirection = scrollTop > lastScrollTop ? 'down' : 'up';
120    lastScrollTop = scrollTop;
121
122    const winHeight = $(window).height();
123
124    ttwTurnkeyLeaves.each(function () {
125      const $el = $(this);
126      const elTop = $el.offset().top;
127      const elBottom = elTop + $el.outerHeight();
128
129      const inView = elBottom >= scrollTop && elTop <= scrollTop + winHeight;
130
131      if (inView) {
132        let ttwTurnkeyLeavesShift = $el.data('shift') || 0;
133        const delta = 2;
134
135        if (scrollDirection === 'down') {
136          ttwTurnkeyLeavesShift -= delta;
137        } else {
138          ttwTurnkeyLeavesShift += delta;
139        }
140
141        ttwTurnkeyLeavesShift = Math.max(Math.min(ttwTurnkeyLeavesShift, 50), -50);
142
143        $el.data('shift', ttwTurnkeyLeavesShift);
144        $el.css('transform', `translateY(${ttwTurnkeyLeavesShift}px)`);
145      }
146    });
147  });
148  /* Leaves parallax END */
149
150});

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.