×
FalconChen
2021-03-15 12:11
又写了一个油猴脚本,告别这个恼人的跳转:https://openuserjs.org/scripts/Falcon/Direct_links_without_redirection
js 代码片断
// ==UserScript==
// @name         Direct links without redirection
// @namespace    https://hi.cellmean.com/
// @version      0.1
// @description  change redirecting link to direct link
// @author       Falcon
// @match        https://www.oschina.net/*
// @match        https://my.oschina.net/*
// @icon         https://static.oschina.net/new-osc/img/favicon.ico
// @run-at      document-start
// @license MIT

// ==/UserScript==
/*jshint esversion: 6 */
(function() {
    'use strict';
    const changeLinks = ()=>{
         document.querySelectorAll('a[href^="https://www.oschina.net/action/GoToLink?url="]').forEach(item=>{
               const href = item.getAttribute('href')
               const link = decodeURIComponent(href.substr(href.indexOf('?')+5))
               item.setAttribute('href',link)

       })
    }

    document.addEventListener ("DOMContentLoaded", changeLinks)
    window.addEventListener('scroll',changeLinks)

})()
4
yang羊羊羊
小呆呆的星空
苗哥
司徒永超

暂无评论