PageSourceSearch

https://slipperysnake.co.uk/wp-content/plugins/brand-management-plugin-3.30.5/public/js/bm-toplist-techcity.js

js slipperysnake.co.uk collected 2026-09-24 08:54:01 UTC 3,155 bytes, 78 lines download raw bytes

1(function ($) {
2    'use strict';
3
4    $(document).ready(function () {
5        const toplistWrapperSelector = '.toplist-techcity__wrapper';
6        const toplistOfferSelector = '.toplist-techcity__offer';
7        const toplistShowMoreBtn = '.toplist-techcity__show-more-btn';
8
9        const tryRebuildShortcode = () => {
10            if (typeof window.BM_tryRebuildShortcodesByGeoFilters === 'function') {
11                window.BM_tryRebuildShortcodesByGeoFilters('toplist_techcity', initShortcode, {
12                    wrapper: toplistWrapperSelector,
13                    offer: toplistOfferSelector,
14                });
15            }
16        };
17
18        const initDataLayer = (toplistWrapperSelector) => {
19            if (typeof window.dataLayer_initCampaignEvents === 'function') {
20                window.dataLayer_initCampaignEvents(toplistWrapperSelector, {
21                    type: 'Techcity Toplist',
22                    selectors: {
23                        cta: '.toplist-techcity__offer-cta-btn',
24                        offer: toplistOfferSelector,
25                        title: '.toplist-techcity__offer-title',
26                    },
27                });
28            }
29        };
30
31        const initShowMoreBtn = (toplistWrapperSelector) => {
32            const showMoreBtn = $(toplistWrapperSelector).find(toplistShowMoreBtn).first();
33
34            if (typeof showMoreBtn !== 'undefined') {
35                $(showMoreBtn).click(function () {
36                    if (toplistWrapperSelector.hasClass('require_ajax_update') && !toplistWrapperSelector.hasClass('rebuilt')) {
37                        tryRebuildShortcode();
38                        return;
39                    }
40
41                    if ($(toplistWrapperSelector).find('[data-filter-tag-id]').length) {
42                        $(toplistWrapperSelector).find('[data-filter-tag-id]').first().trigger('click');
43                    } else {
44                        $(toplistWrapperSelector).find(toplistOfferSelector).removeClass('hidden');
45                    }
46                    $(showMoreBtn).remove();
47                });
48            }
49        };
50
51        const initShortcode = () => {
52            tryRebuildShortcode();
53
54            $(toplistWrapperSelector).each(function () {
55                initDataLayer($(this));
56                initShowMoreBtn($(this));
57                if (typeof window.BM_initFilter === 'function') {
58                    window.BM_initFilter($(this), {
59                        wrapper: toplistWrapperSelector,
60                        offer: toplistOfferSelector,
61                        filterWrapper: '.toplist-techcity__filter-wrapper',
62                        filterTag: '.toplist-techcity__filter-tag',
63                        filterTagsJson: '.toplist-techcity__filter-tags-json',
64                        offersWrapper: '.toplist-techcity__offers',
65                        offerLogo: '.toplist-techcity__offer-logo',
66                        showMoreBtn: toplistShowMoreBtn,
67                    });
68                }
69            });
70        };
71
72        const init = () => {
73            initShortcode();
74        };
75
76        init();
77    });
78})(jQuery);

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.