PageSourceSearch

https://www.bn.ru/bn-frontend/assets/a14af2cb/js/youtube-popup.js?v=1787649371

js bn.ru collected 2026-09-24 08:45:47 UTC 5,117 bytes, 120 lines download raw bytes

1// BNRU-3157, BNRU-3325
2if (!hBlockVideoIsClosedByUser) {
3    var hBlockVideoIsClosedByUser = 0;
4}
5$(document).ready(function () {
6
7    let popup = $('.video-popup');
8    if (parseInt(popup.length) === 1) {
9        let type = popup.data('type');
10        let id = popup.data('id');
11
12        $('.video-popup__button-phone').bind('click', function () {
13            let item = $(this);
14            if (item.attr('href') == '') {
15                item.html(item.data('phone-formatted'));
16                item.attr('href', 'tel:' + item.data('phone'));
17
18                $.post('/api_v2/hit/', {id: id, action: 'youtube-click'}, function (data) {}, 'json');
19                if (typeof (yaCounter481062) != 'undefined') {
20                    yaCounter481062.reachGoal('video_click_button');
21                }
22                return false;
23            }
24            return true;
25        });
26        $('.video-popup__button-url').bind('click', function () {
27            $.post('/api_v2/hit/', {id: id, action: 'youtube-click'}, function (data) {}, 'json');
28            if (typeof (yaCounter481062) != 'undefined') {
29                yaCounter481062.reachGoal('video_click_button');
30            }
31        });
32        $('.youtube-popup__close').bind('click', function () {
33            popup.remove();
34        });
35
36        // фиксируем показ
37        $.post('/api_v2/hit/', {id: id, action: 'youtube-show'}, function (data) {}, 'json');
38        if (typeof (yaCounter481062) != 'undefined') {
39            yaCounter481062.reachGoal('video_show_block');
40        }
41    }
42
43    // ---------------
44
45    var hWindow = $(window);
46
47    var hBlockVideo = $('#youtube-popup-video__container');
48    var hBlockVideoTopLast = 0;
49    var hBlockVideoStub = $('#youtube-popup-video__stub');
50    $('.youtube-popup-video__button-close').bind('click', function (e) {
51        e.preventDefault();
52        e.stopPropagation();
53        $(this).addClass('youtube-popup-video__button-close-hidden');
54        hBlockVideo.removeClass('youtube-popup-video__container-fixed');
55        hBlockVideoStub.css('weight', 0);
56        hBlockVideoStub.css('height', 0);
57        hBlockVideoStub.css('margin-bottom', 0);
58        hBlockVideoIsClosedByUser = 1;
59        $('#youtube-popup-video')
60            .css('width', '200px')
61            .css('height', '113px');
62
63        // BNRU-3313
64        if (player) {
65            player.stopVideo();
66        }
67        return false;
68    });
69
70    window.addEventListener('scroll', function () {
71
72        if (hBlockVideo.length) {
73            var hBlockVideoTop = hBlockVideo.length ? Math.round(hBlockVideo.offset().top) : 0;
74            var hBlockVideoWidth = hBlockVideo.length ? Math.round(hBlockVideo.outerWidth()) : 0;
75            var hBlockVideoHeight = hBlockVideo.length ? Math.round(hBlockVideo.outerHeight()) : 0;
76            var intScroll = hWindow.scrollTop();
77            if ((intScroll > hBlockVideoTop + hBlockVideoHeight) && (hBlockVideoIsClosedByUser === 0)) {
78                if (!hBlockVideo.hasClass('youtube-popup-video__container-fixed')) {
79                    hBlockVideo.addClass('youtube-popup-video__container-fixed');
80                    hBlockVideoStub.css('weight', hBlockVideoWidth);
81                    hBlockVideoStub.css('height', hBlockVideoHeight);
82                    hBlockVideoStub.css('margin-bottom', '10px');
83                    $('.youtube-popup-video__button-close').removeClass('youtube-popup-video__button-close-hidden');
84                    $('#youtube-popup-video')
85                        .css('width', '480px')
86                        .css('height', '270px');
87
88                    // vk
89                    let type = $('#youtube-popup-video[data-type="vk"]').data('type');
90                    if (type && (type === 'vk')) {
91                        $('#youtube-popup-video[data-type="vk"] iframe')
92                            .css('width', '480px')
93                            .css('height', '270px');
94                    }
95                }
96                hBlockVideoTopLast = intScroll;
97            }
98            if (intScroll < hBlockVideoTopLast) {
99                if (hBlockVideo.hasClass('youtube-popup-video__container-fixed')) {
100                    hBlockVideo.removeClass('youtube-popup-video__container-fixed');
101                    hBlockVideoStub.css('weight', 0);
102                    hBlockVideoStub.css('height', 0);
103                    hBlockVideoStub.css('margin-bottom', 0);
104                    $('.youtube-popup-video__button-close').addClass('youtube-popup-video__button-close-hidden');
105                    $('#youtube-popup-video')
106                        .css('width', '200px')
107                        .css('height', '113px');
108
109                    // vk
110                    let type = $('#youtube-popup-video[data-type="vk"]').data('type');
111                    if (type && (type === 'vk')) {
112                        $('#youtube-popup-video[data-type="vk"] iframe')
113                            .css('width', '200px')
114                            .css('height', '113px');
115                    }
116                }
117            }
118        }
119    }, false);
120});

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.