PageSourceSearch

https://www.dialog.ua/js/scripts.js?ver=5

js dialog.ua collected 2026-10-02 06:55:51 UTC 5,345 bytes, 153 lines download raw bytes

1// open mobile menu
2
3$('.js-toggle-menu,.mobile-menu-head__close').click(function (e) {
4    
5        $('.header_contn').find("nav").css({'display':'block'});
6    e.preventDefault();
7    $('.mobile-header-nav').slideToggle();
8    $(this).toggleClass('open');
9});
10
11    $(document).on('click','.open',function(){
12    $('.header_contn').find("nav").css({'display':'none'});
13    })
14
15
16$(document).ready(function () {
17    $('.button,.mobile-menu-head__close').click(function () {
18        if ($('.main-menu,.top-content-menu,.top-mobile-menu,.overlay,body,.menu-column').hasClass('open')) {
19            $('.main-menu,.top-content-menu,.top-mobile-menu,.overlay,body,.menu-column').removeClass('open');
20        } else {
21            $('.main-menu,.top-content-menu,.top-mobile-menu,.overlay,body,.menu-column').addClass('open');
22        }
23    });
24    $('.mobile-menu-head__close').click(function () {
25        if ($('.button').hasClass('open')) {
26            $('.button').removeClass('open');
27        } else {
28            $('.button').addClass('open');
29        }
30    });
31    $('.overlay').click(function () {
32        $('.mobile-header-nav').toggle(0);
33        $('.js-toggle-menu,.mobile-menu-head__close').removeClass('open');
34        $('.main-menu,.top-content-menu,.top-mobile-menu,.overlay,body,.menu-column').removeClass('open');
35        
36    });
37});
38
39$(document).on('click','.active_more', function(){
40    var link = $(this);
41    var form = $('form.load_more_data');
42    var limit = parseInt(form.find('input[name=limit]').val());
43    var offset = parseInt(form.find('input[name=offset]').val());
44    var location = parseInt(form.find('input[name=location]').val());
45    var lastDate = form.find('input[name=last_date]');
46    var contentBlock = $('.content_all_news');
47    if(limit && offset){
48        $.ajax({
49            type: 'POST',
50            url : '/more_news',
51            data: form.serialize(),
52            success : function(response){
53                if(response.success) {
54                    link.detach();
55                    if(location === 1 || location === 8) {
56                        contentBlock = $('.last-news');
57                        contentBlock.append(response.html);
58                        link.insertAfter(contentBlock);
59                    } else {
60                        if (response.appendToLast) {
61                            lastBlock = contentBlock.find('.news').last();
62                            lastBlock.css('marginBottom', 0);
63                            lastBlock.find('.new-item').last().css('border-bottom', '1px solid #d6d6d6');
64                        }
65                        contentBlock.append(response.html);
66                        contentBlock.append(link);
67                    }
68                    form.find('input[name=limit]').val(limit);
69                    form.find('input[name=offset]').val(offset + limit);
70                    lastDate.val(response.lastDate);
71                }
72            }
73        });
74    }
75    return false;
76});
77
78function addLink() {
79    //Get the selected text and append the extra info
80    var selection = window.getSelection(),
81        pagelink = '<br /><br /> читайте подробнее на сайте "Диалог.UA": ' + document.location.href,
82        copytext = selection + pagelink,
83        newdiv = document.createElement('div');
84
85    //hide the newly created container
86    newdiv.style.position = 'absolute';
87    newdiv.style.left = '-99999px';
88
89    //insert the container, fill it with the extended text, and define the new selection
90    document.body.appendChild(newdiv);
91    newdiv.innerHTML = copytext;
92    selection.selectAllChildren(newdiv);
93
94    window.setTimeout(function () {
95        document.body.removeChild(newdiv);
96    }, 100);
97}
98
99document.addEventListener('copy', addLink);
100
101
102$(document).on('click','.open-comments', function(){
103    $('.fb-comments').toggle();
104});
105
106[].forEach.call(document.querySelectorAll('img[data-src]'), function (img) {
107    img.setAttribute('src', img.getAttribute('data-src'));
108    img.onload = function () {
109        img.removeAttribute('data-src');
110    };
111});
112
113$(document).on('click', '.cookie-accept-btn', function () {
114    setCookie('policy-accepted', '1', {'max-age': 31536000, 'domain': '.dialog.ua'});
115    $('.cookie-policy').toggle();
116});
117
118function getCookie(name) {
119    let matches = document.cookie.match(new RegExp(
120        "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
121    ));
122    return matches ? decodeURIComponent(matches[1]) : undefined;
123}
124
125function setCookie(name, value, options = {}) {
126
127    options = {
128        path: '/',
129        // при необходимости добавьте другие значения по умолчанию
130        ...options
131    };
132
133    if (options.expires instanceof Date) {
134        options.expires = options.expires.toUTCString();
135    }
136
137    let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
138
139    for (let optionKey in options) {
140        updatedCookie += "; " + optionKey;
141        let optionValue = options[optionKey];
142        if (optionValue !== true) {
143            updatedCookie += "=" + optionValue;
144        }
145    }
146    document.cookie = updatedCookie;
147}
148
149setTimeout(function () {
150    if (getCookie('policy-accepted') === undefined) {
151        $('.cookie-policy').toggle();
152    }
153}, 5000);

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.