PluginProbe
MakeCommerce for WooCommerce / 3.0.11
MakeCommerce for WooCommerce v3.0.11
4.1.1 4.1.0 4.0.8 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.0 2.2.1 All 97 releases
makecommerce / payment / gateway / woocommerce / js / mc_method_list.js

mc_method_list.js in MakeCommerce for WooCommerce 3.0.11, at payment/gateway/woocommerce/js/mc_method_list.js

72 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function($) {
2
3 function method_list_set(pick = false) {
4
5 if (pick) {
6 MC_METHOD_LIST.pick = pick; //allows changing payment method country after it has been automatically selected via paylater
7 }
8
9 var selectedCountry = MC_METHOD_LIST.country;
10
11 if ( MC_METHOD_LIST.banklinksgroupedcount == 1 ) {
12
13 jQuery('li.makecommerce-picker-country').show();
14 jQuery('div.makecommerce_country_picker_countries').hide();
15 jQuery('li.makecommerce-picker-country > input, li.makecommerce-picker-country > label').hide();
16 } else {
17
18 makecommercePick();
19
20 jQuery('body').on('change', 'select[name=makecommerce_country_picker_select]', function() {
21 if (MC_METHOD_LIST.pick) {
22 selectedCountry = jQuery(this).val();
23 }
24
25 jQuery('input[name=makecommerce_country_picker]').removeAttr('checked');
26 makecommercePick();
27 });
28
29 jQuery('body').on('change', 'input[name=makecommerce_country_picker]', function() {
30
31 if (jQuery(this).is(":checked")) {
32 if (MC_METHOD_LIST.pick) {
33 selectedCountry = jQuery(this).val();
34 }
35
36 jQuery('select[name=makecommerce_country_picker_select]').val(selectedCountry);
37 makecommercePick();
38 }
39 });
40
41 function makecommercePick() {
42
43 jQuery('select#'+MC_METHOD_LIST.id).val('');
44 jQuery('div.makecommerce-banklink-picker').removeClass('selected');
45 jQuery('label.makecommerce_country_picker_label').removeClass('selected');
46
47 if ( MC_METHOD_LIST.settings.ui_widget_groupcountries || MC_METHOD_LIST.settings.ui_widget_groupcountries == 'no' ) {
48 jQuery('li.makecommerce-picker-country').hide();
49 }
50
51 jQuery('div#makecommerce_country_picker_methods_' + selectedCountry).parent().show();
52 jQuery('label[for=makecommerce_country_picker_' + selectedCountry + ']').addClass('selected');
53 }
54 }
55
56 jQuery('div.makecommerce-banklink-picker').on('click', function() {
57
58 var banklink_id = jQuery(this).attr('banklink_id');
59
60 jQuery('select#'+MC_METHOD_LIST.id).val(banklink_id);
61 jQuery('div.makecommerce-banklink-picker').removeClass('selected');
62 jQuery(this).addClass('selected');
63 });
64 }
65
66 method_list_set();
67
68 //update also on checkout ajax updates
69 jQuery( document.body ).on( 'updated_checkout', function() {
70 method_list_set(true);
71 });
72 });