您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirect specific sites by replacing part of the URL.
当前为
This script redirects user-specified URLs to new ones, by replacing part of the URL.
NOTE: this script does NOT work in ViolentMonkey (as the extension does not provide access to user-overridden matches/includes, which this script requires).
This script works by replacing pieces of the URL. Its replacement settings live in your extension's toolbar menu (when you're on a page where the script is active).
For example, in Tampermonkey:
Each line in the Targets field will be replaced by the same line in the Replacements field.
For example, consider these settings:
Targets | Replacements |
---|---|
In | Out |
Up | Down |
With these settings, we would redirect as follows:
Page | Redirects To | Notes |
---|---|---|
https://www.google.com/In/query | https://www.google.com/Out/query | |
https://www.google.com/IN/query | https://www.google.com/Out/query | We ignore case when matching (replacements match config casing) |
https://www.google.com/IN/query/Up/in/blog | https://www.google.com/Out/query/Down/Out/blog | All matches are replaced (including multiple of same target) |
A URL-wide find/replace can be too much - it's very easy to replace something you don't want.
For example, say you want to redirect from company.com/phone to company.com/call. You might use these settings:
Targets | Replacements |
---|---|
action | do |
phone | call |
That mostly works, but there's an issue:
Page | Redirects To | Notes |
---|---|---|
company.com/phone | company.com/call | |
company.com/action/getinfo | company.com/do/getinfo | |
company.com/action/find-my-phone | company.com/do/find-my-call | <-- We didn't want to replace phone here! |
One way to get around this is add more text to the start and/or end of the targets (and since we want to keep that text, also add it to their replacements).
For example, we might add company.com/ to the start to make sure we only replace our desired bit:
Targets | Replacements |
---|---|
company.com/action | company.com/do |
company.com/phone | company.com/call |
This works fine, but it's clunky when we're adding the same text to the start/end of every target and replacement.
If you're always adding the same text to the start/end of your targets (and replacements), you can instead use the Prefix and Suffix options.
Any text in these fields is added to the start/end of every target and replacement, so you don't have to add it manually.
So for our example above, we could instead use:
Prefix = company.com/
Targets | Replacements |
---|---|
action | do |
phone | call |
Source: GitHub. Please direct all issues/questions there.
Available on Greasy Fork镜像 for easy installation.