URL Replacer/Redirector

Redirect specific sites by replacing part of the URL.

目前為 2020-05-11 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
Gavin Borg
評價
0 0 0
版本
1.0
建立日期
2020-05-11
更新日期
2020-05-11
尺寸
1.4 KB
授權條款
未知
腳本執行於

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

How to Use

  1. 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).
  2. Optional: Open one of the pages that you added (or reload the greasyfork installation page for this script). This will create the default settings structure in the script's storage.
  3. Edit the script in your script manager (Greasemonkey, Tampermonkey, etc.) and look for the storage for this script (Storage tab in Tampermonkey). You should see some 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

Source: GitHub

Available on Greasy Fork for easy installation.