diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-12 06:43:51 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-12 06:43:51 +0530 |
| commit | a6f62616b7c10092451cb2b7d6ed5c7c5b250712 (patch) | |
| tree | 785456fbe40cb256c1cdcf8eb5b5e67e06c31d95 /src/scripts/optimize.ts | |
| parent | 1caecf35a2d0ee81cedea40ccbd4ad4150bca2f8 (diff) | |
| download | banglar-bhumi-utils-a6f62616b7c10092451cb2b7d6ed5c7c5b250712.tar.gz banglar-bhumi-utils-a6f62616b7c10092451cb2b7d6ed5c7c5b250712.zip | |
Added home page optimizations.
Diffstat (limited to 'src/scripts/optimize.ts')
| -rw-r--r-- | src/scripts/optimize.ts | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/scripts/optimize.ts b/src/scripts/optimize.ts deleted file mode 100644 index 3994333..0000000 --- a/src/scripts/optimize.ts +++ /dev/null @@ -1,30 +0,0 @@ -const replace: (any[] | undefined)[] = [ - ["head > script:nth-child(34)", { src: "" }], - ["head > script:nth-child(43)", { src: "" }] -]; -let count = 0; - -const observer = new MutationObserver(() => { - for (let i = 0; i < replace.length; i++) { - if (replace[i]) { - const element = document.querySelector(replace[i]![0]) as HTMLElement | null; - if (element) { - const attributes = replace[i]![1]; - if (attributes.innerHTML) { - element.innerHTML = attributes.innerHTML; - } - attributes.innerHTML = undefined; - for (const attribute in attributes) { - element.setAttribute(attribute, attributes[attribute]); - } - replace[i] = undefined; - count++; - if (count >= replace.length) { - observer.disconnect(); - break; - } - } - } - } -}); -observer.observe(document, {childList: true, subtree: true}); |
