mirror of
https://github.com/umami-software/umami.git
synced 2026-02-17 19:15:37 +01:00
Script simplification: Greatly clarify element tracking logic
This commit is contained in:
parent
671dcfceb5
commit
b26fc15fa0
1 changed files with 10 additions and 12 deletions
|
|
@ -112,15 +112,16 @@
|
||||||
const eventName = parentElement.getAttribute(eventNameAttribute);
|
const eventName = parentElement.getAttribute(eventNameAttribute);
|
||||||
if (!eventName) return;
|
if (!eventName) return;
|
||||||
|
|
||||||
if (parentElement.tagName === 'A') {
|
if (parentElement.tagName === 'BUTTON') {
|
||||||
|
return trackElement(parentElement);
|
||||||
|
}
|
||||||
|
if (parentElement.tagName === 'A' && href) {
|
||||||
const external =
|
const external =
|
||||||
target === '_blank' ||
|
target === '_blank' ||
|
||||||
e.ctrlKey ||
|
e.ctrlKey ||
|
||||||
e.shiftKey ||
|
e.shiftKey ||
|
||||||
e.metaKey ||
|
e.metaKey ||
|
||||||
(e.button && e.button === 1);
|
(e.button && e.button === 1);
|
||||||
|
|
||||||
if (eventName && href) {
|
|
||||||
if (!external) e.preventDefault();
|
if (!external) e.preventDefault();
|
||||||
return trackElement(parentElement).then(() => {
|
return trackElement(parentElement).then(() => {
|
||||||
if (!external) {
|
if (!external) {
|
||||||
|
|
@ -128,9 +129,6 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (parentElement.tagName === 'BUTTON') {
|
|
||||||
return trackElement(parentElement);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue