-
-
Save dangnhdev/86c3d1d08fdc5dc0d6288732748324ab to your computer and use it in GitHub Desktop.
custom site javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name free medium | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2024-04-16 | |
| // @description try to take over the world! | |
| // @author You | |
| // @include *://medium.*.com/* | |
| // @include *://*.medium.com/* | |
| // @include *://medium.com/* | |
| // @icon *://www.google.com/s2/favicons?sz=64&domain=medium.com | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| "use strict"; | |
| // Your code here... | |
| function getUrlPath(url) { | |
| try { | |
| const urlObj = new URL(url); | |
| return urlObj.pathname; // This will return the path part of the URL | |
| } catch (error) { | |
| console.error("Invalid URL:", error); | |
| return null; | |
| } | |
| } | |
| const path = getUrlPath(window.location.href); | |
| const newLoc = window.location | |
| .toString() | |
| .replace("https://", "https://freedium-mirror.cfd/"); | |
| window.open(newLoc, "_blank"); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment