PageSourceSearch

https://kazan-opera.ru/local/custom.js?1790964687

js kazan-opera.ru collected 2026-10-02 18:11:49 UTC 11,889 bytes, 449 lines download raw bytes

1
2
3/* kazan-opera-cookie-notice:start */
4(function (window, document) {
5  'use strict';
6
7  var pixelId = '14100';
8  var trackingSrc = 'https://culturaltracking.ru/static/js/spxl.js?pixelId=' + pixelId;
9  var storageKey = 'kazanOperaCookieNoticeSeen';
10  var cookieName = 'kazan_opera_cookie_notice_seen';
11  var noticeHtml = [
12    '<p>Необходимые cookie помогают сайту работать. Статистику посещений включим только после вашего согласия.</p>'
13  ].join('');
14
15  function onReady(callback) {
16    if (document.readyState === 'loading') {
17      document.addEventListener('DOMContentLoaded', callback);
18    } else {
19      window.setTimeout(callback, 0);
20    }
21  }
22
23  function hasCookie() {
24    return document.cookie.split(';').some(function (item) {
25      return item.trim().indexOf(cookieName + '=') === 0;
26    });
27  }
28
29  function isSeen() {
30    try {
31      if (window.localStorage && window.localStorage.getItem(storageKey) === '1') {
32        return true;
33      }
34    } catch (error) {}
35
36    return hasCookie();
37  }
38
39  function markSeen() {
40    try {
41      if (window.localStorage) {
42        window.localStorage.setItem(storageKey, '1');
43      }
44    } catch (error) {}
45
46    document.cookie = cookieName + '=1; max-age=31536000; path=/; SameSite=Lax';
47  }
48
49  function initCulturalTracking() {
50    var scripts = document.getElementsByTagName('script');
51
52    for (var i = 0; i < scripts.length; i += 1) {
53      var src = scripts[i].getAttribute('src') || '';
54      var dataPixelId = scripts[i].getAttribute('data-pixel-id');
55
56      if (dataPixelId === pixelId || src.indexOf('culturaltracking.ru/static/js/spxl.js?pixelId=' + pixelId) !== -1) {
57        return;
58      }
59    }
60
61    var script = document.createElement('script');
62    script.async = true;
63    script.src = trackingSrc;
64    script.setAttribute('data-pixel-id', pixelId);
65    (document.head || document.body || document.documentElement).appendChild(script);
66  }
67
68  function ensureContent(modal) {
69    var text = modal.querySelector('.modal-cookies-text');
70
71    if (text && text.textContent.indexOf('Цифровая культура') === -1) {
72      text.innerHTML = noticeHtml;
73    }
74  }
75
76  function ensureButton(modal) {
77    var existing = modal.querySelector('.kazan-cookie-notice-accept');
78    var link = modal.querySelector('.cookies-link');
79
80    if (existing) {
81      return existing;
82    }
83
84    var button = document.createElement('button');
85    button.type = 'button';
86    button.className = 'kazan-cookie-notice-accept';
87    button.textContent = 'Принять';
88
89    if (link && link.parentNode) {
90      link.parentNode.insertBefore(button, link.nextSibling);
91    } else {
92      modal.appendChild(button);
93    }
94
95    return button;
96  }
97
98  function resetPageLock() {
99    var scrollTop = document.documentElement.getAttribute('data-scroll') || '0';
100    var firstScreen = document.querySelector('.first-screen');
101    var header = document.querySelector('header');
102    var pageContent = document.querySelector('.page-content');
103
104    if (document.body.classList.contains('page-inner')) {
105      if (header && header.classList.contains('fixed')) {
106        if (firstScreen) {
107          firstScreen.style.marginTop = '0';
108        }
109      } else if (header) {
110        header.style.marginTop = '0';
111      }
112    } else if (pageContent) {
113      pageContent.style.marginTop = '0';
114    }
115
116    document.body.classList.remove('fixed');
117    window.scrollTo(0, parseInt(scrollTop, 10) || 0);
118  }
119
120  function lockPage() {
121    var scroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
122    var firstScreen = document.querySelector('.first-screen');
123    var header = document.querySelector('header');
124    var pageContent = document.querySelector('.page-content');
125
126    document.documentElement.setAttribute('data-scroll', scroll);
127
128    if (document.body.classList.contains('page-inner')) {
129      if (header && header.classList.contains('fixed')) {
130        if (firstScreen) {
131          firstScreen.style.marginTop = -scroll + 'px';
132        }
133      } else if (header) {
134        header.style.marginTop = -scroll + 'px';
135      }
136    } else if (pageContent) {
137      pageContent.style.marginTop = -scroll + 'px';
138    }
139  }
140
141  function fallbackClose(overlay) {
142    var modal = overlay.querySelector('.modal');
143    overlay.style.display = 'none';
144
145    if (modal) {
146      modal.classList.remove('active');
147    }
148
149    resetPageLock();
150  }
151
152  function fallbackOpen(overlay) {
153    var modal = overlay.querySelector('.modal');
154    lockPage();
155    overlay.style.display = 'block';
156
157    if (modal) {
158      window.setTimeout(function () {
159        modal.classList.add('active');
160        document.body.classList.add('fixed');
161      }, 10);
162    } else {
163      document.body.classList.add('fixed');
164    }
165  }
166
167  function openCookieModal(overlay) {
168    var modal = overlay.querySelector('.modal');
169
170    overlay.style.display = 'block';
171
172    if (modal) {
173      window.setTimeout(function () {
174        modal.classList.add('active');
175      }, 10);
176    }
177  }
178
179  function initCookieNotice() {
180    var overlay = document.getElementById('modalCookies');
181
182    if (!overlay || overlay.getAttribute('data-kazan-cookie-ready') === '1') {
183      return;
184    }
185
186    var modal = overlay.querySelector('.modal') || overlay;
187    var button;
188    overlay.setAttribute('data-kazan-cookie-ready', '1');
189
190    ensureContent(modal);
191    button = ensureButton(modal);
192
193    button.addEventListener('click', function () {
194      markSeen();
195      initCulturalTracking();
196      fallbackClose(overlay);
197    });
198
199    overlay.addEventListener('click', function (event) {
200      if (event.target.closest('.modal-close, .overlay-close')) {
201        markSeen();
202        window.setTimeout(function () {
203          if (window.getComputedStyle(overlay).display !== 'none') {
204            fallbackClose(overlay);
205          }
206        }, 180);
207        return;
208      }
209
210    }, true);
211
212    var wrap = overlay.querySelector('.modal-wrap');
213    if (wrap) {
214      wrap.addEventListener('click', function (event) {
215        if (event.target === wrap) {
216          markSeen();
217        }
218      }, true);
219    }
220
221    if (!isSeen() && window.location.pathname.indexOf('/cookies/') !== 0) {
222      openCookieModal(overlay);
223    }
224  }
225
226  onReady(initCookieNotice);
227})(window, document);
228/* kazan-opera-cookie-notice:end */
229
230/* kazan-opera-metrika-goals:start */
231(function (window, document) {
232  'use strict';
233
234  var counterId = 10312915;
235  var lastGoalKey = '';
236  var lastGoalTime = 0;
237
238  function onReady(callback) {
239    if (document.readyState === 'loading') {
240      document.addEventListener('DOMContentLoaded', callback);
241    } else {
242      window.setTimeout(callback, 0);
243    }
244  }
245
246  function cleanText(value) {
247    return (value || '').replace(/\s+/g, ' ').trim().slice(0, 120);
248  }
249
250  function getPath() {
251    return window.location.pathname || '/';
252  }
253
254  function getHref(element) {
255    return element ? (element.getAttribute('href') || '') : '';
256  }
257
258  function closest(element, selector) {
259    while (element && element.nodeType === 1) {
260      if (element.matches && element.matches(selector)) {
261        return element;
262      }
263      element = element.parentElement;
264    }
265    return null;
266  }
267
268  function reachGoal(goal, params) {
269    var now = Date.now();
270    var goalKey = goal + ':' + (params && (params.href || params.target || params.path) || '');
271
272    if (goalKey === lastGoalKey && now - lastGoalTime < 700) {
273      return;
274    }
275
276    lastGoalKey = goalKey;
277    lastGoalTime = now;
278
279    if (typeof window.ym === 'function') {
280      window.ym(counterId, 'reachGoal', goal, params || {});
281    }
282  }
283
284  function defaultParams(extra) {
285    var params = {
286      host: window.location.hostname,
287      path: getPath()
288    };
289    var key;
290
291    for (key in extra) {
292      if (Object.prototype.hasOwnProperty.call(extra, key) && extra[key] !== '') {
293        params[key] = extra[key];
294      }
295    }
296
297    return params;
298  }
299
300  function trackClick(event) {
301    var target = event.target;
302    var phoneLink = closest(target, 'a[href^="tel:"]');
303    var mailLink = closest(target, 'a[href^="mailto:"]');
304    var buyLink = closest(target, '.buy-ticket, .header_m-buy, a[href*="/about/buy/"], a[href*="kassir.ru"]');
305    var calendarToggle = closest(target, '.calendar-toggle');
306    var searchToggle = closest(target, '.search-toggle');
307    var searchButton = closest(target, '.search__btn');
308    var bviButton = closest(target, '.bvi-open-btn');
309    var cookieAccept = closest(target, '.kazan-cookie-notice-accept');
310    var socialLink = closest(target, '.mobile-nav__social-link');
311
312    if (phoneLink) {
313      reachGoal('PHONE_CLICK', defaultParams({
314        href: getHref(phoneLink)
315      }));
316      return;
317    }
318
319    if (mailLink) {
320      reachGoal('EMAIL_CLICK', defaultParams({
321        href: getHref(mailLink)
322      }));
323      return;
324    }
325
326    if (buyLink) {
327      reachGoal('BUY_TICKET_CLICK', defaultParams({
328        href: getHref(buyLink),
329        text: cleanText(buyLink.textContent)
330      }));
331      return;
332    }
333
334    if (calendarToggle) {
335      reachGoal('CALENDAR_OPEN', defaultParams({
336        target: 'calendar'
337      }));
338      return;
339    }
340
341    if (searchToggle) {
342      reachGoal('SEARCH_OPEN', defaultParams({
343        target: 'site_search'
344      }));
345      return;
346    }
347
348    if (searchButton) {
349      reachGoal('SEARCH_SUBMIT', defaultParams({
350        target: 'site_search'
351      }));
352      return;
353    }
354
355    if (bviButton) {
356      reachGoal('ACCESSIBILITY_OPEN', defaultParams({
357        target: 'bvi'
358      }));
359      return;
360    }
361
362    if (cookieAccept) {
363      reachGoal('COOKIE_ACCEPT', defaultParams({
364        target: 'cookie_notice'
365      }));
366      return;
367    }
368
369    if (socialLink) {
370      reachGoal('SOCIAL_CLICK', defaultParams({
371        href: getHref(socialLink),
372        text: cleanText(socialLink.getAttribute('title') || socialLink.textContent)
373      }));
374    }
375  }
376
377  function trackSubmit(event) {
378    if (closest(event.target, '.search__form')) {
379      reachGoal('SEARCH_SUBMIT', defaultParams({
380        target: 'site_search'
381      }));
382    }
383  }
384
385  function trackKeydown(event) {
386    if ((event.key === 'Enter' || event.keyCode === 13) && event.target && event.target.id === 'searchQuery') {
387      reachGoal('SEARCH_SUBMIT', defaultParams({
388        target: 'site_search'
389      }));
390    }
391  }
392
393  onReady(function () {
394    document.addEventListener('click', trackClick, true);
395    document.addEventListener('submit', trackSubmit, true);
396    document.addEventListener('keydown', trackKeydown, true);
397  });
398
399  window.kazanOperaReachGoal = reachGoal;
400})(window, document);
401/* kazan-opera-metrika-goals:end */
402
403(function ($) {
404	if (!$ || !$.fancybox) {
405		return;
406	}
407
408	document.addEventListener('click', function (e) {
409		var link = e.target.closest && e.target.closest('a[href^="https://widget.kassir.ru/"]');
410		if (!link) {
411			return;
412		}
413
414		e.preventDefault();
415		e.stopPropagation();
416
417		var width = parseInt(link.getAttribute('data-modal-width'), 10) || 900;
418		var height = parseInt(link.getAttribute('data-modal-height'), 10) || 900;
419
420		$.fancybox.open({
421			src: link.href,
422			type: 'iframe',
423			opts: {
424				baseClass: 'ksr-modal',
425				toolbar: false,
426				smallBtn: false,
427				arrows: false,
428				infobar: false,
429				iframe: {
430					css: {
431						width: width + 'px',
432						height: height + 'px'
433					}
434				},
435				afterShow: function (instance, slide) {
436					var $content = slide.$slide.find('.fancybox-content');
437					if ($content.find('.ksr-modal-close').length) {
438						return;
439					}
440					$('<button type="button" class="ksr-modal-close" aria-label="Закрыть"><span aria-hidden="true">&times;</span></button>')
441						.appendTo($content)
442						.on('click', function () {
443							instance.close();
444						});
445				}
446			}
447		});
448	}, true);
449})(window.jQuery);

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.