PageSourceSearch

https://www.oaklins.com/app/themes/oaklins/assets/js/filter.js?ver=204a398

js oaklins.com collected 2026-10-02 05:19:43 UTC 33,609 bytes, 780 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3    var filter_xhr = null;
4
5    function normalizeFilterValue(value, fallback = 'all') {
6        var normalized = value || '';
7        normalized = normalized.replace(/;+/g, ';');
8        normalized = normalized.trim();
9        normalized = normalized.replace(/;$/, '');
10        return normalized === '' ? fallback : normalized;
11    }
12
13    function readFilterValues() {
14        return {
15            country: normalizeFilterValue($('#filter_data_country').val(), 'all'),
16            city: normalizeFilterValue($('#filter_data_city').val(), 'all'),
17            firm: normalizeFilterValue($('#filter_data_firm').val(), 'all'),
18            sector: normalizeFilterValue($('#filter_data_sector').val(), 'all'),
19            sort: normalizeFilterValue($('#filter_data_sort').val(), 'jobtitle'),
20            search: ($('#filter_data_search').val() || '').trim(),
21        };
22    }
23
24    function f(baseID, n, t) {
25        var jq = $("#" + baseID + n);
26        if (jq.length) {
27            if (!jq.hasClass('active')) {
28                jq.addClass('active').delay(t).promise().done(function () {
29                    f(baseID, n + 1, t);
30                });
31            }
32        }
33    };
34
35    function hideFilterBar() {
36        // $('.filter').hide();
37        $('.filter-bar').removeClass('expanded');
38        $('.filter-link').removeClass('active');
39    }
40
41    if ($('.filter-bar').length) {
42        $('.filter-link').on('click', function (e) {
43            e.preventDefault();
44            var filterCategory = $(this).attr('data-category');
45            var filterContainerMinHeight = 400;
46            var isDealsPage = $('.deals_module').length > 0;
47            var dealsModuleMinHeight = 800;
48
49            if ($(this).hasClass('active')) {
50                $('.filter').removeClass('expanded');
51                $('.filter-bar').removeClass('expanded');
52                if (!$('.filter-arrow').hasClass('active')) $('.filter-background').removeClass('active');
53                $(this).removeClass('active');
54                if (isDealsPage) {
55                    $('.deals_module').css('min-height', '');
56                } else {
57                    $('.filter-container').css('min-height', filterContainerMinHeight + 'px');
58                }
59            } else {
60                $('.filter:not(#filter-' + filterCategory + ')').removeClass('expanded');
61                $('.filter-link').removeClass('active');
62                $(this).addClass('active');
63                $('.filter-bar').addClass('expanded');
64                $('.filter-background').addClass('active');
65                $('#filter-' + filterCategory).addClass('expanded');
66                const categoryHeight = $('#filter-' + filterCategory).height() + $('.filter-bar .bar.bg-gray').height() + 100;
67                if (isDealsPage) {
68                    if (categoryHeight > dealsModuleMinHeight) {
69                        $('.deals_module').css('min-height', categoryHeight + 'px');
70                    }
71                } else {
72                    $('.filter-container').css('min-height', (categoryHeight > filterContainerMinHeight ? categoryHeight : filterContainerMinHeight) + 'px');
73                }
74            }
75
76        });
77
78        $('.filter-arrow').on('click', function (e) {
79            e.preventDefault();
80            if ($(this).hasClass('active')) {
81                $('.filter').removeClass('expanded');
82                $('.filter-bar').removeClass('expanded');
83                $('.filter-background').removeClass('active');
84                $('.filter-link').removeClass('active');
85                $('.filter-bar .bar.bg-gray').slideUp();
86                $(this).removeClass('active');
87            } else {
88                $(this).addClass('active');
89                $('.filter-bar').addClass('expanded');
90                $('.filter-background').addClass('active');
91                $('.filter-bar .bar.bg-gray').slideDown(300);
92            }
93        });
94
95        $('.filter-background').on('click', function (e) {
96            e.preventDefault();
97            if ($('.filter-bar').hasClass('expanded')) {
98                hideFilterBar();
99            }
100        });
101
102        if ($('#filter_data_country').val() == 'all') {
103
104        } else {
105            if ($('.worker-overview').length) {
106                $('.filter-bar #filter-city li').hide();
107                $('.filter-bar #filter-country li a').each(function (i, obj) {
108                    if ($(obj).hasClass('active')) {
109                        const thisName = $(obj).attr('data-name');
110                        $('#filter_data_country').val(function (i, val) {
111                            // if (val.contains(thisName)) {
112                            //     return val;
113                            // }
114                            return val + thisName + ";";
115                        });
116                        $('.filter-bar #filter-city li a[data-country=' + thisName + ']').parent('li').show();
117                    }
118                });
119            }
120        }
121
122    }
123
124    if ($('#show-deals-r').length) {
125        if ($('#show-deals-r').html() == $('#total-deals-r').html()) {
126            $('.load-more').hide()
127        }
128    }
129
130    $(function () {
131        if ($('.worker-grid').length) {
132            var mainContent = $('.worker-grid');
133            var mainContentDiv = '.worker-grid';
134            var itemDiv = $('.worker');
135            var worker = true;
136        }
137        if ($('#deals-overview').length) {
138            var mainContent = $('#deals-overview');
139            var mainContentDiv = '#deals-overview';
140            var filtersDiv = '.filters';
141            var itemDiv = $('.deal-card');
142            var worker = false;
143        }
144        var cat_filters = $('.filter-bar .filters');
145        var sort_link = $('.sort-link');
146        var load_more = $('.load-more');
147
148        // Filtration
149
150        $("#search-form").on('submit', function (e) {
151            e.preventDefault();
152            $('.no-results').hide();
153            var mainContent = $('#deals-overview');
154            var mainContentDiv = '#deals-overview';
155            var worker = false;
156            var load_more = $('.load-more');
157            var form = $(this);
158            var encoded = encodeURIComponent($("#search").val());
159            var filters = readFilterValues();
160            var url = $('#filter_data_url').val() + '?country=' + filters.country + '&sector=' + filters.sector + '&sort=' + filters.sort + '&str=' + encoded + '&filter=1';
161            mainContent.html('');
162            $('.first-deals').remove();
163            $('.testimonial-row').remove();
164            $('.loader-contain').css({ 'top': '' + ($('.filters.bg-gray').height() + $('.bar.bg-brown').height() + $('.bar.bg-gray').height() + 96 + 48) + 'px' });
165            $('.loader-contain').stop(true, true).fadeIn();
166            $.ajax({
167                type: "GET",
168                url: url,
169                success: function (data) {
170                    $(mainContentDiv).html($(data).find(mainContentDiv).html());
171                    load_more.attr('data-pg', 2);
172                    load_more.show();
173                    Result = $(data).find('#total-results').text();
174                    if ('0' === Result || Result === '') {
175                        // $(mainContentDiv).html('<div style="height:500px"></div>');
176                        // $('.no-results').show();
177                        load_more.hide();
178                    } else {
179                        $('#total-results').html($(data).find('#total-results').text());
180                    }
181                    if (!worker) {
182                        $('#total-deals-r').html($(data).find('#total-deals-r').text());
183                        $('#total-deals-r-2').html($(data).find('#total-deals-r').text());
184                    } else {
185                        $('#total-results-all').html($(data).find('#total-results-all').text());
186                    }
187                },
188                complete: function () {
189                    var o = 0;
190                    setTimeout(function () {
191                        $('.deal-card').each(function () {
192                            o = o + 1;
193                            if (!$(this).hasClass('active')) {
194                                $(this).addClass('active');
195                            }
196                        });
197                        $('#show-deals-r').html(' ' + o + ' ');
198                        $('#show-deals-r-2').html(' ' + o + ' ');
199                        if ($('#show-deals-r').html() == $('#total-deals-r').html()) {
200                            load_more.hide()
201                        } else {
202                            load_more.show();
203                        }
204                    }, 500);
205                    $('.loader-contain').fadeOut();
206                },
207            });
208        });
209
210        // Deals keyword search (Company name)
211        $("#deals-search-form").on('submit', function (e) {
212            e.preventDefault();
213            $('.no-results').hide();
214            var mainContent = $('#deals-overview');
215            var mainContentDiv = '#deals-overview';
216            var worker = false;
217            var load_more = $('.load-more');
218            load_more.hide();
219            var searchValue = $('#deals-search-input').val().trim();
220            $('#filter_data_search').val(searchValue);
221            var encoded = encodeURIComponent(searchValue);
222            var filters = readFilterValues();
223            var url = $('#filter_data_url').val() + '?country=' + filters.country + '&sector=' + filters.sector + '&sort=' + filters.sort + '&keywords=' + encoded + '&filter=1';
224            mainContent.html('');
225            var anchorBefore = document.querySelector('.filter-bar').getBoundingClientRect().top;
226            $('.first-deals').remove();
227            $('.testimonial-row').remove();
228            var anchorAfter = document.querySelector('.filter-bar').getBoundingClientRect().top;
229            window.scrollBy({ top: anchorAfter - anchorBefore, left: 0, behavior: 'instant' });
230            $('.loader-contain').css({ 'top': '' + ($('.filters.bg-gray').height() + $('.bar.bg-brown').height() + $('.bar.bg-gray').height() + 96 + 48) + 'px' });
231            $('.loader-contain').stop(true, true).fadeIn();
232            $.ajax({
233                type: "GET",
234                url: url,
235                success: function (data) {
236                    $(mainContentDiv).html($(data).find(mainContentDiv).html());
237                    load_more.attr('data-pg', 2);
238                    Result = $(data).find('#total-results').text();
239                    if ('0' !== Result && Result !== '') {
240                        $('#total-results').html($(data).find('#total-results').text());
241                    }
242                    $('#total-deals-r').html($(data).find('#total-deals-r').text());
243                    $('#total-deals-r-2').html($(data).find('#total-deals-r').text());
244                },
245                complete: function () {
246                    var o = 0;
247                    setTimeout(function () {
248                        $('.deal-card').each(function () {
249                            o = o + 1;
250                            if (!$(this).hasClass('active')) {
251                                $(this).addClass('active');
252                            }
253                        });
254                        $('#show-deals-r').html(' ' + o + ' ');
255                        $('#show-deals-r-2').html(' ' + o + ' ');
256                        if ($('#show-deals-r').html() == $('#total-deals-r').html()) {
257                            load_more.hide()
258                        } else {
259                            load_more.show();
260                        }
261                        if (o < 15) {
262                            load_more.hide();
263                        }
264                        if (o === 0) {
265                            load_more.hide();
266                            $('.no-results').show();
267                        }
268                        $('.filter-container').css('min-height', '');
269                    }, 500);
270                    $('.loader-contain').fadeOut();
271                    window.history.pushState({ href: url }, '', url);
272                },
273            });
274        });
275
276        $('#deals-search-input').on('blur', function () {
277            var currentValue = $(this).val().trim();
278            var appliedValue = $('#filter_data_search').val() || '';
279            if (currentValue === '' && appliedValue !== '') {
280                $('#deals-search-form').trigger('submit');
281            }
282        });
283
284        // Filter links
285        cat_filters.on('click', 'li a', function (e) {
286            e.preventDefault();
287            CatEl = $(this);
288            CatName = $(this).attr('data-name');
289            CatType = $(this).attr('data-cat');
290            $('.loader-contain').css({ 'top': '' + ($('.filters.bg-gray').height() + $('.bar.bg-brown').height() + $('.bar.bg-gray').height() + 96 + 48) + 'px' });
291            $('.loader-contain').stop(true, true).fadeIn();
292            $('.no-results').hide();
293            if ($(this).hasClass('active')) {
294                $(this).removeClass('active');
295            } else {
296                $(this).addClass('active');
297            }
298
299            if (CatType == 'country') {
300                $('#filter_data_country').val('');
301                if (worker) {
302                    $('.filter-bar #filter-city li.employee-cities-filter a').removeClass('active');
303                    $('.filter-bar #filter-city li.employee-cities-filter').hide();
304                }
305                $('.filter-bar #filter-country li a').each(function (i, obj) {
306                    if ($(obj).hasClass('active')) {
307                        thisName = $(obj).attr('data-name');
308                        $('#filter_data_country').val(function (i, val) {
309                            return val + thisName + ";";
310                        });
311                        if (worker) {
312                            $('.filter-bar #filter-city li.employee-cities-filter a[data-country=' + thisName + ']').parent('li').show();
313                        }
314                    }
315                });
316                if ($('#filter_data_country').val() == '') {
317                    $('#filter_data_country').val('all');
318                    if (worker) {
319                        $('.filter-bar #filter-city li.employee-cities-filter').show();
320                    }
321                }
322                $('#filter_data_city').val('all');
323
324
325                if (worker) {
326                    $('#filter_data_firm').val('all');
327                    $('.filter-bar #filter-city li.employee-cities-filter a').removeClass('active');
328                } else {
329                    $('.filter-bar #filter-city li a').removeClass('active');
330                }
331            }
332
333            if (worker) {
334                if (CatType == 'city') {
335                    $('#filter_data_city').val('');
336                    $('.filter-bar #filter-city li.employee-cities-filter a').each(function (i, obj) {
337                        if ($(obj).hasClass('active')) {
338                            thisName = $(obj).attr('data-name');
339                            $('#filter_data_city').val(function (i, val) {
340                                return val + thisName + ";";
341                            });
342                        }
343                    });
344                    if ($('#filter_data_city').val() == '') {
345                        $('#filter_data_city').val('all');
346                    }
347                    $('#filter_data_firm').val('all');
348                }
349            }
350            if (CatType == 'sector') {
351                $('#filter_data_sector').val('');
352                $('.filter-bar #filter-sector li a').each(function (i, obj) {
353                    if ($(obj).hasClass('active')) {
354                        thisName = $(obj).attr('data-name');
355                        $('#filter_data_sector').val(function (i, val) {
356                            return val + thisName + ";";
357                        });
358                    }
359                });
360                if ($('#filter_data_sector').val() == '') {
361                    $('#filter_data_sector').val('all');
362                }
363            }
364            var filters = readFilterValues();
365            var href;
366            if (worker) {
367                href = $('#filter_data_url').val() + '?country=' + filters.country + '&city=' + filters.city + '&firm=' + filters.firm + '&sector=' + filters.sector + '&sort=' + filters.sort;
368            } else {
369                href = $('#filter_data_url').val() + '?country=' + filters.country + '&sector=' + filters.sector + '&sort=' + filters.sort + '&keywords=' + encodeURIComponent(filters.search) + '&filter=1';
370            }
371            mainContent.html('');
372            $('.no-results').hide();
373            if (!worker) {
374                var anchorBefore = document.querySelector('.filter-bar').getBoundingClientRect().top;
375                $('.first-deals').remove();
376                $('.testimonial-row').remove();
377                var anchorAfter = document.querySelector('.filter-bar').getBoundingClientRect().top;
378                window.scrollBy({ top: anchorAfter - anchorBefore, left: 0, behavior: 'instant' });
379            }
380
381            try {
382                filter_xhr.abort();
383                // console.log('abort');
384            } catch (error) {
385               // console.error(error);
386            }
387
388
389            filter_xhr = $.ajax({
390                url: href,
391                type: 'GET',
392                beforeSend: function() {
393                    $('.no-results').hide();
394                },
395                success: function (data) {
396                    $(mainContentDiv).html($(data).find(mainContentDiv).html());
397                    load_more.attr('data-pg', 2);
398                    load_more.show();
399                    Result = $(data).find('#total-results').text();
400                    if ('0' === Result || Result === '') {
401                        load_more.hide();
402                    } else {
403                        $('#total-results').html($(data).find('#total-results').text());
404                    }
405                    if (!worker) {
406                        $('#total-deals-r').html($(data).find('#total-deals-r').text());
407                        $('#total-deals-r-2').html($(data).find('#total-deals-r').text());
408
409                        updateDealsCountryFilter(filtersDiv, data);
410                        updateDealsSectorFilter(filtersDiv, data);
411                    } else {
412                        $('#total-results-all').html($(data).find('#total-results-all').text());
413                    }
414                },
415                complete: function () {
416                    if (worker) {
417                        setTimeout(function () {
418                            f('worker-', 0, 15);
419                        }, 500);
420                        var o = 0;
421                        $('.worker').each(function () {
422                            o = o + 1;
423                        });
424                        if (o < 15) {
425                            $('.load-more').hide();
426                        }
427                        if ($('#total-results').html() == $('#total-results-all').html()) {
428                            $('.load-more').hide();
429                        }
430                        if (o === 0) {
431                            $('.no-results').show();
432                        }
433                    } else {
434                        var o = 0;
435                        setTimeout(function () {
436                            $('.deal-card').each(function () {
437                                if (!$(this).hasClass('active')) {
438                                    $(this).addClass('active');
439                                }
440                            });
441                        }, 500);
442                            $('.deal-card').each(function () {
443                                o = o + 1;
444                            });
445                            $('#show-deals-r').html(' ' + o + ' ');
446                            $('#show-deals-r-2').html(' ' + o + ' ');
447                            if ($('#show-deals-r').html() == $('#total-deals-r').html()) {
448                                load_more.hide();
449                            } else {
450                                load_more.show();
451                            }
452                            if (o < 15) {
453                                $('.load-more').hide();
454                            }
455                            if (o === 0) {
456                                load_more.hide();
457                                $('.no-results').show();
458                            }
459                            $('.filter-container').css('min-height', '');
460                    }
461                    $('.loader-contain').fadeOut();
462
463                    window.history.pushState({ href: href }, '', href);
464                },
465            });
466        });
467
468        // Sort by link
469        sort_link.on('click', function (e) {
470            e.preventDefault();
471            $('.no-results').hide();
472            var load_more = $('.load-more');
473            var sorting = $(this).attr('data-sort');
474
475
476            if (sorting == 'abc') {
477                $('#filter_data_sort').val('name');
478                $(this).attr('data-sort', 'jobtitle');
479                $('.sort-abc').hide();
480                $('.sort-title ').show();
481            } else {
482                $('#filter_data_sort').val('jobtitle');
483                $(this).attr('data-sort', 'abc');
484                $('.sort-abc').show();
485                $('.sort-title ').hide();
486            }
487            $('#filter_data_sector').val('');
488            $('.filter-bar #filter-sector li a').each(function (i, obj) {
489                if ($(obj).hasClass('active')) {
490                    thisName = $(obj).attr('data-name');
491                    $('#filter_data_sector').val(function (i, val) {
492                        return val + thisName + ";";
493                    });
494                }
495            });
496            if ($('#filter_data_sector').val() == '') {
497                $('#filter_data_sector').val('all');
498            }
499            var filters = readFilterValues();
500            var href;
501            if (worker) {
502                href = $('#filter_data_url').val() + '?country=' + filters.country + '&city=' + filters.city + '&firm=' + filters.firm + '&sector=' + filters.sector + '&sort=' + filters.sort;
503            } else {
504                href = $('#filter_data_url').val() + '?country=' + filters.country + '&sector=' + filters.sector + '&sort=' + filters.sort;
505            }
506            mainContent.html('');
507            $('.loader-contain').css({ 'top': '' + ($('.filters.bg-gray').height() + $('.bar.bg-brown').height() + $('.bar.bg-gray').height() + 96 + 48) + 'px' });
508            // $('.filter-bar').addClass('expanded');
509            $('.loader-contain').stop(true, true).fadeIn();
510            load_more.hide()
511            mainContent.html('');
512            // console.log(href);
513            $.ajax({
514                url: href,
515                type: 'GET',
516                success: function (data) {
517                    $(mainContentDiv).html($(data).find(mainContentDiv).html());
518                    load_more.attr('data-pg', 2);
519                    load_more.show();
520                    Result = $(data).find('#total-results').text();
521                    if ('0' === Result || Result === '') {
522                        load_more.hide();
523                    } else {
524                        $('#total-results').html($(data).find('#total-results').text());
525                    }
526                    if (!worker) {
527                        $('#total-deals-r').html($(data).find('#total-deals-r').text());
528                        $('#total-deals-r-2').html($(data).find('#total-deals-r').text());
529                    }
530                },
531                complete: function () {
532                    if (worker) {
533                        setTimeout(function () {
534                            f('worker-', 0, 15);
535                        }, 500);
536                        var o = 0;
537                        $('.worker').each(function () {
538                            o = o + 1;
539                        });
540                        if (o < 15) {
541                            $('.load-more').hide();
542                        }
543                        if ($('#total-results').html() == $('#total-results-all').html()) {
544                            $('.load-more').hide();
545                        }
546                        if (o === 0) {
547                            $('.no-results').show();
548                        }
549                    } else {
550                        var o = 0;
551                        setTimeout(function () {
552                            $('.deal-card').each(function () {
553                                o = o + 1;
554                                if (!$(this).hasClass('active')) {
555                                    $(this).addClass('active');
556                                }
557                            });
558                            $('#show-deals-r').html(' ' + o + ' ');
559                            $('#show-deals-r-2').html(' ' + o + ' ');
560                            if ($('#show-deals-r').html() == $('#total-deals-r').html()) {
561                                load_more.hide();
562                            } else {
563                                load_more.show();
564                            }
565                            if (o < 15) {
566                                $('.load-more').hide();
567                            }
568                            if (o === 0) {
569                                load_more.hide();
570                                $('.no-results').show();
571                            }
572                        }, 500);
573                    }
574                    $('.loader-contain').fadeOut(function () {
575                        // $('.filter-bar').removeClass('expanded');
576                    });
577
578
579                },
580            });
581            window.history.pushState({ href: href }, '', href);
582        });
583
584        // Load more button
585        load_more.on('click', function (e) {
586            e.preventDefault();
587            const page = parseInt($(this).attr('data-pg'));
588
589            $('.no-results').hide();
590
591            $(this).css({ 'opacity': '0.5' });
592            $(this).attr('data-pg', page + 1);
593            $(this).toggleClass('active');
594
595            var filters = readFilterValues();
596            var href;
597            if (worker) {
598                href = $('#filter_data_url').val()
599                    + '?country=' + filters.country
600                    + '&city=' + filters.city
601                    + '&firm=' + filters.firm
602                    + '&sector=' + filters.sector
603                    + '&sort=' + filters.sort
604                    + '&nav=' + page;
605            } else {
606                href = $('#filter_data_url').val()
607                    + '?country=' + filters.country
608                    + '&sector=' + filters.sector
609                    + '&nav=' + page
610                    + '&keywords=' + encodeURIComponent(filters.search)
611                    + '&filter=1';
612            }
613
614            $.ajax({
615                url: href,
616                type: 'GET',
617                success: function (data) {
618                    load_more.css({ 'opacity': '1' });
619
620                    const theContent = $(data).find(mainContentDiv);
621                    const existingElementsCount = $(mainContentDiv).children().length;
622                    const maxElementCount = parseInt($(data).find('#total-results-all').text());
623                    let itemsToAdd;
624
625                    if (worker) {
626                        itemsToAdd = theContent.children(':nth-child(n+' + (existingElementsCount + 1) + ')');
627                        const newElementCount = existingElementsCount + itemsToAdd.length;
628                        if (newElementCount === maxElementCount) {
629                            load_more.hide();
630                        }
631                    } else {
632                        itemsToAdd = theContent.children();
633                        if (existingElementsCount + itemsToAdd.length >= maxElementCount) {
634                            load_more.hide();
635                        }
636                    }
637
638                    $(mainContentDiv).append(itemsToAdd);
639
640                    const result = parseInt($(data).find('#total-results').text());
641                    if (15 > result || '0' === result || theContent === null) {
642                        load_more.hide();
643                        // $('.no-results').show();
644                    }
645                },
646                complete: function () {
647                    if (worker) {
648                        setTimeout(function () {
649                            $('.worker').each(function () {
650                                if (!$(this).hasClass('active')) {
651                                    $(this).addClass('active');
652                                }
653                            });
654                        }, 500);
655                    } else {
656                        setTimeout(function () {
657                            var o = 0;
658                            $('.deal-card').each(function () {
659                                o = o + 1;
660                                if (!$(this).hasClass('active')) {
661                                    $(this).addClass('active');
662                                }
663                            });
664                            $('#show-deals-r').html(' ' + o + ' ');
665                            $('#show-deals-r-2').html(' ' + o + ' ');
666                            if ($('#show-deals-r').html() == $('#total-deals-r').html()) {
667                                load_more.hide();
668                            } else {
669                                // load_more.show();
670                            }
671                            if (o < 15) {
672                                $('.load-more').hide();
673                            }
674
675                        }, 500);
676                    }
677
678                    document.dispatchEvent(new Event("loadMore"));
679                },
680            });
681            window.history.pushState({ href: href }, '', href);
682        });
683    });
684
685
686    if (!$('.worker-overview').length) {
687        if ($('.deals_module').length) {
688            setTimeout(function () {
689                var o = 0;
690                $('.deal-card').each(function () {
691                    o = o + 1;
692                    if (!$(this).hasClass('active')) {
693                        $(this).addClass('active');
694                    }
695                });
696
697                $('#show-deals-r').html(' ' + o + ' ');
698                $('#show-deals-r-2').html(' ' + o + ' ');
699                if ($('#show-deals-r').html() == $('#total-deals-r').html()) {
700                    $('.load-more').hide();
701                }
702                if (o === 0) {
703                    $('.load-more').hide();
704                    $('.no-results').show();
705                }
706            }, 500);
707        }
708    }
709    if ($('.worker-overview').length) {
710        var o = 0;
711
712        $('.worker').each(function () {
713            o = o + 1;
714        });
715
716        if (o < 15) {
717            $('.load-more').hide();
718        }
719
720        if ($('#total-results').html() == $('#total-results-all').html()) {
721            $('.load-more').hide();
722        }
723
724        if (o === 0) {
725            $('.no-results').show();
726        }
727
728    }
729
730    function updateDealsCountryFilter(filtersDiv, data) {
731        const $filterCountries = $(filtersDiv).find('#filter-country');
732
733        // update countries in filter
734        $filterCountries.html($(data).find(filtersDiv).find('#filter-country').html());
735
736        // update country value
737        $('#filter_data_country').val('');
738        $(filtersDiv).find('#filter-country').find('li a').each((index, country) => {
739            if ($(country).hasClass('active')) {
740                const countryName = $(country).attr('data-name');
741                $('#filter_data_country').val(function (index, value) {
742                    return value + countryName + ";";
743                });
744            }
745        });
746
747        if ($('#filter_data_country').val() === '') {
748            $('#filter_data_country').val('all');
749        }
750
751        // update url value
752        href = $('#filter_data_url').val() + '?country=' + $('#filter_data_country').val() + '&sector=' + $('#filter_data_sector').val() + '&sort=' + $('#filter_data_sort').val() + '&filter=1';
753    }
754
755    function updateDealsSectorFilter(filtersDiv, data) {
756        const $filterSectors = $(filtersDiv).find('#filter-sector');
757
758        // update sectors in filter
759        $filterSectors.html($(data).find(filtersDiv).find('#filter-sector').html());
760
761        // update sector value
762        $('#filter_data_sector').val('');
763        $(filtersDiv).find('#filter-sector').find('li a').each((index, sector) => {
764            if ($(sector).hasClass('active')) {
765                const sectorName = $(sector).attr('data-name');
766                $('#filter_data_sector').val(function (index, value) {
767                    return value + sectorName + ";";
768                });
769            }
770        });
771
772        if ($('#filter_data_sector').val() === '') {
773            $('#filter_data_sector').val('all');
774        }
775
776        // update url value
777        href = $('#filter_data_url').val() + '?country=' + $('#filter_data_country').val() + '&sector=' + $('#filter_data_sector').val() + '&sort=' + $('#filter_data_sort').val() + '&filter=1';
778    }
779
780});

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.