Medium to Freedium

Replace medium.com with freedium.cfd

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Medium to Freedium
// @name:ru [VOT] - Medium в Freedium
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Replace medium.com with freedium.cfd
// @description:ru  Заменяет medium.com на freedium.cfd
// @author       Stakancheck
// @license      MIT
// @match        https://medium.com/*
// @grant        none
// @icon         https://www.svgrepo.com/show/354057/medium-icon.svg
// @namespace vot
// ==/UserScript==

(function() {
    'use strict';

    // Check if there is a button with aria-label="Member-only story"
    var memberOnlyButton = document.querySelector('button[aria-label="Member-only story"]');
    if (!memberOnlyButton) {
        // If there is no such button, stop the script
        return;
    }

    // Create a button
    var button = document.createElement('button');
    button.textContent = 'freedium';
    button.style.position = 'fixed';
    button.style.right = '10px';
    button.style.bottom = '10px';
    button.style.zIndex = 9999;

    // Add click event to the button
    button.addEventListener('click', function() {
        // Replace medium.com with freedium.cfd in the current URL
        var newUrl = window.location.href.replace('medium.com', 'freedium.cfd');
        // Open the new URL in the same tab
        window.location.href = newUrl;
    });

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