38 Commits

Author SHA1 Message Date
renovate[bot]
db08fe947e Update dependency node to v22 (#43)
* Update dependency node to v22

* Apply automatic changes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-10 10:43:43 -04:00
renovate[bot]
2b9592c3a6 Update dependency web-ext to v8.8.0 (#41)
* Update dependency web-ext to v8.8.0

* Apply automatic changes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-21 08:00:38 -04:00
renovate[bot]
24b085277f Update dependency web-ext to v8.7.1 (#39)
* Update dependency web-ext to v8.7.1

* Apply automatic changes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-30 22:36:21 -04:00
renovate[bot]
d36b5a8109 Update dependency web-ext to v8.7.0 (#38)
* Update dependency web-ext to v8.7.0

* Apply automatic changes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-23 21:55:42 -04:00
renovate[bot]
04b6233e01 Update dependency web-ext to v8.6.0 (#37)
* Update dependency web-ext to v8.6.0

* Apply automatic changes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-25 21:49:14 -04:00
renovate[bot]
e5bf4ba2eb Update dependency web-ext to v8.5.0 (#35)
* Update dependency web-ext to v8.5.0

* Apply automatic changes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-18 17:07:29 -04:00
davegallant
f70db48946 Apply automatic changes 2024-10-30 11:40:35 +00:00
Dave Gallant
b8f9f77e91 Rename to rfd-affiliate-stripper 2024-10-30 07:40:21 -04:00
Dave Gallant
8aef9b158c Update README.md 2024-10-25 23:19:49 -04:00
davegallant
0f08686d03 Apply automatic changes 2024-10-26 03:19:35 +00:00
Dave Gallant
4ff1a4dd65 Update README.md 2024-10-25 23:19:23 -04:00
Dave Gallant
558834eef3 Add icon-64x64.png 2024-10-09 07:43:20 -04:00
Dave Gallant
7975241b04 Remove subheadings to stores 2024-10-09 07:36:30 -04:00
davegallant
fbf4023b97 Apply automatic changes 2024-10-09 11:34:01 +00:00
Dave Gallant
4bc87302a0 Update icon 2024-10-09 07:32:49 -04:00
renovate[bot]
1aabf02916 Update dependency web-ext to v8.3.0 (#34)
* Update dependency web-ext to v8.3.0

* Apply automatic changes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <renovate[bot]@users.noreply.github.com>
2024-09-20 21:17:51 -04:00
Dave Gallant
4b35aa7246 Add calendar versioning to gomplate (#33)
* Use calendar versioning for the Tampermonkey script

* Apply automatic changes
2024-07-27 08:11:20 -04:00
Dave Gallant
2993b464fd Update bestbuy in redirects.json (#32)
* Update bestbuy in redirects.json
2024-07-24 16:58:46 -04:00
Dave Gallant
30e148bb1b Update README.md 2024-07-23 08:05:43 -04:00
Dave Gallant
7b95eb5b3c Update README.md 2024-07-23 07:45:56 -04:00
Dave Gallant
65776f1f51 Remove scripting permission and host_permissions and publish to chrome web store (#31)
* Remove scripting permission

* Remove host permissions

* Add chrome web store link
2024-07-23 07:39:29 -04:00
Dave Gallant
3d1c99f713 Update renovate.json 2024-06-28 12:02:03 -04:00
renovate[bot]
f0165d287a Update dependency web-ext to v8.2.0 (#29)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-24 17:20:00 -04:00
davegallant
1917ecf2ce Apply automatic changes 2024-06-24 21:17:49 +00:00
anonion
93e39e16d4 Fix HP redirects (#30)
* fix whitespace

* fix HP
2024-06-24 17:17:38 -04:00
renovate[bot]
ba2308151b Update dependency web-ext to v8 (#28)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-28 21:01:15 -04:00
renovate[bot]
f50dc15f39 Update dependency web-ext to v7.12.0 (#27)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-27 18:26:45 -04:00
davegallant
0741662660 Apply automatic changes 2024-02-04 03:54:06 +00:00
anonion
4f8daa5842 Add redirects (#23)
* add 7 new redirects

* change sjv.io to match against all subdomains

* change amazon to match against 'com' or 'ca' TLD

* add fintelconnect and c2ukkg

* bestbuy: exclude tracking parameters

* add dodxnr.net
2024-02-03 22:53:50 -05:00
Dave Gallant
c1c9ad14a4 Update tamper-monkey.yaml 2024-02-03 22:51:25 -05:00
Dave Gallant
cea44bc9b6 Fix .github/workflows/tamper-monkey.yaml (#24)
* Use stefanzweifel/git-auto-commit-action@v5

* Give permissions to write
2024-02-03 22:22:21 -05:00
anonion
c46cb885bc combine manifests (#21) 2024-01-24 23:22:01 -05:00
renovate[bot]
7212ff7296 Update dependency web-ext to v7.11.0 (#22)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-24 23:16:05 -05:00
Dave Gallant
eecbb6945b Generate tamper-monkey-script (#20)
* Generate tamper-monkey-script

* Update script.js using gomplate

---------

Co-authored-by: GitHub Actions <actions@users.noreply.github.com>
2024-01-14 17:37:49 -05:00
Dave Gallant
40d8be84b3 Add various improvements (#19)
* Add white stroke to icon

* Add lint workflow

* Add build workflow

* Add support for firefox android
2024-01-14 16:31:12 -05:00
Dave Gallant
15d3f2e8c2 Delete .github/dependabot.yml 2024-01-14 15:29:43 -05:00
renovate[bot]
d538058908 Update dependency web-ext to v7.10.0 (#17)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-14 15:29:27 -05:00
renovate[bot]
d47e51d0ab Add renovate.json (#16)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-14 15:27:59 -05:00
19 changed files with 1319 additions and 2589 deletions

View File

@@ -1,11 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"

39
.github/workflows/build.yaml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: "Build"
on:
push:
branches:
- main
pull_request:
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install jq
- name: Get extension version
id: vars
run: |
version=$(jq -r .version manifest.json)
echo "version=$version" >> $GITHUB_OUTPUT
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: "web-ext build"
id: web-ext-build
uses: kewisch/action-web-ext@v1
with:
cmd: build
source: .
filename: "rfd-affiliate-stripper-${{steps.vars.outputs.version}}-${{steps.vars.outputs.sha_short}}.xpi"
ignoreFiles: '[ "package.json","package-lock.json","yarn.lock" ]'
- name: "Upload Artifact"
uses: actions/upload-artifact@v4
with:
name: "rfd-affiliate-stripper-${{steps.vars.outputs.version}}-${{steps.vars.outputs.sha_short}}.xpi"
path: ${{ steps.web-ext-build.outputs.target }}

22
.github/workflows/lint.yaml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: "Lint"
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm run lint

28
.github/workflows/tamper-monkey.yaml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: "Generate Tampermonkey script"
on:
pull_request:
push:
branches:
- main
jobs:
gomplate:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install gomplate
run: |
wget -O gomplate https://github.com/hairyhenderson/gomplate/releases/download/v3.10.0/gomplate_linux-amd64
chmod +x gomplate
sudo mv gomplate /usr/local/bin/
- name: Run gomplate
run: gomplate < script.js.tmpl > script.js
- uses: stefanzweifel/git-auto-commit-action@v5

View File

@@ -1,28 +1,27 @@
# rfd-redirect-stripper
# rfd-affiliate-stripper
rfd-redirect-stripper strips affiliate redirects from deal links posted on https://forums.redflagdeals.com.
<a href="https://addons.mozilla.org/en-US/firefox/addon/rfd-redirect-stripper/"><img src="https://user-images.githubusercontent.com/585534/107280546-7b9b2a00-6a26-11eb-8f9f-f95932f4bfec.png" alt="Get rfd-affiliate-stripper for Firefox"></a>
<a href="https://chromewebstore.google.com/detail/rfd-affiliate-stripper/nhjomcijhonhoggkckbjjfnjdcefbblo?authuser=0&hl=en"><img src="https://user-images.githubusercontent.com/585534/107280622-91a8ea80-6a26-11eb-8d07-77c548b28665.png" alt="Get rfd-affiliate-stripper for Chrome"></a>
Strips affiliate redirects from deal links posted on RFD.
On every page load, it transforms a link with tracking such as
```
http://www.amazon.ca/gp/redirect.html?ie=UTF8&location=https%3A%2F%2Fwww.amazon.ca%2Fdp%2FB09YXY3DKN%3Fref%3Dcm_sw_r_apan_dp_NX4HJ8HZ3XX2YK1J900A%26ref_%3Dcm_sw_r_apan_dp_NX4HJ8HZ3XX2YK1J900A%26social_share%3Dcm_sw_r_apan_dp_NX4HJ8HZ3XX2YK1J900A%26starsLeft%3D1%26skipTwisterOG%3D1&tag=redflagdealsc-20&linkCode=ur2&camp=15121&creative=330641
```
into
```
https://www.amazon.ca/dp/B09YXY3DKN
```
## Why?
This helps navigate around broken links when using certain adblockers.
## Tampermonkey Script
This was originally a [Tampermonkey](https://www.tampermonkey.net/) userscript before evolving into a browser extension.
Copy [script.js](./script.js) into Tampermonkey.
## Browser Extensions
### Firefox
The extension is available [here](https://addons.mozilla.org/en-US/firefox/addon/rfd-redirect-stripper/).
Ensure that permissions are granted. If this is not done, the extension will not have permission to execute.
<img width="712" alt="image" src="https://user-images.githubusercontent.com/4519234/231030083-5ff5156a-deec-4e4d-8f35-ebba84a24be8.png">
### Building the extension
## Building the extension
To build the extension, run:
@@ -41,10 +40,14 @@ An easy way to test regex: [regex101.com](https://regex101.com/).
New config can be tested by pointing the config url of the extension to your own branch.
![image](https://user-images.githubusercontent.com/4519234/230703252-a7e09cf6-d0e5-4f54-8973-3b93d4a4a5a2.png)
For example:
```text
https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/my-new-branch/redirects.json
https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/my-new-branch/redirects.json
```
## Tampermonkey Script
This was originally a [Tampermonkey](https://www.tampermonkey.net/) userscript before evolving into a browser extension.
To use as a tampermonkey script, copy [script.js](./script.js) into Tampermonkey.

View File

@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8" />
<title>rfd-redirect-stripper</title>
<title>rfd-affiliate-stripper</title>
<link rel="stylesheet" href="../css/popup.css" />
</head>
<body>

BIN
icon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
icons-64x64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -5,7 +5,7 @@ const saveButton = document.getElementById("save-button");
const resetButton = document.getElementById("reset-button");
const defaultConfig =
"https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/redirects.json";
"https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/redirects.json";
chrome.storage.local.get("config").then((result) => {
const value = result.config;

View File

@@ -20,6 +20,6 @@ export function updateRedirects() {
export function setDefaultConfig() {
chrome.storage.local.set({
config:
"https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/redirects.json",
"https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/redirects.json",
});
}

View File

@@ -1,23 +0,0 @@
{
"manifest_version": 3,
"name": "rfd-redirect-stripper",
"description": "Strip tracking redirects on rfd",
"version": "0.2",
"content_scripts": [
{
"matches": ["*://forums.redflagdeals.com/*"],
"js": ["js/content.js"],
"run_at": "document_end"
}
],
"action": {
"default_icon": "icon.png",
"default_popup": "html/popup.html"
},
"background": {
"service_worker": "js/background.js",
"type": "module"
},
"permissions": ["scripting", "storage", "alarms"],
"host_permissions": ["*://forums.redflagdeals.com/*"]
}

View File

@@ -1,12 +1,16 @@
{
"manifest_version": 3,
"name": "rfd-redirect-stripper",
"name": "rfd-affiliate-stripper",
"description": "Strip tracking redirects on rfd",
"version": "0.2",
"version": "0.5.3",
"content_scripts": [
{
"matches": ["*://forums.redflagdeals.com/*"],
"js": ["js/content.js"],
"matches": [
"*://forums.redflagdeals.com/*"
],
"js": [
"js/content.js"
],
"run_at": "document_end"
}
],
@@ -15,15 +19,24 @@
"default_popup": "html/popup.html"
},
"background": {
"scripts": [ "js/background.js" ],
"scripts": [
"js/background.js"
],
"service_worker": "js/background.js",
"type": "module"
},
"permissions": ["scripting", "storage", "alarms"],
"host_permissions": ["*://forums.redflagdeals.com/*"],
"permissions": [
"storage",
"alarms"
],
"browser_specific_settings": {
"gecko": {
"id": "davegallant@gmail.com",
"strict_min_version": "112.0"
},
"gecko_android": {
"strict_min_version": "113.0"
}
}
},
"minimum_chrome_version": "121"
}

3387
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"devDependencies": {
"web-ext": "^7.9.0"
"web-ext": "^8.0.0"
},
"scripts": {
"start:firefox": "web-ext run --source-dir .",

View File

@@ -1,7 +1,7 @@
[
{
"name": "Amazon",
"pattern": "www.amazon.ca/gp/redirect.html\\?ie=UTF8&location=(?<baseUrl>.*?)(&|ref%3D|%3F)"
"pattern": ".*amazon\\.(?:ca|com)\/gp\/redirect\\.html\\?ie=UTF8&location=(?<baseUrl>.*?)(?:&|ref%3D|%3F)"
},
{
"name": "Best Buy",
@@ -9,7 +9,7 @@
},
{
"name": "HP",
"pattern": "www.awin1.com(.*)&clickref=&p=(?<baseUrl>.*)&.*"
"pattern": "www.awin1.com(.*)&clickref=&p=(?<baseUrl>.*)"
},
{
"name": "Samsung",
@@ -28,8 +28,8 @@
"pattern": "go.redirectingat.com(.*)?url=(?<baseUrl>.*)"
},
{
"name": "adidas-canada",
"pattern": "adidas-canada.sjv.io(.*)?u=(?<baseUrl>.*)"
"name": "sjv.io",
"pattern": ".*sjv\\.io.*\\?u=(?<baseUrl>.*)"
},
{
"name": "canadiantire",
@@ -78,5 +78,45 @@
{
"name": "staples",
"pattern": ".*staplescanada\\.4u8mqw\\.net.+\\?u=(?<baseUrl>.*)"
},
{
"name": "pjtra.com",
"pattern": ".*pjtra\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "pjatr.com",
"pattern": ".*pjatr\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "pntra.com",
"pattern": ".*pntra\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "pntrs.com",
"pattern": ".*pntrs\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "pntrac.com",
"pattern": ".*pntrac\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "shareasale.com",
"pattern": ".*shareasale\\.com.*&urllink=(?<baseUrl>.*)"
},
{
"name": "mkr3.net",
"pattern": ".*mkr3\\.net.*\\?u=(?<baseUrl>.*)"
},
{
"name": "fintelconnect.com",
"pattern": ".*fintelconnect\\.com.*\\?u=(?<baseUrl>.*)"
},
{
"name": "c2ukkg.net",
"pattern": ".*c2ukkg\\.net.*\\?u=(?<baseUrl>.*)"
},
{
"name": "dodxnr.net",
"pattern": ".*dodxnr\\.net.*\\?u=(?<baseUrl>.*)"
}
]

9
renovate.json Normal file
View File

@@ -0,0 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"schedule": [
"every weekend"
],
"extends": [
"config:recommended"
]
}

131
script.js
View File

@@ -1,13 +1,13 @@
// ==UserScript==
// @name RedFlagDeals Redirect Stripper
// @name RedFlagDeals Affiliate Stripper
// @author Dave Gallant
// @description Strip redirect links on forums.redflagdeals.com
// @downloadURL https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/script.js
// @downloadURL https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/script.js
// @grant none
// @match *://forums.redflagdeals.com/*
// @namespace http://tampermonkey.net/
// @updateURL https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/script.js
// @version 0.0.1
// @updateURL https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/script.js
// @version 2025-08-10
// ==/UserScript==
(function() {
@@ -17,86 +17,127 @@
const REDIRECT_REGEX = [
{
name: 'Amazon',
pattern: 'www.amazon.ca/gp/redirect.html\\?ie=UTF8&location=(?<baseUrl>.*?)(&|ref%3D|%3F)',
"name": "Amazon",
"pattern": ".*amazon\\.(?:ca|com)\/gp\/redirect\\.html\\?ie=UTF8&location=(?<baseUrl>.*?)(?:&|ref%3D|%3F)"
},
{
name: 'Best Buy',
pattern: 'bestbuyca.(.*).net(.*)\\?u=(?<baseUrl>.*)',
"name": "Best Buy",
"pattern": "bestbuyca.(.*).net(.*)\\?u=(?<baseUrl>.*)"
},
{
name: 'HP',
pattern: 'www.awin1.com(.*)\&clickref=\&p=(?<baseUrl>.*)\&.*',
"name": "HP",
"pattern": "www.awin1.com(.*)&clickref=&p=(?<baseUrl>.*)"
},
{
name: 'Samsung',
pattern: 'www.awin1.com(.*)\?p=(?<baseUrl>.*)',
"name": "Samsung",
"pattern": "www.awin1.com(.*)?p=(?<baseUrl>.*)"
},
{
name: 'redirectingat.com',
pattern: 'go.redirectingat.com/.*url=(?<baseUrl>.*).*',
"name": "redirectingat.com",
"pattern": "go.redirectingat.com/.*url=(?<baseUrl>.*).*"
},
{
name: 'homedepot',
pattern: 'the-home-depot-ca.pxf.io(.*)\?u=(?<baseUrl>.*)',
"name": "homedepot",
"pattern": "the-home-depot-ca.pxf.io(.*)?u=(?<baseUrl>.*)"
},
{
name: 'redirectingat',
pattern: 'go.redirectingat.com(.*)\?url=(?<baseUrl>.*)',
"name": "redirectingat",
"pattern": "go.redirectingat.com(.*)?url=(?<baseUrl>.*)"
},
{
name: 'adidas-canada',
pattern: 'adidas-canada.sjv.io(.*)\?u=(?<baseUrl>.*)',
"name": "sjv.io",
"pattern": ".*sjv\\.io.*\\?u=(?<baseUrl>.*)"
},
{
name: 'canadiantire',
pattern: 'imp.i([0-9]*).net(.*)\?u=(?<baseUrl>.*)',
"name": "canadiantire",
"pattern": "imp.i([0-9]*).net(.*)?u=(?<baseUrl>.*)"
},
{
name: 'kqzyfj',
pattern: 'www.awin1.com(.*)\?ued=(?<baseUrl>.*)',
"name": "underarmour",
"pattern": "www.awin1.com(.*)?ued=(?<baseUrl>.*)"
},
{
name: 'lenovo',
pattern: '(.*).evyy.net(.*)\?u=(?<baseUrl>.*)',
"name": "lenovo",
"pattern": "(.*).evyy.net(.*)?u=(?<baseUrl>.*)"
},
{
name: 'thesource',
pattern: 'www.kqzyfj.com(.*)?url=(?<baseUrl>.*)&sid=.*',
"name": "kqzyfj",
"pattern": "www.kqzyfj.com(.*)?url=(?<baseUrl>.*)&sid=.*"
},
{
name: 'walmart',
pattern: 'click.linksynergy.com(.*)\?murl=(?<baseUrl>.*)&u1=.*',
"name": "walmart",
"pattern": "click.linksynergy.com(.*)?murl=(?<baseUrl>.*)&u1=.*"
},
{
name: 'dpbolvw.net',
pattern: 'www.dpbolvw.net(.*)?url=(?<baseUrl>.*)',
"name": "dpbolvw.net",
"pattern": "www.dpbolvw.net(.*)?url=(?<baseUrl>.*)"
},
{
name: "jdoqocy.com",
pattern: "www.jdoqocy.com(.*)?url=(?<baseUrl>.*)&sid=.*"
"name": "jdoqocy.com",
"pattern": "www.jdoqocy.com(.*)?url=(?<baseUrl>.*)&sid=rfdcb"
},
{
name: 'pxf.io',
pattern: '(.*).pxf.io(.*)\?u=(?<baseUrl>.*)',
"name": "pfx.io",
"pattern": "(.*).pxf.io(.*)?u=(?<baseUrl>.*)"
},
{
name: 'avantlink.com',
pattern: '(.*).avantlink.com(.*)\?url=(?<baseUrl>.*)',
"name": "avantlink.com",
"pattern": "(.*).avantlink.com(.*)?url=(?<baseUrl>.*)"
},
{
name: "anrdoezrs.net",
pattern: ".*anrdoezrs\\.net.+\\?url=(?<baseUrl>.*)&sid=.+"
"name": "anrdoezrs.net",
"pattern": ".*anrdoezrs\\.net.+\\?url=(?<baseUrl>.*)&sid=.*"
},
{
name: "tkqlhce.com",
pattern: ".*tkqlhce\\.com.+?url=(?<baseUrl>.*)&sid=.*"
"name": "tkqlhce.com",
"pattern": ".*tkqlhce\\.com.+?url=(?<baseUrl>.*)&sid=.*"
},
{
name: "staples",
pattern: ".*staplescanada\\.4u8mqw\\.net.+\\?u=(?<baseUrl>.*)"
"name": "staples",
"pattern": ".*staplescanada\\.4u8mqw\\.net.+\\?u=(?<baseUrl>.*)"
},
{
"name": "pjtra.com",
"pattern": ".*pjtra\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "pjatr.com",
"pattern": ".*pjatr\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "pntra.com",
"pattern": ".*pntra\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "pntrs.com",
"pattern": ".*pntrs\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "pntrac.com",
"pattern": ".*pntrac\\.com.*\\?url=(?<baseUrl>.*)&sid.*"
},
{
"name": "shareasale.com",
"pattern": ".*shareasale\\.com.*&urllink=(?<baseUrl>.*)"
},
{
"name": "mkr3.net",
"pattern": ".*mkr3\\.net.*\\?u=(?<baseUrl>.*)"
},
{
"name": "fintelconnect.com",
"pattern": ".*fintelconnect\\.com.*\\?u=(?<baseUrl>.*)"
},
{
"name": "c2ukkg.net",
"pattern": ".*c2ukkg\\.net.*\\?u=(?<baseUrl>.*)"
},
{
"name": "dodxnr.net",
"pattern": ".*dodxnr\\.net.*\\?u=(?<baseUrl>.*)"
}
];
]
;
var StripRedirect = function(URL) {
for (var i = 0; i < REDIRECT_REGEX.length; i++) {

42
script.js.tmpl Normal file
View File

@@ -0,0 +1,42 @@
// ==UserScript==
// @name RedFlagDeals Affiliate Stripper
// @author Dave Gallant
// @description Strip redirect links on forums.redflagdeals.com
// @downloadURL https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/script.js
// @grant none
// @match *://forums.redflagdeals.com/*
// @namespace http://tampermonkey.net/
// @updateURL https://raw.githubusercontent.com/davegallant/rfd-affiliate-stripper/main/script.js
// @version {{ (time.Now).Format "2006-01-02" }}
// ==/UserScript==
(function() {
'use strict';
var Links = document.querySelectorAll('a.postlink, a.autolinker_link');
const REDIRECT_REGEX = {{ file.Read "redirects.json" }};
var StripRedirect = function(URL) {
for (var i = 0; i < REDIRECT_REGEX.length; i++) {
var rule = REDIRECT_REGEX[i];
var result = new RegExp(rule.pattern).exec(URL);
if (result) {
var newURL = result.groups.baseUrl;
try {
return decodeURIComponent(newURL);
} catch (e) {
console.log(e);
return URL;
}
}
}
return URL;
};
Links.forEach(function(Link) {
var ReferralURL = Link.href;
Link.href = StripRedirect(ReferralURL);
});
})();