Medium to Freedium Redirect

Redirects Medium membership articles to freedium.cfd

  1. // ==UserScript==
  2. // @license MIT
  3. // @name Medium to Freedium Redirect
  4. // @namespace http://tampermonkey.net/
  5. // @version 1.0
  6. // @description Redirects Medium membership articles to freedium.cfd
  7. // @author You
  8. // @match *://*.medium.com/*
  9. // @match *://*.towardsdatascience.com/*
  10. // @match *://*.betterprogramming.pub/*
  11. // @match *://*.blog.blockmagnates.com/*
  12. // @match *://*.levelup.gitconnected.com/*
  13. // @match *://*.uxdesign.cc/*
  14. // @match *://*.betterhumans.pub/*
  15. // @match *://*.baos.pub/*
  16. // @match *://*.blog.devgenius.io/*
  17. // @match *://*.bootcamp.uxdesign.cc/*
  18. // @match *://*.entrepreneurshandbook.co/*
  19. // @match *://*.blog.usejournal.com/*
  20. // @match *://*.writingcooperative.com/*
  21. // @match *://*.blog.prototypr.io/*
  22. // @match *://*.blog.bitsrc.io/*
  23. // @match *://*.thebolditalic.com/*
  24. // @match *://*.aninjusticemag.com/*
  25. // @grant none
  26. // @run-at document-start
  27. // ==/UserScript==
  28.  
  29. (function() {
  30. 'use strict';
  31.  
  32. // Function to check if the page is showing a membership wall
  33. function isMembershipRequired() {
  34. // Check for membership wall element or if article is truncated
  35. if (document.querySelector('.meteredContent')) return true;
  36. if (document.querySelector('.overlay-message')) return true;
  37. if (document.querySelector('#paywall-upsell-button-upgrade')) return true;
  38.  
  39. // Wait for content to load and check if article is truncated
  40. setTimeout(function() {
  41. if (document.querySelector('.meteredContent')) {
  42. redirectToFreedium();
  43. }
  44. if (document.querySelector('.overlay-message')) {
  45. redirectToFreedium();
  46. }
  47. }, 1500);
  48.  
  49. return false;
  50. }
  51.  
  52. // Function to redirect to freedium
  53. function redirectToFreedium() {
  54. const currentUrl = window.location.href;
  55. // Check if the URL is already a freedium URL
  56. if (!currentUrl.includes('freedium.cfd')) {
  57. const freediumUrl = 'https://freedium.cfd/' + currentUrl;
  58. window.location.href = freediumUrl;
  59. }
  60. }
  61.  
  62. // Initial check on page load
  63. window.addEventListener('load', function() {
  64. if (isMembershipRequired()) {
  65. redirectToFreedium();
  66. }
  67. });
  68.  
  69. // Track DOM changes to detect when a paywall might appear
  70. const observer = new MutationObserver(function(mutations) {
  71. for (const mutation of mutations) {
  72. if (mutation.addedNodes.length) {
  73. if (isMembershipRequired()) {
  74. redirectToFreedium();
  75. break;
  76. }
  77. }
  78. }
  79. });
  80.  
  81. // Start observing the document after it's fully loaded
  82. window.addEventListener('DOMContentLoaded', function() {
  83. observer.observe(document.body, { childList: true, subtree: true });
  84. });
  85. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址