PageSourceSearch

https://freelance.ru/assets/c574aee2/freelancers.js?v=1790077322

js freelance.ru collected 2026-09-24 08:26:57 UTC 8,734 bytes, 233 lines download raw bytes

1/** resize work preview background image */
2(function( $ ){
3    $.fn.bg_size = function( options ) {
4         const config = $.extend(  {
5            'ident'             : 1.4,
6            'sized_class'       : 'work-img-sized',
7            'big_class'         : 'work-img-sized-as-big',
8            'small_class'       : 'work-img-sized-as-small'
9        }, options);
10
11            const set_size = function (el) {
12            let bgImgWidth = $(el).data('real-width') * config.ident;
13            let bgImgHeight = $(el).data('real-height') * config.ident;
14
15            if(bgImgWidth < $(el).outerWidth() || bgImgHeight < $(el).outerHeight()) {
16
17                $(el).removeClass(config.big_class).addClass(config.small_class);
18            }
19            else {
20                $(el).removeClass(config.small_class).addClass(config.big_class);
21            }
22            $(el).addClass(config.sized_class);
23        }
24
25        return this.each(function(i,el) {
26
27            if($(el).hasClass(config.sized_class) || $(el).outerHeight() < 1 ) return;
28
29            if($(el).data('real-width') && $(el).data('real-height') )
30            {
31                 set_size(el);
32            } else {
33                let img = new Image();
34                img.src = $(el).css('background-image').replace(/url\(/ig,'').replace(/\)$/ig,'').replace(/"/ig,'');
35                img.onload= function() {
36                    $(el)
37                        .data('real-width', img.width)
38                        .data('real-height',img.height)
39                        .bg_size();
40                    $(this).remove();
41                }
42            }
43        });
44
45    };
46})( jQuery );
47
48// lazy loading images -old  version
49$(".lazy").Lazy({
50    beforeLoad: function(element) {
51        // called before an elements gets handled
52        element.addClass('lazy-loading').find('img').show();
53    },
54    afterLoad: function(element) {
55        // called after an element was successfully handled
56        element.removeClass('lazy-loading')
57            .addClass('lazy-loaded')
58            .bg_size()
59            .find('img')
60            .each( function() { $(this).fadeOut('slow') });
61    }
62});
63
64// refresh works previews images size
65$( window ).resize(function() { $('.user-card  a.work.lazy-loaded').removeClass('work-img-sized').bg_size(); } );
66
67// create offers items clickable
68$( function() {
69    $('.offer-item-with-text').each(
70        function() {
71            let s_href = $(this).find('.item-link').data('href');
72            let s_title = $(this).find('h5').text().trim();
73            $(this).find('.item-link').remove();
74            $(this).append(
75                $('<a/>').css({ 'z-index':'2', 'position': 'absolute', 'top': '0', 'left':'0', 'height': '100%', 'width': '100%'})
76                    .attr('href',s_href)
77                    .attr('title',s_title)
78            )
79            ;
80        }
81    );
82});
83
84/**  выпадающее под-меню специализаций */
85const SpecsDropdownMenu = {
86    selector: {
87        dropdown: '.specs-dropdown-menu',
88        more: '.specs-dropdown-menu .toggle-more',
89        all: '.specs-dropdown-menu .all-specs',
90        categories: '.specs-dropdown-menu .all-specs .spec-cat',
91        specs: '.specs-dropdown-menu .all-specs .sub-specs-well',
92        id_prefix: '#specWell',
93    },
94    init: function ( ) {
95        this.initToggleButton();
96       // this.initSpecsOpen();
97    },
98    // init toggle specs submenu button
99    initToggleButton : function() {
100        $(this.selector.more).click( function (e) {
101            e.preventDefault();
102            $(this).find('b').toggleClass('caret fa fa-caret-up');
103            $(SpecsDropdownMenu.selector.all).slideToggle();
104        });
105    },
106    // subspecs disabled
107    // initSpecsOpen: function() {
108    //     $(this.selector.categories).click( function (e) {
109    //         e.preventDefault();
110    //         SpecsDropdownMenu.specOpen($(this));
111    //     });
112    // },
113    // subspec disabled
114    // specOpen : function(el) {
115    //     // toggle active category el
116    //     $(this.selector.categories).not(this).removeClass('active');
117    //     $(this).toggleClass('active');
118    //
119    //     // toggle spec lists
120    //     let cur_well = $(this.selector.id_prefix + $(el).data('well-id'));
121    //     $(this.selector.specs).not(cur_well).slideUp('fast');
122    //     cur_well.slideToggle();
123    // }
124};
125
126
127$('select[name="m"]').change(function() {
128    let selectedText = $(this).find('option:selected').attr('data');
129    $('#searchsimple-squery').attr('placeholder', selectedText);
130});
131
132
133// Инициализация для каждого контейнера где надо прокрутку
134   $('.work-row-block .work-row-container.work-row-container-with-scroll').each(function () {
135       const $container = $(this);
136       const $outer = $container.find('.work-row-outer');
137       const $leftButton = $container.find('.scroll-button.left');
138       const $rightButton = $container.find('.scroll-button.right');
139
140       // Функция для обновления видимости кнопок
141       const updateButtons = () => {
142           const scrollLeft = Math.ceil($outer.scrollLeft());
143           const maxScroll = Math.ceil($outer[0].scrollWidth - $outer[0].clientWidth)
144
145
146           // Скрыть левую кнопку, если прокрутка влево невозможна
147           if (scrollLeft <= 0) {
148               $leftButton.addClass('hidden');
149           } else {
150               $leftButton.removeClass('hidden');
151           }
152
153           // Скрыть правую кнопку, если прокрутка вправо невозможна
154           if (scrollLeft + 15 >= maxScroll) {
155               $rightButton.addClass('hidden');
156           } else {
157               $rightButton.removeClass('hidden');
158           }
159       };
160
161
162       // Прокрутка влево
163       $leftButton.on('click', function () {
164           $outer.animate({ scrollLeft: '-=300' }, 300);
165       });
166
167       // Прокрутка вправо
168       $rightButton.on('click', function () {
169           $outer.animate({ scrollLeft: '+=300' }, 300);
170       });
171
172       // Обновить кнопки при загрузке страницы
173       updateButtons();
174
175       // Обновить кнопки при прокрутке
176       $outer.on('scroll', updateButtons);
177
178       // Горизонтальная прокрутка колесом мыши
179       $outer.on('wheel', function (e) {
180           e.preventDefault(); // Отменяем стандартное поведение
181
182           // Используем deltaX для горизонтальной прокрутки, если она есть
183           // Иначе используем deltaY для вертикальной прокрутки
184           const delta = e.originalEvent.deltaX || e.originalEvent.deltaY;
185
186          //const currentScroll = $(this).scrollLeft();
187           //const targetScroll = currentScroll + delta;
188           //console.log(delta, currentScroll, targetScroll);
189
190           const step = Math.abs(Math.ceil(delta * 3));    // Размер шага
191
192            // Формируем строку в правильном формате
193           const scrollValue = delta > 0 ? `+=${step}` : `-=${step}`;
194           $outer.animate({ scrollLeft: scrollValue }, 100);
195
196           // Обновляем видимость кнопок
197           //updateButtons();
198       });
199   });
200
201// Портфолио-стрип в карточках каталога (.flc-pf-wrap--scroll)
202$('.flc-pf-wrap--scroll').each(function () {
203    const $wrap  = $(this);
204    const $strip = $wrap.find('.flc-pf-strip');
205    const $left  = $wrap.find('.flc-pf-nav--left');
206    const $right = $wrap.find('.flc-pf-nav--right');
207
208    const update = () => {
209        const sl  = Math.ceil($strip.scrollLeft());
210        const max = Math.ceil($strip[0].scrollWidth - $strip[0].clientWidth);
211        $left.toggleClass('is-hidden',  sl <= 0);
212        $right.toggleClass('is-hidden', sl + 5 >= max);
213    };
214
215    $left.on('click',  () => $strip.animate({ scrollLeft: '-=300' }, 300, update));
216    $right.on('click', () => $strip.animate({ scrollLeft: '+=300' }, 300, update));
217
218    $strip.on('scroll', update);
219
220    $strip.on('wheel', function (e) {
221        e.preventDefault();
222        const delta = e.originalEvent.deltaX || e.originalEvent.deltaY;
223        const step  = Math.abs(Math.ceil(delta * 3));
224        $strip.animate({ scrollLeft: (delta > 0 ? '+=' : '-=') + step }, 100);
225    });
226
227    update();
228});
229
230$(document).ready(function () {
231    // lazy loading images new
232    $(".work-row-block .work-card .work-card-image-lazy").Lazy();
233});

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.