外链跳转

简书/知乎/CSDN外链跳转

// ==UserScript==
// @name         外链跳转
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  简书/知乎/CSDN外链跳转
// @author       [email protected]
// @match        https://www.jianshu.com/go-wild?*
// @match        https://link.zhihu.com/?target=*
// @match        https://link.csdn.net/?target=*
// ==/UserScript==

var map = {
    'www.jianshu.com': 'url',
    'link.zhihu.com': 'target',
    'link.csdn.net': 'target',
};

(function () {
    'use strict';
    var params = new URLSearchParams(location.search);
    location.href = params.get(map[location.hostname]);
})();