Greasy Fork is available in English.

Unlock Unlimited Medium

Redirects Medium articles to medium.rest for unlimited reading experience without paywalls or restrictions

作者のサイトでサポートを受ける。または、このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @name         Unlock Unlimited Medium
// @namespace    https://github.com/htrnguyen/unlock-unlimited-medium
// @version      1.2
// @description  Redirects Medium articles to medium.rest for unlimited reading experience without paywalls or restrictions
// @author       Hà Trọng Nguyễn
// @license      MIT
// @match        *://*.medium.com/*
// @grant        GM_openInTab
// @supportURL   https://github.com/htrnguyen/unlock-unlimited-medium/issues
// @homepage     https://medium.rest/
// @icon         https://github.com/htrnguyen/Unlock-Unlimited-Medium/raw/main/Unlock%20Unlimited%20Medium%20Logo.png
// ==/UserScript==

/*
 * Unlock Unlimited Medium
 * Developed by: Hà Trọng Nguyễn
 * GitHub: https://github.com/htrnguyen/unlock-unlimited-medium
 * Medium.rest: https://medium.rest/
 * License: MIT
 */

(function () {
    'use strict';

    // Create logo
    const logo = document.createElement('div');
    logo.innerHTML = '<img src="https://github.com/htrnguyen/Unlock-Unlimited-Medium/raw/main/Unlock%20Unlimited%20Medium%20Logo.png" alt="Unlock Unlimited Medium" style="width: 40px; height: 40px;">';
    logo.title = 'Open with medium.rest';
    logo.style.position = 'fixed';
    logo.style.bottom = '20px';
    logo.style.right = '20px';
    logo.style.zIndex = '1000';
    logo.style.cursor = 'pointer';
    document.body.appendChild(logo);

    function convertToMediumRest(url) {
        const parsedUrl = new URL(url);
        parsedUrl.hostname = 'medium.rest';
        return parsedUrl.href;
    }

    logo.addEventListener('click', () => {
        const newUrl = convertToMediumRest(location.href);
        GM_openInTab(newUrl, { active: true });
    });

    document.querySelectorAll('a[href*="medium.com"]').forEach(link => {
        link.addEventListener('click', (event) => {
            event.preventDefault();
            const newUrl = convertToMediumRest(link.href);
            GM_openInTab(newUrl, { active: true });
        });
    });
})();