PageSourceSearch

https://mymira.ai/assets/js/site.js

js mymira.ai collected 2026-10-05 15:40:13 UTC 5,084 bytes, 190 lines download raw bytes

1var path;
2
3window.onload = () => {
4    path = $('[name=path]').val();
5
6    initSvg();
7    initSliders();
8
9    onScroll();
10    $(window).on('scroll', function () {
11        onScroll();
12    });
13
14    initController();
15    onResize();
16    $(window).on('resize', function () {
17        onResize();
18        refreshController();
19    });
20
21    if (getMobileOperatingSystem() == 'unknown')
22    {
23        var head  = document.getElementsByTagName('head')[0];
24        var link  = document.createElement('link');
25        link.rel  = 'stylesheet';
26        link.type = 'text/css';
27        link.href = path + 'assets/css/cursor.css';
28        link.media = 'all';
29        head.appendChild(link);
30
31        $('body').mousemove(function(e){
32            TweenMax.to($("#cursor"), 1.5, {delay:0.1, left:e.clientX, top:e.clientY, ease:Elastic.easeOut.config(1.1, 1)});
33        });
34
35        $(document).on('mouseover mouseout', '.cursor-hover, a, .btn', function(event) {
36            if (event.type == 'mouseover') {
37                $('.cursor').addClass('hover');
38            } else {
39                $('.cursor').removeClass('hover');
40            }
41        });
42    }
43
44    new WOW().init();
45
46    var iframe = $('.bg-video iframe');
47    if (iframe.length) {
48        var player = new Vimeo.Player(iframe);
49
50        player.on('play', function () {
51            console.log('play');
52            $('.bg-video').addClass('ready');
53        });
54    }
55
56    Fancybox.bind("[data-fancybox]", {
57        // Your custom options
58    });
59
60    $('.faq__head').on('click', function () {
61        let t = $(this);
62        let item = t.closest('.faq');
63        let block = t.closest('.faq-block');
64
65        block.find('.faq').not(item).removeClass('active');
66
67        item.toggleClass('active');
68    });
69
70    fetch("assets/data/faq.json")
71        .then((res) => res.json())
72        .then((data) => renderFaq(data))
73        .catch((err) => console.error("Ошибка загрузки FAQ:", err));
74
75    $('.menu-item').on('click', function () {
76       $('body').removeClass('open');
77    });
78}
79
80function initSvg() {
81    convertSvg('img.svg').then(() => {
82        console.info('All SVGs inlined');
83    });
84}
85
86function toggleMenu() {
87    $('body').toggleClass('open');
88}
89
90function onScroll() {
91    $('header').toggleClass('scroll', $(window).scrollTop() > 150);
92}
93
94function onResize() {
95    let vw = document.documentElement.clientWidth / 100;
96    document.documentElement.style.setProperty('--vw', `${vw}px`);
97}
98
99function getMobileOperatingSystem() {
100    var userAgent = navigator.userAgent || navigator.vendor || window.opera;
101
102    // Windows Phone must come first because its UA also contains "Android"
103    if (/windows phone/i.test(userAgent)) {
104        return "Windows Phone";
105    }
106
107    if (/android/i.test(userAgent)) {
108        return "Android";
109    }
110
111    // iOS detection from: http://stackoverflow.com/a/9039885/177710
112    if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
113        return "iOS";
114    }
115
116    return "unknown";
117}
118
119function initSliders() {
120    $('.slider--app').each(function () {
121        const t = $(this);
122        const outer = t.closest('.slider-outer');
123
124        new Swiper(t[0], {
125            slidesPerView: 'auto',
126            centeredSlides: true,
127            initialSlide: 1,
128            pagination: {
129                el: outer.find('.slider-pagination')[0],
130            },
131        });
132    });
133
134    $('.slider--cards').each(function () {
135        const t = $(this);
136        const outer = t.closest('.slider-outer');
137
138        new Swiper(t[0], {
139            slidesPerView: 'auto',
140            pagination: {
141                el: outer.find('.slider-pagination')[0],
142            },
143            breakpoints: {
144                1024: {
145                    enabled: false
146                }
147            }
148        });
149    });
150}
151
152function renderFaq(faqData) {
153  const container = document.querySelector("#faq-modal");
154
155  faqData.forEach((section, index) => {
156    const titleDiv = document.createElement("div");
157    titleDiv.className = `popup__title mb-80${index !== 0 ? " mt-80" : ""}`;
158    titleDiv.innerHTML = section.title;
159    container.appendChild(titleDiv);
160
161    const grid = document.createElement("div");
162    grid.className = "grid gap-16";
163
164    section.questions.forEach((q) => {
165      const faq = document.createElement("div");
166      faq.className = "faq faq--2";
167      faq.innerHTML = `
168        <div class="faq__head">
169          <div class="faq__title">${q.question}</div>
170        </div>
171        <div class="faq__body">
172          <div><div>${q.answer}</div></div>
173        </div>
174      `;
175      grid.appendChild(faq);
176    });
177
178    container.appendChild(grid);
179  });
180
181  $(".faq__head").on("click", function () {
182    let t = $(this);
183    let item = t.closest(".faq");
184    let block = t.closest(".faq-block");
185
186    block.find(".faq").not(item).removeClass("active");
187
188    item.toggleClass("active");
189  });
190}

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.