aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/manifest.json10
-rw-r--r--src/scripts/auto-login.ts2
-rw-r--r--src/scripts/block-unnecessary.ts20
3 files changed, 18 insertions, 14 deletions
diff --git a/src/manifest.json b/src/manifest.json
index 397ec6e..8e8d0bd 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,15 +1,15 @@
{
"before": {
- "block-unnecessary": "*"
+ "block-unnecessary.ts": "*"
},
"injected": {
- "stop-blocking": "*"
+ "stop-blocking.js": "*"
},
"injected_and_loaded": {
- "autofill-otps": "*",
- "auto-login": "*"
+ "autofill-otps.ts": "*",
+ "auto-login.ts": "*"
},
"loaded": {
- "autofill-captcha": "*"
+ "autofill-captcha.ts": "*"
}
}
diff --git a/src/scripts/auto-login.ts b/src/scripts/auto-login.ts
index 0da8ce3..1d2b379 100644
--- a/src/scripts/auto-login.ts
+++ b/src/scripts/auto-login.ts
@@ -1,6 +1,6 @@
const proxiedPost = $.post;
-let loginData: any = null;
+let loginData: any | null = null;
$.post = function() {
if (arguments[0].endsWith("login.action")) {
diff --git a/src/scripts/block-unnecessary.ts b/src/scripts/block-unnecessary.ts
index 78d294b..4163778 100644
--- a/src/scripts/block-unnecessary.ts
+++ b/src/scripts/block-unnecessary.ts
@@ -1,19 +1,23 @@
type ConditionalString = string | undefined;
-let scriptsToBlock: ConditionalString[] = [
+let blocked: ConditionalString[] = [
"head > script:nth-child(34)",
"head > script:nth-child(43)"
];
let count = 0;
const observer = new MutationObserver(mutations => {
- for (let i = 0; i < scriptsToBlock.length; i++) {
- if (scriptsToBlock[i]) {
- const script = document.querySelector(scriptsToBlock[i]!) as HTMLScriptElement;
- if (script) {
- script.src = "";
+ for (let i = 0; i < blocked.length; i++) {
+ if (blocked[i]) {
+ const element = document.querySelector(blocked[i]!) as HTMLElement | null;
+ if (element) {
+ if (element instanceof HTMLScriptElement) {
+ element.src = "";
+ } else if (element instanceof HTMLLinkElement && element.getAttribute("rel") === "stylesheet") {
+ element.href = "";
+ }
+ blocked[i] = undefined;
count++;
- scriptsToBlock[i] = undefined;
- if (count >= scriptsToBlock.length) {
+ if (count >= blocked.length) {
observer.disconnect();
break;
}