FT to RemovePaywall

Auto-redirect FT article pages to removepaywall.com

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         FT to RemovePaywall
// @namespace    Violentmonkey Scripts
// @version      1.0
// @description  Auto-redirect FT article pages to removepaywall.com
// @author       DionysusDK
// @match        *://*.ft.com/content/*
// @grant        none
// ==/UserScript==

const REMOVE_PAYWALL_URL = "https://removepaywall.com/search?url=";

(function redirectFTArticle() {
    const { hostname, pathname, href } = window.location;

    // Only run on ft.com and only when path is /content/{uuid}
    if (hostname.endsWith("ft.com")) {
        const uuidRegex = /^\/content\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
        if (uuidRegex.test(pathname)) {
            const redirectUrl = `${REMOVE_PAYWALL_URL}${encodeURIComponent(href)}`;
            window.location.href = redirectUrl;
        }
    }
})();

//this was made in one night - If you see that any changes could be made to further the codes simplicity or add more feature - kindly dm u/lonelyportrait123