CSDN 外链自动跳转

CSDN 外链自动跳转,如果 Gitee 有加速那么首先跳转到 Gitee 加速

// ==UserScript==
// @name         CSDN 外链自动跳转
// @namespace    https://pdev.top/
// @version      1.0.0
// @description  CSDN 外链自动跳转,如果 Gitee 有加速那么首先跳转到 Gitee 加速
// @author       Peter1303
// @match        https://link.csdn.net/?target=*
// @icon         https://www.google.com/s2/favicons?domain=csdn.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function checkLink() {
        let link = ''
        let buttons = $('#linkPage .content .flex-end .loading-btn')
        link = buttons.eq(buttons.length - 1).attr('href')
        if (link != undefined) {
            window.clearInterval(linkInterval)
            window.location.href = link
        }
    }
    var linkInterval = setInterval(checkLink, 100)
})();