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;
|
documentLoadStyle.textContent = documentLoadCSS;
|
||||||
document.head.appendChild(documentLoadStyle);
|
document.head.appendChild(documentLoadStyle);
|
||||||
|
|
||||||
const icons =
|
function replaceIcons() {
|
||||||
document.querySelectorAll<HTMLLinkElement>('link[rel*="icon"]');
|
document
|
||||||
|
.querySelectorAll<HTMLLinkElement>('link[rel*="icon"]')
|
||||||
|
.forEach((link) => {
|
||||||
|
if (link.href !== icon48) {
|
||||||
|
link.href = icon48;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
icons.forEach((link) => {
|
replaceIcons();
|
||||||
link.href = icon48;
|
|
||||||
|
const observer = new MutationObserver(() => {
|
||||||
|
replaceIcons();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
observer.observe(document.head, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true,
|
||||||
|
attributes: true,
|
||||||
|
attributeFilter: ["href", "rel"],
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await initializeSettingsState();
|
await initializeSettingsState();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user