- commit
- e84505c042181a6ae75f9ec2e7140c5d56fc4249
- parent
- d604bab9f99667c52215bcd94ef63cd82f1935cd
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2023-10-08 16:18
convert shared.js to module
Diffstat
| M | manifest.json | 5 | +++-- |
| M | src/bg.js | 4 | +++- |
| M | src/popup.html | 3 | +-- |
| M | src/popup.js | 4 | +++- |
| M | src/settings.html | 3 | +-- |
| M | src/shared.js | 8 | +++----- |
6 files changed, 14 insertions, 13 deletions
diff --git a/manifest.json b/manifest.json
@@ -14,8 +14,9 @@ 14 14 "48": "icon.svg" 15 15 }, 16 16 "background": {17 -1 "scripts": ["src/shared.js", "src/bg.js"],18 -1 "persistent": false-1 17 "scripts": ["src/bg.js"], -1 18 "persistent": false, -1 19 "type": "module" 19 20 }, 20 21 "content_scripts": [{ 21 22 "js": ["src/content.js"],
diff --git a/src/bg.js b/src/bg.js
@@ -1,4 +1,6 @@1 -1 /* global browser shared */-1 1 /* global browser */ -1 2 -1 3 import * as shared from './shared.js'; 2 4 3 5 var lock = Promise.resolve(); 4 6
diff --git a/src/popup.html b/src/popup.html
@@ -25,7 +25,6 @@ 25 25 <li><strong>sub-domains</strong>: If you allow a domain, all of its sub-domains are allowed along with it.</li> 26 26 </ul> 27 27 </details>28 -1 <script src="shared.js"></script>29 -1 <script src="popup.js"></script>-1 28 <script type="module" src="popup.js"></script> 30 29 </body> 31 30 </html>
diff --git a/src/popup.js b/src/popup.js
@@ -1,4 +1,6 @@1 -1 /* global browser shared */-1 1 /* global browser */ -1 2 -1 3 import * as shared from './shared.js'; 2 4 3 5 var context; 4 6 var requests;
diff --git a/src/settings.html b/src/settings.html
@@ -17,7 +17,6 @@ 17 17 </label> 18 18 <button>Save</button> 19 19 </form>20 -1 <script src="shared.js"></script>21 -1 <script src="settings.js"></script>-1 20 <script type="module" src="settings.js"></script> 22 21 </body> 23 22 </html>
diff --git a/src/shared.js b/src/shared.js
@@ -1,7 +1,5 @@1 -1 var shared = {};2 -13 -1 shared.TYPES = ['cookie', 'font', 'css', 'media', 'script', 'xhr', 'frame', 'other'];4 -1 shared.TYPE_MAP = {-1 1 export const TYPES = ['cookie', 'font', 'css', 'media', 'script', 'xhr', 'frame', 'other']; -1 2 export const TYPE_MAP = { 5 3 'stylesheet': 'css', 6 4 'font': 'font', 7 5 'image': 'media', @@ -14,7 +12,7 @@ shared.TYPE_MAP = { 14 12 'sub_frame': 'frame', 15 13 }; 16 1417 -1 shared.shouldAllow = function(rules, context, hostname, type) {-1 15 export var shouldAllow = function(rules, context, hostname, type) { 18 16 var hostnames = ['*', hostname]; 19 17 var parts = hostname.split('.'); 20 18 while (parts.length > 2) {