URL Replacer/Redirector

Redirect specific sites by replacing part of the URL.

当前为 2021-03-18 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
Gavin Borg
评分
0 0 0
版本
1.1
创建于
2020-05-11
更新于
2021-03-18
大小
1.8 KB
许可证
暂无
适用于

This script redirects user-specified URLs to new ones, by replacing part of the URL.

How to Use

  1. Reload this Greasyfork installation page - the script only matches this page by default, but running here will create the default settings structure in the script's storage for you.
  2. Add the sites you want to either the user includes or user matches - this script only runs on the greasyfork installation page for this script by default (feel free to remove that one).
  3. Locate the storage for this script in your script manager (Greasemonkey, Tampermonkey, etc.). You should see some settings JSON already built. Fill out the settings as desired (see Settings section below).
  4. Now, loading a matching page should redirect as you specified in the settings.

Settings

The settings live in the script's storage as JSON. Here's what the different pieces mean:

  • replacePrefix: this is the prefix that will be added to both sides of the replaceTheseStrings array.
  • replaceSuffix: this is the suffix that will be added to both sides of the replaceTheseStrings array.
  • replaceTheseStrings: this is an associative array of strings to replace in the URL when this script runs.

Example

If your settings are as follows:

{
  "replacePrefix": "/BIT/",
  "replaceSuffix": "/",
  "replaceTheseStrings": {
    "1": "BLUE",
    "2": "RED",
    "4": "WHITE",
    "9": "PURPLE"
  }
}

The script will redirect https://www.google.com/BIT/1/asdf to https://www.google.com/BIT/BLUE/asdf, but will not change https://www.google.com/1/asdf (because it doesn't match the prefix).


Changelog

  • 1.0 (5/11/20)
    • Initial release
  • 1.1 (3/17/21)
    • Make URL matching case-insensitive

Source: GitHub. Please direct all issues/questions there.

Available on Greasy Fork for easy installation.