mirror of
https://github.com/davegallant/rfd-redirect-stripper.git
synced 2025-08-14 04:10:19 +00:00
Compare commits
38 Commits
4511ad314f
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
db08fe947e | ||
|
2b9592c3a6 | ||
|
24b085277f | ||
|
d36b5a8109 | ||
|
04b6233e01 | ||
|
e5bf4ba2eb | ||
|
f70db48946 | ||
|
b8f9f77e91 | ||
|
8aef9b158c | ||
|
0f08686d03 | ||
|
4ff1a4dd65 | ||
|
558834eef3 | ||
|
7975241b04 | ||
|
fbf4023b97 | ||
|
4bc87302a0 | ||
|
1aabf02916 | ||
|
4b35aa7246 | ||
|
2993b464fd | ||
|
30e148bb1b | ||
|
7b95eb5b3c | ||
|
65776f1f51 | ||
|
3d1c99f713 | ||
|
f0165d287a | ||
|
1917ecf2ce | ||
|
93e39e16d4 | ||
|
ba2308151b | ||
|
f50dc15f39 | ||
|
0741662660 | ||
|
4f8daa5842 | ||
|
c1c9ad14a4 | ||
|
cea44bc9b6 | ||
|
c46cb885bc | ||
|
7212ff7296 | ||
|
eecbb6945b | ||
|
40d8be84b3 | ||
|
15d3f2e8c2 | ||
|
d538058908 | ||
|
d47e51d0ab |
11
.github/dependabot.yml
vendored
11
.github/dependabot.yml
vendored
@@ -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
39
.github/workflows/build.yaml
vendored
Normal 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
22
.github/workflows/lint.yaml
vendored
Normal 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
28
.github/workflows/tamper-monkey.yaml
vendored
Normal 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
|
47
README.md
47
README.md
@@ -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.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
@@ -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
BIN
icon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
BIN
icon.png
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
BIN
icons-64x64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
@@ -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;
|
||||
|
@@ -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",
|
||||
});
|
||||
}
|
@@ -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/*"]
|
||||
}
|
@@ -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"
|
||||
}
|
||||
|
3391
package-lock.json
generated
3391
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"web-ext": "^7.9.0"
|
||||
"web-ext": "^8.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start:firefox": "web-ext run --source-dir .",
|
||||
|
@@ -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
9
renovate.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"schedule": [
|
||||
"every weekend"
|
||||
],
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
]
|
||||
}
|
211
script.js
211
script.js
@@ -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() {
|
||||
@@ -16,87 +16,128 @@
|
||||
var Links = document.querySelectorAll('a.postlink, a.autolinker_link');
|
||||
|
||||
const REDIRECT_REGEX = [
|
||||
{
|
||||
name: 'Amazon',
|
||||
pattern: 'www.amazon.ca/gp/redirect.html\\?ie=UTF8&location=(?<baseUrl>.*?)(&|ref%3D|%3F)',
|
||||
},
|
||||
{
|
||||
name: 'Best Buy',
|
||||
pattern: 'bestbuyca.(.*).net(.*)\\?u=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: 'HP',
|
||||
pattern: 'www.awin1.com(.*)\&clickref=\&p=(?<baseUrl>.*)\&.*',
|
||||
},
|
||||
{
|
||||
name: 'Samsung',
|
||||
pattern: 'www.awin1.com(.*)\?p=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: 'redirectingat.com',
|
||||
pattern: 'go.redirectingat.com/.*url=(?<baseUrl>.*).*',
|
||||
},
|
||||
{
|
||||
name: 'homedepot',
|
||||
pattern: 'the-home-depot-ca.pxf.io(.*)\?u=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: 'redirectingat',
|
||||
pattern: 'go.redirectingat.com(.*)\?url=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: 'adidas-canada',
|
||||
pattern: 'adidas-canada.sjv.io(.*)\?u=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: 'canadiantire',
|
||||
pattern: 'imp.i([0-9]*).net(.*)\?u=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: 'kqzyfj',
|
||||
pattern: 'www.awin1.com(.*)\?ued=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: 'lenovo',
|
||||
pattern: '(.*).evyy.net(.*)\?u=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: 'thesource',
|
||||
pattern: 'www.kqzyfj.com(.*)?url=(?<baseUrl>.*)&sid=.*',
|
||||
},
|
||||
{
|
||||
name: 'walmart',
|
||||
pattern: 'click.linksynergy.com(.*)\?murl=(?<baseUrl>.*)&u1=.*',
|
||||
},
|
||||
{
|
||||
name: 'dpbolvw.net',
|
||||
pattern: 'www.dpbolvw.net(.*)?url=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: "jdoqocy.com",
|
||||
pattern: "www.jdoqocy.com(.*)?url=(?<baseUrl>.*)&sid=.*"
|
||||
},
|
||||
{
|
||||
name: 'pxf.io',
|
||||
pattern: '(.*).pxf.io(.*)\?u=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: 'avantlink.com',
|
||||
pattern: '(.*).avantlink.com(.*)\?url=(?<baseUrl>.*)',
|
||||
},
|
||||
{
|
||||
name: "anrdoezrs.net",
|
||||
pattern: ".*anrdoezrs\\.net.+\\?url=(?<baseUrl>.*)&sid=.+"
|
||||
},
|
||||
{
|
||||
name: "tkqlhce.com",
|
||||
pattern: ".*tkqlhce\\.com.+?url=(?<baseUrl>.*)&sid=.*"
|
||||
},
|
||||
{
|
||||
name: "staples",
|
||||
pattern: ".*staplescanada\\.4u8mqw\\.net.+\\?u=(?<baseUrl>.*)"
|
||||
}
|
||||
];
|
||||
{
|
||||
"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": "HP",
|
||||
"pattern": "www.awin1.com(.*)&clickref=&p=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "Samsung",
|
||||
"pattern": "www.awin1.com(.*)?p=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "redirectingat.com",
|
||||
"pattern": "go.redirectingat.com/.*url=(?<baseUrl>.*).*"
|
||||
},
|
||||
{
|
||||
"name": "homedepot",
|
||||
"pattern": "the-home-depot-ca.pxf.io(.*)?u=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "redirectingat",
|
||||
"pattern": "go.redirectingat.com(.*)?url=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "sjv.io",
|
||||
"pattern": ".*sjv\\.io.*\\?u=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "canadiantire",
|
||||
"pattern": "imp.i([0-9]*).net(.*)?u=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "underarmour",
|
||||
"pattern": "www.awin1.com(.*)?ued=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "lenovo",
|
||||
"pattern": "(.*).evyy.net(.*)?u=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "kqzyfj",
|
||||
"pattern": "www.kqzyfj.com(.*)?url=(?<baseUrl>.*)&sid=.*"
|
||||
},
|
||||
{
|
||||
"name": "walmart",
|
||||
"pattern": "click.linksynergy.com(.*)?murl=(?<baseUrl>.*)&u1=.*"
|
||||
},
|
||||
{
|
||||
"name": "dpbolvw.net",
|
||||
"pattern": "www.dpbolvw.net(.*)?url=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "jdoqocy.com",
|
||||
"pattern": "www.jdoqocy.com(.*)?url=(?<baseUrl>.*)&sid=rfdcb"
|
||||
},
|
||||
{
|
||||
"name": "pfx.io",
|
||||
"pattern": "(.*).pxf.io(.*)?u=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "avantlink.com",
|
||||
"pattern": "(.*).avantlink.com(.*)?url=(?<baseUrl>.*)"
|
||||
},
|
||||
{
|
||||
"name": "anrdoezrs.net",
|
||||
"pattern": ".*anrdoezrs\\.net.+\\?url=(?<baseUrl>.*)&sid=.*"
|
||||
},
|
||||
{
|
||||
"name": "tkqlhce.com",
|
||||
"pattern": ".*tkqlhce\\.com.+?url=(?<baseUrl>.*)&sid=.*"
|
||||
},
|
||||
{
|
||||
"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
42
script.js.tmpl
Normal 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);
|
||||
});
|
||||
|
||||
})();
|
Reference in New Issue
Block a user