Redirect Medium URLs

Add a button at the beginning of the body on medium.com to redirect to a modified URL

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Redirect Medium URLs
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add a button at the beginning of the body on medium.com to redirect to a modified URL
// @author       Your name
// @match        *://*.medium.com/*
// @grant        none

// @license MIT

// ==/UserScript==

(function() {
    'use strict';

    // Create a button element
    var redirectButton = document.createElement('button');
    redirectButton.textContent = 'Read on Medium-Free';
    redirectButton.style.position = 'fixed';
    redirectButton.style.top = '20px';
    redirectButton.style.left = '20px';
    redirectButton.style.zIndex = '9999';
    redirectButton.style.padding = '10px';
    redirectButton.style.backgroundColor = '#007bff';
    redirectButton.style.color = '#fff';
    redirectButton.style.border = 'none';
    redirectButton.style.borderRadius = '5px';
    redirectButton.style.cursor = 'pointer';

    // Get the current URL
    var currentUrl = window.location.href;

    // Modify the URL
    var redirectUrl = currentUrl.replace("medium.com", "medium-free.vercel.app/read?url=" + encodeURIComponent(currentUrl));

    // Add click event listener to redirect the page
    redirectButton.addEventListener('click', function() {
        window.location.href = redirectUrl;
    });

    // Add the button to the body
    document.body.appendChild(redirectButton);
})();