diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-06 22:50:20 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-06 22:50:20 +0530 |
| commit | 8234acb45cd99fc7bcd99df7f71cac02845bb534 (patch) | |
| tree | 0110da8b5ad40b3899f57d3307292857a6a9eff7 | |
| parent | c57a9e3d9e304bd360437f8f732dbc0479376cd7 (diff) | |
| download | banglar-bhumi-utils-8234acb45cd99fc7bcd99df7f71cac02845bb534.tar.gz banglar-bhumi-utils-8234acb45cd99fc7bcd99df7f71cac02845bb534.zip | |
Added the ability to add page specific scripts.
| -rw-r--r-- | config/webpack/plugins/create-manifest-webpack-plugin/index.js | 23 | ||||
| -rw-r--r-- | src/manifest.json | 10 |
2 files changed, 23 insertions, 10 deletions
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js index fade66d..5dac1b2 100644 --- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js +++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js @@ -29,11 +29,24 @@ class CreateManifestPlugin { for (const scriptType in this.scripts) { if (Object.keys(this.scripts[scriptType]).length > 0) { - this.manifest.content_scripts.push({ - matches: ["https://banglarbhumi.gov.in/*", "http://banglarbhumi.gov.in/*"], - js: Object.keys(this.scripts[scriptType]).map(scriptName => `${scriptName}.js`), - run_at: scriptType - }); + const currentScripts = this.scripts[scriptType]; + + let paths = {}; + for (const scriptName in currentScripts) { + const scriptPath = currentScripts[scriptName]; + if (!path[scriptPath]) { + paths[scriptPath] = []; + } + paths[scriptPath].push(scriptName); + } + + for (const scriptPath in paths) { + this.manifest.content_scripts.push({ + matches: [`*://banglarbhumi.gov.in/${scriptPath}`], + js: paths[scriptPath].map(scriptName => `${scriptName}.js`), + run_at: scriptType + }); + } } } diff --git a/src/manifest.json b/src/manifest.json index b8930ae..397ec6e 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,15 +1,15 @@ { "before": { - "block-unnecessary": true + "block-unnecessary": "*" }, "injected": { - "stop-blocking": true + "stop-blocking": "*" }, "injected_and_loaded": { - "autofill-otps": true, - "auto-login": true + "autofill-otps": "*", + "auto-login": "*" }, "loaded": { - "autofill-captcha": true + "autofill-captcha": "*" } } |
