PageSourceSearch

https://www.nsktv.ru/bitrix/templates/gtrk_main/js/main.js?163661973910791

js nsktv.ru collected 2026-10-01 10:43:28 UTC 10,791 bytes, 307 lines download raw bytes

1var h1_sp_arr = new Array();
2var doc_height = '';
3
4$(document).ready(function () {
5
6
7    var input = document.querySelectorAll('.datepicker-here')[0];
8    var dateInputMask = function dateInputMask(elm) {
9        elm.addEventListener('keypress', function (e) {
10            if (e.keyCode < 47 || e.keyCode > 57) {
11                e.preventDefault();
12            }
13
14            var len = elm.value.length;
15
16            if (len < 11) {
17                // If we're at a particular place, let the user type the slash
18                // i.e., 12/12/1212
19                if (len !== 1 || len !== 3) {
20                    if (e.keyCode == 47) {
21                        e.preventDefault();
22                    }
23                }
24                // If they don't add the slash, do it for them...
25                if (len === 2) {
26                    elm.value += '.';
27                }
28                // If they don't add the slash, do it for them...
29                if (len === 5) {
30                    elm.value += '.';
31                }
32            } else {
33                e.preventDefault();
34            }
35        });
36    };
37    dateInputMask(input);
38
39    jQuery('div.datepicker-here').datepicker({
40        onSelect: function(fd, date) {
41            var href = '/news/?date=' + fd;
42            jQuery('a#airsearch').attr('href', href);
43            window.location.href = href;
44            $('.datepicker.-left-top-.-from-left-').removeClass('active');
45            $('.datepicker.-left-top-.-from-left-').css('left', -100000);
46        }
47    });
48 
49    $('input.datepicker-here').on('change', function () {
50        var href = '/news/?date=' + this.value;
51        jQuery('a#airsearch').attr('href', href);
52    });
53
54    $('input#search').on('change', function () {
55        var href = '/search/?q=' + this.value;
56        jQuery('#text_search').attr('href', href);
57    });
58
59    $('input.datepicker-here').keypress(function (e) {
60        if (e.keyCode == 13) {
61            var href = '/news/?date=' + this.value;
62            jQuery('a#airsearch').attr('href', href);
63            window.location.href = href;
64        }
65    });
66
67    doc_height = getDocHeight();
68    setProductScrollPosition();
69    var search = ({
70        init: function () {
71            this.$el = $('.search');
72            this.bind();
73        },
74        bind: function () {
75            var _this = this;
76            this.$el.click(function (e) {
77                _this.show()
78                e.stopPropagation();
79            });
80            $('span.title__dossier-link').click(function (e) {
81                e.stopPropagation();
82            });
83            $('body').click(function () {
84                _this.hide()
85            })
86        },
87        show: function () {
88            this.$el.addClass('search_open').find('.search__form').animate({
89                width: 250
90            }, 300, function () {
91                $('.search__text').css({'width': '200px', 'padding': '0 10px'});
92            });
93        },
94        hide: function () {
95            this.$el.removeClass('search_open').find('.search__form, .search__text').attr('style', '');
96        }
97    }).init();
98
99    $('.nav li.root.dropdown').on('mouseover', function () {
100        $('.nav').addClass('inherit');
101        $(this).find('ul').css('display', 'block');
102    }).on('mouseout', function () {
103        $(this).find('ul').css('display', 'none');
104        $('.nav').removeClass('inherit');
105    });
106
107    if (document.body.clientWidth >= 1194) {
108        $('.top-modules .big-border').css({left: $('.top-modules .big').width() + 'px', display: 'block'});
109        $('.top-modules .small-border').css({
110            left: $('.top-modules .big').width() + $('.top-modules .small').eq(0).width() - 1 + 'px',
111            top: 0
112        });
113    } else {
114        $('.top-modules .big-border').css('display', 'none');
115        $('.top-modules .small-border').css({
116            left: $('.top-modules .small').eq(0).width() - 1 + 'px',
117            top: $('.top-modules .big').outerHeight() + 'px'
118        });
119    }
120
121    $('#wrapper-content-block .news-page li .img-block a').on('mouseover', function () {
122        $(this).closest('.item-content').find('.name a').addClass('hover');
123    }).on('mouseout', function () {
124        $(this).closest('.item-content').find('.name a').removeClass('hover');
125    });
126
127    $('.top-news-list li').eq(2).addClass('third');
128    $('.top-news-list li').eq(3).addClass('fourth');
129
130    var content_width = $('#wrapper-content-block').width();
131    $('.search-field-block').css('width', (content_width - 40) + 'px');
132    $('.search-field-block input[name="q"]').css('width', (content_width - 60) + 'px');
133
134    $(document).scroll(function () {
135        $('.datepicker.-left-top-.-from-left-').removeClass('active');
136        $('.datepicker.-left-top-.-from-left-').css('left', -100000);
137        $('div#calendar').removeClass('open');
138        $('div#air_calendar').removeClass('open');
139    });
140
141    $(document).on("click", 'div#calendar', function (e) {
142        e.preventDefault();
143        if ($('#air_calendar').hasClass('close')) {
144            $('#air_calendar').removeClass('close');
145            $('#air_calendar').addClass('open');
146            $('#calendar').removeClass('close');
147            $('#calendar').addClass('open');
148
149            if ($('.header_search').hasClass('opensearch')) {
150                $('.header_search').removeClass('opensearch');
151            }
152        } else {
153            if (e.target != jQuery('#air_calendar')) {
154                $('#air_calendar').addClass('close');
155                $('#air_calendar').removeClass('open');
156                $('#calendar').addClass('close');
157                $('#calendar').removeClass('open');
158
159                if ($('.header_search').hasClass('opensearch')) {
160                    $('.header_search').removeClass('opensearch');
161                }
162            }
163        }
164    });
165
166    function remove_element(from_element_pos, to_element_pos, method, from_class, to_class) {
167        if (from_element_pos >= 0 && to_element_pos >= 0) {
168            var selector_from = '.main-content-block ul li.item';
169            if (typeof from_class != "undefined" && from_class != "") selector_from += '.' + from_class;
170            elem = $(selector_from).eq(from_element_pos).detach();
171            var selector_to = '.main-content-block ul li.item';
172            if (typeof to_class != "undefined" && to_class != "") selector_to += '.' + to_class;
173            if (method == "" || method == "after") {
174                $(selector_to).eq(to_element_pos).after(elem);
175            } else if (method == "before") {
176                $(selector_to).eq(to_element_pos).before(elem);
177            }
178        }
179    }
180
181    $('#news-feed-list-block-toggle div.arrows').on('mouseover', function () {
182        $(this).addClass('hover');
183    }).on('mouseout', function () {
184        $(this).removeClass('hover');
185    });
186
187    $('#news-feed-list-block-toggle div.arrows').on('click', function () {
188        if ($(this).hasClass("open")) {
189            $(this).removeClass("open");
190            $("#news-feed-list-block").hide();
191            $("#wrapper-content-block").css("margin-left", "20px");
192        } else {
193            $(this).addClass("open");
194            $("#news-feed-list-block").show();
195            $("#wrapper-content-block").css("margin-left", "240px");
196        }
197    });
198
199    if (isTouch()) {
200        $("#news-feed-list-block-toggle").css("display", "block");
201        $("#news-feed-list-block-toggle div.arrows").removeClass("open");
202        $("#news-feed-list-block").hide();
203    }
204});
205
206$(window).resize(function () {
207    var content_width = $('#wrapper-content-block').width();
208    $('.search-field-block').css('width', (content_width - 40) + 'px');
209    $('.search-field-block input[name="q"]').css('width', (content_width - 60) + 'px');
210
211    if (document.body.clientWidth >= 1194) {
212        $('.top-modules .big-border').css({left: $('.top-modules .big').width() + 'px', display: 'block'});
213        $('.top-modules .small-border').css({
214            left: $('.top-modules .big').width() + $('.top-modules .small').eq(0).width() - 1 + 'px',
215            top: 0
216        });
217    } else {
218        $('.top-modules .big-border').css('display', 'none');
219        $('.top-modules .small-border').css({
220            left: $('.top-modules .small').eq(0).width() - 1 + 'px',
221            top: $('.top-modules .big').outerHeight() + 'px'
222        });
223    }
224    setProductScrollPosition(true);
225});
226
227$(window).load(function () {
228    setProductScrollPosition(true);
229});
230
231function isTouch() {
232    try {
233        document.createEvent("TouchEvent");
234        return true;
235    } catch (e) {
236        return false;
237    }
238}
239
240function setCookie(name, value, days) {
241    if (days) {
242        var date = new Date();
243        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
244        var expires = "; expires=" + date.toGMTString();
245    } else var expires = "";
246    document.cookie = name + "=" + encodeURIComponent(value) + expires + "; path=/";
247}
248
249function getCookie(name) {
250    var nameEQ = name + "=";
251    var ca = document.cookie.split(';');
252    for (var i = 0; i < ca.length; i++) {
253        var c = ca[i];
254        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
255        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
256    }
257    return null;
258}
259
260function eraseCookie(name) {
261    setCookie(name, "", -1);
262}
263
264function getDocHeight() {
265    var D = document;
266    return Math.max(
267        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
268        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
269        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
270    );
271}
272
273function setProductScrollPosition(recalc) {
274    if (typeof $('#wrapper').offset() != "undefined") {
275        var m = $('#wrapper').offset().top + 64 - $(window).scrollTop();
276        var h = $(window).height() - $('#wrapper').offset().top + 64;
277
278        if (m >= 0) {
279            $('#news-feed-list-block').css('top', m + 'px');
280        } else {
281            var right_block_height = $('#news-feed-list-block').height();
282            var footer_height = $('footer.footer').height();
283            var t = $(window).scrollTop() + right_block_height + footer_height + 62;
284
285            if (!recalc) {
286                var dh = doc_height;
287            } else {
288                var dh = getDocHeight();
289                doc_height = dh;
290            }
291
292            if (t > dh) {
293                $('#news-feed-list-block').css('top', (dh - t) + 'px');
294            } else {
295                $('#news-feed-list-block').css('top', '0');
296            }
297        }
298    }
299}
300
301$(window).scroll(function () {
302    setProductScrollPosition(true);
303});
304
305$(document).bind('DOMSubtreeModified', function () {
306    setProductScrollPosition(true);
307});

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.