PageSourceSearch

https://thecelticstar.com/wp-content/plugins/brand-management-plugin/public/js/bm-toplist-footitalia.js

js thecelticstar.com collected 2026-10-02 11:35:27 UTC 4,204 bytes, 97 lines download raw bytes

1(function ($) {
2    'use strict';
3
4    $(document).ready(function () {
5        const toplistWrapperSelector = '.toplist-footitalia__wrapper';
6        const toplistOfferSelector = '.toplist-footitalia__offer';
7        const toplistShowMoreBtn = '.toplist-footitalia__show-more-btn';
8
9        const tryRebuildShortcode = () => {
10            if (typeof window.BM_tryRebuildShortcodesByGeoFilters === 'function') {
11                window.BM_tryRebuildShortcodesByGeoFilters('toplist_footitalia', 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: 'Footitalia Toplist',
22                    selectors: {
23                        cta: '.toplist-footitalia__offer-cta-btn',
24                        offer: toplistOfferSelector,
25                        rating: '.toplist-footitalia__offer-rating-value',
26                        title: '.toplist-footitalia__offer-title',
27                    },
28                });
29            }
30        };
31
32        const initCopyCouponButton = (toplistWrapperSelector) => {
33            $(toplistWrapperSelector)
34                .find('.toplist-footitalia__offer-coupon-code-wrapper')
35                .click(function () {
36                    const couponCodeWrapper = $(this);
37                    const couponCode = $(couponCodeWrapper).find('.toplist-footitalia__offer-coupon-code').first();
38                    const couponCodeText = $(couponCodeWrapper).data('coupon-code');
39                    const textCopied = $(couponCodeWrapper).data('text-copied');
40
41                    navigator.clipboard.writeText(couponCodeText);
42                    $(couponCode).addClass('coupon-code-copied').text(textCopied);
43                    setTimeout(function () {
44                        $(couponCode).removeClass('coupon-code-copied').text(couponCodeText);
45                    }, 1000);
46                });
47        };
48
49        const initShowMoreBtn = (toplistWrapperSelector) => {
50            const showMoreBtn = $(toplistWrapperSelector).find(toplistShowMoreBtn).first();
51
52            if (typeof showMoreBtn !== 'undefined') {
53                $(showMoreBtn).click(function () {
54                    if (toplistWrapperSelector.hasClass('require_ajax_update') && !toplistWrapperSelector.hasClass('rebuilt')) {
55                        tryRebuildShortcode();
56                        return;
57                    }
58
59                    if ($(toplistWrapperSelector).find('[data-filter-tag-id]').length) {
60                        $(toplistWrapperSelector).find('[data-filter-tag-id]').first().trigger('click');
61                    } else {
62                        $(toplistWrapperSelector).find(toplistOfferSelector).removeClass('hidden');
63                    }
64                    $(showMoreBtn).remove();
65                });
66            }
67        };
68
69        const initShortcode = () => {
70            tryRebuildShortcode();
71
72            $(toplistWrapperSelector).each(function () {
73                initDataLayer($(this));
74                initCopyCouponButton($(this));
75                initShowMoreBtn($(this));
76                if (typeof window.BM_initFilter === 'function') {
77                    window.BM_initFilter($(this), {
78                        wrapper: toplistWrapperSelector,
79                        offer: toplistOfferSelector,
80                        filterWrapper: '.toplist-footitalia__filter-wrapper',
81                        filterTag: '.toplist-footitalia__filter-tag',
82                        filterTagsJson: '.toplist-footitalia__filter-tags-json',
83                        offersWrapper: '.toplist-footitalia__offers',
84                        offerLogo: '.toplist-footitalia__offer-logo',
85                        showMoreBtn: toplistShowMoreBtn,
86                    });
87                }
88            });
89        };
90
91        const init = () => {
92            initShortcode();
93        };
94
95        init();
96    });
97})(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.