Automatically open Medium articles on freedium.cfd.
当前为
// ==UserScript==
// @name Freedium Redirect for Medium
// @namespace https://medium.com/
// @version 1.0
// @description Automatically open Medium articles on freedium.cfd.
// @author Nick Bakaka
// @match https://*.medium.com/*
// @grant none
// @license CC
// ==/UserScript==
(function () {
'use strict';
// ---- Configuration ----
const REDIRECT_PREFIX = "https://freedium.cfd/";
// ------------------------
/**
* Helper: Build the new URL.
* We encode the original Medium URL so it becomes a safe path segment on freedium.cfd.
*/
function buildRedirectUrl() {
const originalUrl = window.location.href;
return REDIRECT_PREFIX + encodeURIComponent(originalUrl);
}
// Only redirect if we are NOT already on freedium.cfd
if (!window.location.hostname.startsWith('freedium.cfd')) {
const newUrl = buildRedirectUrl();
// Use replace() so the original URL is not kept in history.
window.location.replace(newUrl);
}
})();