diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/scripts.json | 2 | ||||
| -rw-r--r-- | src/scripts/optimize.ts (renamed from src/scripts/block-unnecessary.ts) | 16 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/scripts.json b/src/scripts.json index 8e8d0bd..ee042b2 100644 --- a/src/scripts.json +++ b/src/scripts.json @@ -1,6 +1,6 @@ { "before": { - "block-unnecessary.ts": "*" + "optimize.ts": "*" }, "injected": { "stop-blocking.js": "*" diff --git a/src/scripts/block-unnecessary.ts b/src/scripts/optimize.ts index 65d610a..3994333 100644 --- a/src/scripts/block-unnecessary.ts +++ b/src/scripts/optimize.ts @@ -1,25 +1,19 @@ -let replace: (any[] | undefined)[] = [ +const replace: (any[] | undefined)[] = [ ["head > script:nth-child(34)", { src: "" }], - ["head > script:nth-child(35)", { src: "https://code.jquery.com/jquery-1.12.4.min.js", crossorigin: "anonymous" }], ["head > script:nth-child(43)", { src: "" }] ]; let count = 0; -let notDone = true; const observer = new MutationObserver(() => { - if (notDone) { - const meta = document.querySelector("head > meta:nth-child(2)"); - if (meta) { - meta.setAttribute("http-equiv", "Content-Security-Policy"); - meta.setAttribute("content", "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"); - notDone = false; - } - } 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]); } |
