Greasy Fork

Greasy Fork is available in English.

直接访问链接

避免链接的二次点击

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        直接访问链接
// @description 避免链接的二次点击
// @namespace   https://gitee.com/inch_whf/tampermonkey-script-inch
// @version     1.6
// @author      wuhongfei
// @license     MIT
// @grant       none
// @include     *
// ==/UserScript==

(function(){
    // 获得重定向的href,前面的优先
    var href = 
        // 百度贴吧
        getHrefBySectctor("jump.bdimg.com","/safecheck/index",".link")
        // 参数target:掘金、知乎
        || getUrlParameter("target") 
        // 参数url:简书
        || getUrlParameter("url")

    console.log(href);
    if( href != null && href.startsWith("http") ){
        window.location.href = decodeURIComponent(href);
    }
})();

function getHrefBySectctor(host,pathname,selector){
    return window.location.host == host && window.location.pathname == pathname && document.querySelector(selector).innerHTML;
}

function getUrlParameter(key){
    return new URL(window.location.href).searchParams.get(key);
}