PageSourceSearch

https://ciderhouse.ee/wp-content/plugins/everypay-payment-gateway-…/assets/js/script.js?ver=20191011

js ciderhouse.ee collected 2026-10-10 01:10:43 UTC 3,949 bytes, 125 lines download raw bytes

1jQuery(function($) {
2
3    /**
4     * Payment methods select class.
5     *
6     * @param string method_name
7     * @return this
8     */
9    function PaymentMethodsSelect(method_name)
10    {
11        var _selectors = {
12            wrapper: 'li.payment_method_' + method_name,
13            labels: 'label.payment-method-option, label.payment-token-option',
14            method_inputs: 'label.payment-method-option input',
15            token_inputs: 'label.payment-token-option input',
16            preferred_country: '.preferred-country select'
17        };
18
19        var _listeners = {
20            method_inputs: undefined,
21            token_inputs: undefined,
22            preferred_country: undefined
23        };
24
25        /**
26         * Change preferred country event.
27         *
28         * @param DOM radio
29         * @return void
30         */
31        this.change_country = function(radio) {
32            var country = radio.value;
33            this.unselect();
34            jQuery(_selectors.token_inputs, _selectors.wrapper).prop('checked', false);
35            jQuery(_selectors.method_inputs, _selectors.wrapper).prop('checked', false).each(function() {
36                var method_country = jQuery(this).data('country');
37                if(!method_country || country == method_country) {
38                    jQuery(this).parents(_selectors.labels).removeClass('hidden');
39                } else {
40                    jQuery(this).parents(_selectors.labels).addClass('hidden');
41                }
42            });
43        };
44
45        /**
46         * Change method event.
47         *
48         * @param DOM radio
49         * @return void
50         */
51        this.select = function(radio) {
52            this.unselect();
53            if(radio.checked) {
54                jQuery(radio).parents(_selectors.labels).addClass('selected');
55            }
56        };
57
58        /**
59         * Deselect all methods.
60         *
61         * @return void
62         */
63        this.unselect = function() {
64            jQuery(_selectors.labels, _selectors.wrapper).removeClass('selected');
65        };
66
67        /**
68         * Update events.
69         *
70         * @return void
71         */
72        this.update = function() {
73            this.clear();
74            this.listeners();
75        };
76
77        /**
78         * Remove events.
79         *
80         * @return void
81         */
82        this.clear = function() {
83            if(_listeners.method_inputs) {
84                _listeners.method_inputs.unbind('change');
85            }
86            if(_listeners.token_inputs) {
87                _listeners.token_inputs.unbind('change');
88            }
89            if(_listeners.preferred_country) {
90                _listeners.preferred_country.unbind('change');
91            }
92        };
93
94        /**
95         * Add events.
96         *
97         * @return void
98         */
99        this.listeners = function() {
100            var self = this;
101     
102            _listeners.method_inputs = jQuery(_selectors.method_inputs, _selectors.wrapper).on('change', function(event) {
103                jQuery(_selectors.token_inputs, _selectors.wrapper).prop('checked', false);
104                self.select.call(self, this);
105            });
106
107            _listeners.token_inputs = jQuery(_selectors.token_inputs, _selectors.wrapper).on('change', function(event) {
108                jQuery(_selectors.method_inputs, _selectors.wrapper).prop('checked', false);
109                self.select.call(self, this);
110            });
111
112            _listeners.preferred_country = jQuery(_selectors.preferred_country, _selectors.wrapper).on('change', function(event) {
113                self.change_country.call(self, this);
114            });
115        };
116    }
117
118    var names = everypay_payment_method_settings.names;
119    $.each(names, function(key, name) {
120        var payment_methods_select = new PaymentMethodsSelect(name);
121        $('body').on('updated_checkout', function() {
122            payment_methods_select.update();
123        });
124    });
125});

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.