跳转链接直达

知乎,CSDN,简书,开源中国,掘金 跳转链接直达

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        跳转链接直达
// @description 知乎,CSDN,简书,开源中国,掘金 跳转链接直达
// @namespace   https://github.com/golyu/directTo/issues
// @version     0.9.1
// @author      g
// @include     *://link.zhihu.com/*
// @include     *://link.csdn.net/*
// @include     *://link.juejin.cn/*
// @include     *://www.jianshu.com/go-wild*
// @include     *://www.oschina.net/action/GoToLink*
// @license     MIT License ???直接
// @supportURL  https://github.com/golyu/directTo/issues
// @run-at      document-start
// @grant       unsafeWindow
// ==/UserScript==
"use strict";
class Base {
    constructor(regexp, regexpDetails) {
        this.regexp = regexp;
        this.regexpDetails = regexpDetails;
    }
    getRegexp() {
        return this.regexp;
    }
    getToUrl(href) {
        const result = this.regexpDetails.exec(href);
        if (result && result.length > 1) {
            return decodeURIComponent(result[1]);
        }
        return "";
    }
}
const websiteArray = [
    new Base(/jianshu/, /.*jianshu.com\/go-wild.*url=(.*)/),
    new Base(/oschina/, /.*oschina.net\/action\/GoToLink.*url=(.*)/),
    new Base(/zhihu/, /.*link.zhihu.com\/\?target=(.*)/),
    new Base(/juejin/, /.*link.juejin.cn\/\?target=(.*)/),
    new Base(/csdn/, /.*link.csdn.net\/\?target=(.*)/),
];
websiteArray.some(website => {
    return (function () {
        if (website.getRegexp().test(window.location.href)) {
            const url = website.getToUrl(window.location.href);
            if (url) {
                window.location.href = url;
                return true;
            }
        }
        return false;
    })();
});
//# sourceMappingURL=directTo.js.map