Start to consolidate source code for both browsers

This commit is contained in:
Dave Gallant
2023-04-09 16:01:01 -04:00
parent c099bddf0d
commit 6abdd3ebbe
13 changed files with 5565 additions and 21 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
*.zip
node_modules

View File

@@ -1,6 +0,0 @@
package-chrome:
cd ./extensions/chrome && zip -r -FS ../../rfd-redirect-chrome-extension.zip * --exclude '*.git*'
package-firefox:
cd ./extensions/firefox && zip -r -FS ../../rfd-redirect-firefox-extension.zip * --exclude '*.git*'

View File

@@ -14,21 +14,26 @@ Copy [script.js](./script.js) into Tampermonkey.
## Browser Extensions
The browser extensions are currently not packaged or published anywhere.
### Chrome
To load the chrome extension, clone this repo and load [extensions/chrome](./extensions/chrome/).
The browser extensions is currently not packaged or published anywhere.
### Firefox
To load the firefox extension, clone this repo and load [extensions/firefox](./extensions/firefox/).
To load the firefox extension, clone this repo and load the root dir.
Go to `about:addons`, and ensure that all permissions are granted. If this is not done, the extension will not have permission to execute content scripts.
### Building the extension
To build the extension, run:
```sh
npm install
npm run build
```
## Updating redirects
The browser extensions will update the list of redirects by periodically fetching the latest [redirects.json](redirects.json).
The browser extension will update the list of redirects by periodically fetching the latest [redirects.json](redirects.json).
Open a pull request to this repo to update the redirects.
@@ -40,6 +45,6 @@ New config can be tested by pointing the config url of the extension to your own
For example:
```
```text
https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/my-new-branch/redirects.json
```

View File

@@ -3,14 +3,14 @@
<head>
<meta charset="UTF-8" />
<title>rfd-redirect-stripper</title>
<link rel="stylesheet" href="popup.css" />
<script src="utils.js"></script>
<link rel="stylesheet" href="../css/popup.css" />
<script src="../js/utils.js"></script>
</head>
<body>
Config URL:
<input type="text" id="input-field" />
<button id="save-button">Save</button>
<button id="reset-button">Reset</button>
<script src="popup.js"></script>
<script src="../js/popup.js"></script>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -6,17 +6,23 @@
"content_scripts": [
{
"matches": ["*://forums.redflagdeals.com/*"],
"js": ["content.js"],
"js": ["js/content.js"],
"run_at": "document_end"
}
],
"action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
"default_popup": "html/popup.html"
},
"background": {
"scripts": ["utils.js", "background.js"]
"scripts": ["js/utils.js", "js/background.js"]
},
"permissions": ["scripting", "storage"],
"host_permissions": ["*://forums.redflagdeals.com/*"]
"host_permissions": ["*://forums.redflagdeals.com/*"],
"browser_specific_settings": {
"gecko": {
"id": "davegallant@gmail.com",
"strict_min_version": "42.0"
}
}
}

5527
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

11
package.json Normal file
View File

@@ -0,0 +1,11 @@
{
"devDependencies": {
"web-ext": "^7.6.0"
},
"scripts": {
"start:firefox": "web-ext run --source-dir .",
"build": "web-ext build --overwrite-dest --ignore-files extensions/ --source-dir .",
"lint": "web-ext lint --source-dir .",
"sign": "web-ext sign --source-dir ."
}
}