mirror of
https://github.com/davegallant/rfd-redirect-stripper.git
synced 2025-08-06 08:43:40 +00:00
Remove support for chrome temporarily
This commit is contained in:
@@ -14,7 +14,9 @@ Copy [script.js](./script.js) into Tampermonkey.
|
|||||||
|
|
||||||
## Browser Extensions
|
## Browser Extensions
|
||||||
|
|
||||||
The browser extensions is currently not packaged or published anywhere.
|
The browser extension is currently not packaged or published anywhere.
|
||||||
|
|
||||||
|
There is currently not support for Chrome.
|
||||||
|
|
||||||
### Firefox
|
### Firefox
|
||||||
|
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
importScripts('utils.js');
|
|
||||||
|
|
||||||
chrome.runtime.onInstalled.addListener(() => {
|
|
||||||
updateRedirects();
|
|
||||||
setDefaultConfig();
|
|
||||||
});
|
|
||||||
|
|
||||||
setInterval(updateRedirects, 1 * 60 * 60 * 1000);
|
|
@@ -1,30 +0,0 @@
|
|||||||
function stripRedirect(URL, redirectRegex) {
|
|
||||||
for (var i = 0; i < redirectRegex.length; i++) {
|
|
||||||
var rule = redirectRegex[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;
|
|
||||||
}
|
|
||||||
|
|
||||||
function stripRedirects() {
|
|
||||||
var Links = document.querySelectorAll("a.postlink, a.autolinker_link");
|
|
||||||
|
|
||||||
chrome.storage.local.get("rfd-redirects", function (redirectRegex) {
|
|
||||||
Links.forEach(function (Link) {
|
|
||||||
var ReferralURL = Link.href;
|
|
||||||
|
|
||||||
Link.href = stripRedirect(ReferralURL, redirectRegex["rfd-redirects"]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
stripRedirects();
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"manifest_version": 3,
|
|
||||||
"name": "rfd-redirect-stripper",
|
|
||||||
"description": "Strip tracking redirects on rfd",
|
|
||||||
"version": "0.1",
|
|
||||||
"content_scripts": [
|
|
||||||
{
|
|
||||||
"matches": ["*://forums.redflagdeals.com/*"],
|
|
||||||
"js": ["content.js"],
|
|
||||||
"run_at": "document_end"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": {
|
|
||||||
"default_icon": "icon.png",
|
|
||||||
"default_popup": "popup.html"
|
|
||||||
},
|
|
||||||
"background": {
|
|
||||||
"service_worker": "background.js"
|
|
||||||
},
|
|
||||||
"permissions": ["scripting", "storage"],
|
|
||||||
"host_permissions": ["*://forums.redflagdeals.com/*"]
|
|
||||||
}
|
|
@@ -1,63 +0,0 @@
|
|||||||
body {
|
|
||||||
background-color: #282828;
|
|
||||||
color: #ebdbb2;
|
|
||||||
font-family: "Font Name", sans-serif;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="text"] {
|
|
||||||
background-color: #3c3836;
|
|
||||||
color: #ebdbb2;
|
|
||||||
border: none;
|
|
||||||
border-radius: 3px;
|
|
||||||
padding: 5px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#save-button {
|
|
||||||
background-color: #1e7325;
|
|
||||||
color: #ebdbb2;
|
|
||||||
border: none;
|
|
||||||
border-radius: 3px;
|
|
||||||
padding: 5px 10px;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#save-button:hover {
|
|
||||||
background-color: #83a598;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#save-button:active {
|
|
||||||
transform: translateY(1px);
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#save-button:disabled {
|
|
||||||
background-color: #a89984;
|
|
||||||
color: #928374;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#reset-button {
|
|
||||||
background-color: #458588;
|
|
||||||
color: #ebdbb2;
|
|
||||||
border: none;
|
|
||||||
border-radius: 3px;
|
|
||||||
padding: 5px 10px;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#reset-button:hover {
|
|
||||||
background-color: #83a598;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#reset-button:active {
|
|
||||||
transform: translateY(1px);
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
button#reset-button:disabled {
|
|
||||||
background-color: #a89984;
|
|
||||||
color: #928374;
|
|
||||||
}
|
|
||||||
|
|
@@ -1,16 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<title>rfd-redirect-stripper</title>
|
|
||||||
<link rel="stylesheet" href="popup.css" />
|
|
||||||
<script src="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>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -1,25 +0,0 @@
|
|||||||
const inputField = document.getElementById("input-field");
|
|
||||||
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";
|
|
||||||
|
|
||||||
chrome.storage.local.get("config").then((result) => {
|
|
||||||
const value = result.config;
|
|
||||||
if (value) {
|
|
||||||
inputField.value = value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
saveButton.addEventListener("click", () => {
|
|
||||||
const value = inputField.value;
|
|
||||||
chrome.storage.local.set({ config: value });
|
|
||||||
updateRedirects();
|
|
||||||
});
|
|
||||||
|
|
||||||
resetButton.addEventListener("click", () => {
|
|
||||||
setDefaultConfig();
|
|
||||||
inputField.value = defaultConfig;
|
|
||||||
updateRedirects();
|
|
||||||
});
|
|
@@ -1,22 +0,0 @@
|
|||||||
function updateRedirects() {
|
|
||||||
chrome.storage.local.get("config", function (URL) {
|
|
||||||
fetch(URL.config)
|
|
||||||
.then((res) => res.json())
|
|
||||||
.then((res) => {
|
|
||||||
chrome.storage.local
|
|
||||||
.set({
|
|
||||||
redirects: res,
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function setDefaultConfig() {
|
|
||||||
chrome.storage.local.set({
|
|
||||||
config:
|
|
||||||
"https://raw.githubusercontent.com/davegallant/rfd-redirect-stripper/main/redirects.json",
|
|
||||||
});
|
|
||||||
}
|
|
Reference in New Issue
Block a user