Configure PayPal integration and cart checkout error display
This commit is contained in:
1 parent
62065828e1
commit
cf07fc5d9b
98 files changed
+1430
-281
No files matched your search
@@ -0,0 +1,24 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const map = document.querySelector('[data-studio-map-picker]');
|
||||
const pin = document.querySelector('[data-studio-map-pin]');
|
||||
const x = document.getElementById('id_x');
|
||||
const y = document.getElementById('id_y');
|
||||
if (!map || !pin || !x || !y) return;
|
||||
const refresh = () => {
|
||||
pin.hidden = ![x, y].every(field => field.value !== '' && Number(field.value) >= 0 && Number(field.value) <= 100);
|
||||
if (!pin.hidden) {
|
||||
pin.style.left = x.value + '%';
|
||||
pin.style.top = y.value + '%';
|
||||
}
|
||||
};
|
||||
map.addEventListener('click', event => {
|
||||
const box = map.getBoundingClientRect();
|
||||
const percent = (value, size) => Math.max(0, Math.min(100, 100 * value / size)).toFixed(5);
|
||||
x.value = percent(event.clientX - box.left, box.width);
|
||||
y.value = percent(event.clientY - box.top, box.height);
|
||||
refresh();
|
||||
});
|
||||
x.addEventListener('input', refresh);
|
||||
y.addEventListener('input', refresh);
|
||||
refresh();
|
||||
});
|
||||
Reference in new issue
Block a user