mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Simplify title: No need to observe
This commit is contained in:
parent
38ab685143
commit
130c024c3e
1 changed files with 1 additions and 19 deletions
|
|
@ -41,7 +41,7 @@
|
|||
website,
|
||||
screen,
|
||||
language,
|
||||
title,
|
||||
title: document.title,
|
||||
hostname,
|
||||
url: currentUrl,
|
||||
referrer: currentRef,
|
||||
|
|
@ -91,22 +91,6 @@
|
|||
history.replaceState = hook(history, 'replaceState', handlePush);
|
||||
};
|
||||
|
||||
const handleTitleChanges = () => {
|
||||
const observer = new MutationObserver(([entry]) => {
|
||||
title = entry && entry.target ? entry.target.text : undefined;
|
||||
});
|
||||
|
||||
const node = document.querySelector('head > title');
|
||||
|
||||
if (node) {
|
||||
observer.observe(node, {
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
childList: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleClicks = () => {
|
||||
document.addEventListener(
|
||||
'click',
|
||||
|
|
@ -226,7 +210,6 @@
|
|||
if (!initialized) {
|
||||
track();
|
||||
handlePathChanges();
|
||||
handleTitleChanges();
|
||||
handleClicks();
|
||||
initialized = true;
|
||||
}
|
||||
|
|
@ -260,7 +243,6 @@
|
|||
|
||||
let currentUrl = href;
|
||||
let currentRef = referrer.startsWith(origin) ? '' : referrer;
|
||||
let title = document.title;
|
||||
let cache;
|
||||
let initialized;
|
||||
let disabled = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue