PageSourceSearch

https://dom.com.cy/local/templates/new.live/js/script.js

js dom.com.cy collected 2026-10-01 10:45:08 UTC 5,200 bytes, 178 lines download raw bytes

1$(function() {
2    checkFormFields();
3});
4
5$(document).on('copy input keyup', 'input, textarea', function() {
6    if ($(this).closest('.form-custom').length > 0)
7    {
8        if ($(this).hasClass('field-danger'))
9            $(this).removeClass('field-danger');
10
11        checkFormField(this);
12    }
13});
14
15function checkFormField (field)
16{
17    if ($(field).val() != '') {
18        $(field).removeClass('empty_field');
19    } else {
20        $(field).addClass('empty_field');
21    }
22}
23
24function checkFormFields ()
25{
26    $.each($('.form-custom').find('input, textarea'), function(i, field) {
27        checkFormField(field);
28    });
29}
30
31$(document).on('click', '.button-menu-mobile', function() {
32    $.fancybox.open($('.main_menu-mobile'), {
33        touch: false,
34        baseClass: 'main_menu-mobile-fancybox-base'
35    });
36});
37
38$(document).on('mouseenter mouseleave click', '.rating:not(.disabled) .star', function(e) {
39    switch(e.type)
40    {
41        case 'mouseenter':
42            $(this).addClass('to_rate');
43            $(this).parent().find('.star:lt(' + $(this).index() + ')').addClass('to_rate');
44            $(this).parent().find('.star:gt(' + $(this).index() + ')').addClass('no_to_rate');
45            break
46        case 'mouseleave':
47            $(this).parent().find('.star').removeClass('to_rate');
48            $(this).parent().find('.star:gt(' + $(this).index() + ')').removeClass('no_to_rate');
49            break;
50        case 'click':
51            $(this).removeClass('to_rate').addClass('rated');
52            $(this).parent().find('.star:lt(' + $(this).index() + ')').removeClass('to_rate').addClass('rated');
53            $(this).parent().find('.star:gt(' + $(this).index() + ')').removeClass('no_to_rate').removeClass('rated');
54
55            $('.rating').next().val($(this).parent().find('.star.rated').length);
56            break;
57    }
58});
59
60$(document).on('click', '.favorite_link', function() {
61    var _this = $(this);
62    var id = _this.data('id');
63    var iblock_id = _this.data('iblock-id');
64    var action = 'add';
65    if (id > 0 && iblock_id > 0)
66    {
67        if (_this.hasClass('active'))
68            action = 'delete';
69
70        $.ajax({
71            url: '/ajax/favorite.php',
72            data: {
73                id: id,
74                iblock_id: iblock_id,
75                action: action
76            },
77            method: 'POST',
78            dataType: 'json',
79            success: function(res) {
80                if (res.status == 'success')
81                {
82                    if (action == 'add')
83                        _this.addClass('active');
84                    else
85                        _this.removeClass('active');
86                }
87            }
88        });
89    }
90});
91$(window).scroll(function () {
92    if ($(this).scrollTop() != 0) {
93        $(".js-top").fadeIn();
94    } else {
95        $(".js-top").fadeOut();
96    }
97});
98$(".js-top").click(function () {
99    $("body,html").animate(
100        {
101            scrollTop: 0,
102        },
103        800
104    );
105});
106
107$('.article__detail-image .copy').on('click', function(){
108    let copyUrl = document.location.href
109    copyUrl = copyUrl.split('/');
110    if (copyUrl[2].includes('work')){
111        copyUrl[2] = 'dom.com.cy';
112    }
113    if (copyUrl[copyUrl.length - 1] && copyUrl[copyUrl.length - 1][0] == '?'){
114        copyUrl[copyUrl.length - 1] = ''
115    }
116    copyUrl = copyUrl.join('/');
117    navigator.clipboard.writeText(copyUrl).then(function() {
118        console.log('Copied!');
119    }, function() {
120        console.log('Copy error')
121    });
122});
123
124function setCookie(name, value, options = {})
125{
126    options = {
127        path: '/'
128    };
129    if (options.expires instanceof Date)
130    {
131        options.expires = options.expires.toUTCString();
132    }
133    let updatedCookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
134    for (let optionKey in options)
135    {
136        updatedCookie += '; ' + optionKey;
137        if (options[optionKey] !== true)
138        {
139            updatedCookie += '=' + options[optionKey];
140        }
141    }
142    document.cookie = updatedCookie;
143}
144
145$(document).on('scroll', lazyload);
146$(window).on('resize', lazyload);
147$(window).on('load', lazyload);
148
149// Очень похожая функция есть в templates/main/js/functions.js ???
150// let lazyloadThrottleTimeout;
151function lazyload ()
152{
153    if (lazyloadThrottleTimeout)
154    {
155        clearTimeout(lazyloadThrottleTimeout);
156    }
157    lazyloadThrottleTimeout = setTimeout(
158        function()
159        {
160            $('img[data-src]').each(
161                function(i, img)
162                {
163                    if (img.offsetTop < (window.innerHeight + window.pageYOffset))
164                    {
165                        img.src = img.dataset.src;
166                        $(img).removeAttr('data-src');
167                    }
168                }
169            );
170            if (!$('img[data-src]').length)
171            {
172                $(document).off('scroll', lazyload);
173                $(window).off('resize', lazyload);
174            }
175        },
176        20
177    );
178}

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.