PageSourceSearch

https://a-markets.org/wp-content/plugins/amarkets-com/js/restricted-services-popup.js?ver=403.253

js a-markets.org collected 2026-10-07 16:39:10 UTC 5,609 bytes, 129 lines download raw bytes

1jQuery(function ($) {
2    const restricted_countries_list = ['as', 'ao', 'am', 'af', 'ax', 'bj', 'bw', 'bf', 'bi', 'ca', 'cv', 'cf', 'td', 'km', 'cu', 'et', 'fm', 'ga', 'gm', 'gd', 'gu', 'gn', 'gw', 'gy', 'ht', 'hn', 'hr', 'jm', 'jp', 'kh', 'ki', 'la', 'lb', 'ls', 'lr', 'mm', 'mg', 'mw', 'mv', 'ml', 'mh', 'mr', 'mn', 'me', 'mz', 'na', 'nr', 'np', 'nz', 'ni', 'ne', 'mp', 'kp', 'pw', 'ps', 'py', 'pr', 'cg', 'sn', 'sl', 'so', 'ss', 'sd', 'sr', 'sy', 'tz', 'gb', 'us', 'vi', 've', 'ye', 'zm', 'zw', 'at', 'be', 'bg', 'cy', 'cz', 'dk', 'ee', 'fi', 'fr', 'de', 'gr', 'hu', 'is', 'ie', 'it', 'lv', 'lt', 'li', 'lu', 'mt', 'nl', 'no', 'pl', 'pt', 'ro', 'sk', 'si', 'es', 'se', 'ch', 'xk', 'vc', 'ck', 'ad', 'va', 'mc', 'sm'];
3    const countries_not_available_to_proceed = ['it', 'ro'];
4
5    get_user_country_iso();
6
7
8
9    function get_user_country_iso() {
10        $.ajax({
11            method: 'GET',
12            url: 'https://api.du3b.com/v1/client_ip',
13        }).done(function ({ iso_code, client_country }) {
14            const country_iso = (typeof iso_code === 'string') ? iso_code.toLowerCase() : '';
15            const is_country_restricted = restricted_countries_list.includes(country_iso);
16            const is_country_available_to_proceed = countries_not_available_to_proceed.includes(country_iso);
17
18            if (is_country_restricted) {
19                init_restriction_popup_logic(country_iso, client_country, is_country_available_to_proceed)
20            }
21
22        }).fail(function (response) {
23            console.log('Something went wrong with the client ip check.');
24        });
25    }
26
27    function init_restriction_popup_logic(country_iso, client_country, is_country_available_to_proceed) {
28        if (!is_country_available_to_proceed) {
29            const restriction_popup_cookie = get_restriction_popup_cookie('restriction-popup');
30
31            if (!restriction_popup_cookie) {
32                render_restriction_popup(country_iso, client_country);
33                hide_restriction_popup_on_click();
34                $('.restriction__popup-content').addClass('proceed-available');
35            }
36        } else {
37            render_restriction_popup(country_iso, client_country);
38            disable_context_menu();
39        }
40    }
41
42    function render_restriction_popup(country_iso, client_country) {
43        const the_map = ['cz', 'gm', 'mv', 'nl', 'gb', 'us'];
44        const use_the = the_map.includes(country_iso);
45
46        $('body').addClass('restriction__popup-visible overflow-hidden').append(`
47            <div class="restriction__popup-wrapper">
48                <div class="restriction__popup-content">
49                    <div class="restriction__title">You seem to be accessing our website from ${use_the ? 'the' : ''} <span class="restriction__country">${client_country}</span>.</div>
50                    <div class="restriction__txt">
51                        Unfortunately, our services are not available to citizens and residents from this country.
52                        <span class="restriction__txt-proceed">To proceed, please confirm that you're not a resident or citizen of ${use_the ? 'the' : ''} ${client_country}.</span>
53                    </div>
54                    <button class="restriction__btn">Confirm</button>
55                </div>
56            </div>
57        `);
58    }
59
60    function hide_restriction_popup_on_click() {
61        const { expires_date, global_domain } = get_cookie_options();
62
63        $('.restriction__popup-content .restriction__btn').on('click', function () {
64            $('.restriction__popup-wrapper').hide();
65            $('body').removeClass('restriction__popup-visible overflow-hidden');
66            set_restriction_popup_cookie('restriction-popup', 1, { expires: expires_date, domain: global_domain, path: '/' });
67        });
68    }
69
70    function set_restriction_popup_cookie(name, value, options) {
71        options = options || {};
72
73        let expires = options.expires;
74
75        if (typeof expires == "number" && expires) {
76            let d = new Date();
77            d.setTime(d.getTime() + expires * 1000);
78            expires = options.expires = d;
79        }
80        if (expires && expires.toUTCString) {
81            options.expires = expires.toUTCString();
82        }
83
84        value = encodeURIComponent(value);
85
86        let updatedCookie = name + "=" + value;
87
88        for (let propName in options) {
89            updatedCookie += "; " + propName;
90            const propValue = options[propName];
91            if (propValue !== true) {
92                updatedCookie += "=" + propValue;
93            }
94        }
95
96        document.cookie = updatedCookie;
97    }
98
99    function get_restriction_popup_cookie(name) {
100        const cookie_name = name + '=';
101        const ca = document.cookie.split(';');
102
103        for (let i = 0; i < ca.length; i++) {
104            let c = ca[i];
105            while (c.charAt(0)==' ') c = c.substring(1, c.length);
106            if (c.indexOf(cookie_name) == 0) {
107                return c.substring(cookie_name.length, c.length);
108            }
109        }
110
111        return null;
112    }
113
114    function get_cookie_options() {
115        const date = new Date();
116        date.setTime(date.getTime() + (24 * 60 * 60 * 1000));
117        const expires_date = "; expires=" + date.toUTCString();
118        const domain_reverse = location.hostname.split('.').reverse();
119        const global_domain = '.' + domain_reverse[1] + '.' + domain_reverse[0];
120
121        return { expires_date, global_domain };
122    }
123
124    function disable_context_menu() {
125        window.oncontextmenu = function () {
126            return false;
127        }
128    }
129});

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.