PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / public / js / wc / checkout.js
ameliabooking / public / js / wc Last commit date
checkout.js 1 year ago
checkout.js
34 lines
1 function setAmeliaFieldValue(selector, value) {
2 let element = document.querySelector(selector);
3
4 if (typeof element !== 'undefined' && element) {
5 const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set;
6 const prototype = Object.getPrototypeOf(element);
7 const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set;
8
9 if (valueSetter && valueSetter !== prototypeValueSetter) {
10 prototypeValueSetter.call(element, value);
11 } else {
12 valueSetter.call(element, value);
13 }
14
15 element.dispatchEvent(new Event('input', { bubbles: true }));
16 }
17 }
18
19 document.addEventListener('DOMContentLoaded', function() {
20 if ('ameliaCustomer' in window) {
21 let ameliaCustomerInterval = setInterval(
22 function () {
23 if (document.body.classList.contains('woocommerce-checkout')) {
24 clearInterval(ameliaCustomerInterval);
25
26 Object.keys(ameliaCustomer).forEach((key) => {
27 setAmeliaFieldValue('#' + key, ameliaCustomer[key]);
28 })
29 }
30 }, 500
31 )
32 }
33 });
34