mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
fix: Favicon race condition
Fixes a race condition due to the way the Tes logo has been implemented.
This commit is contained in:
+21
-4
@@ -50,13 +50,30 @@ async function init() {
|
||||
documentLoadStyle.textContent = documentLoadCSS;
|
||||
document.head.appendChild(documentLoadStyle);
|
||||
|
||||
const icons =
|
||||
document.querySelectorAll<HTMLLinkElement>('link[rel*="icon"]');
|
||||
function replaceIcons() {
|
||||
document
|
||||
.querySelectorAll<HTMLLinkElement>('link[rel*="icon"]')
|
||||
.forEach((link) => {
|
||||
if (link.href !== icon48) {
|
||||
link.href = icon48;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
icons.forEach((link) => {
|
||||
link.href = icon48;
|
||||
replaceIcons();
|
||||
|
||||
const observer = new MutationObserver(() => {
|
||||
replaceIcons();
|
||||
});
|
||||
|
||||
observer.observe(document.head, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
attributes: true,
|
||||
attributeFilter: ["href", "rel"],
|
||||
});
|
||||
|
||||
|
||||
try {
|
||||
await initializeSettingsState();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user