Greasy Fork

掘金外链免点击自动跳转

点击外链时自动触发继续访问,我就是懒

当前为 2024-12-20 提交的版本,查看 最新版本

// ==UserScript==
// @name         掘金外链免点击自动跳转
// @namespace    zonahaha
// @version      0.0.2
// @description  点击外链时自动触发继续访问,我就是懒
// @author       zonahaha
// @match        https://link.juejin.cn/?target=http*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=juejin.cn
// @grant        none
// @run-at       document-end
// @license      WTFPL
// ==/UserScript==

(function() {
    'use strict';

    setTimeout(()=>{
        const btn = document.querySelector('.middle-page .content .btn')
        if(btn){
            btn.click();
            btn.innerText = '自动跳转中...';
            btn.style.backgroundColor=getRandomColor();
        }
    },0)
})();


function getRandomColor() {
    // 生成随机RGB颜色
    const r = Math.floor(Math.random() * 256);
    const g = Math.floor(Math.random() * 256);
    const b = Math.floor(Math.random() * 256);
    return `rgb(${r},${g},${b})`;
}