直接访问链接

避免链接的二次点击

目前為 2023-02-02 提交的版本,檢視 最新版本

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

(function(){
    // 获得重定向的href,前面的优先
    var href = 
        // 百度贴吧
        window.location.host == "jump.bdimg.com" && window.location.pathname == "/safecheck/index" && document.querySelector(".link").innerHTML
        // target参数:掘金、知乎
        || getQueryVariable("target") 
        // url参数:简书
        || getQueryVariable("url");


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

// 获得URL参数。参考:https://www.runoob.com/w3cnote/js-get-url-param.html
function getQueryVariable(variable)
{
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if(pair[0] == variable){return pair[1];}
    }
    return null;
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址