您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
将 TJUPT 中的外链转换为直接链接
- // ==UserScript==
- // @name TJUPT - Direct Links
- // @namespace https://github.com/whtsky/userscripts/
- // @version 20200213
- // @description 将 TJUPT 中的外链转换为直接链接
- // @match https://tjupt.org/*
- // @grant none
- // @supportURL https://github.com/whtsky/userscripts/issues
- // ==/UserScript==
- function removeTo(s, to) {
- const index = s.search(to)
- if (index !== -1) {
- return s.substr(index + to.length)
- }
- return s
- }
- document.querySelectorAll('a').forEach(anchor => {
- let link = anchor.href
- if (link.startsWith('https://tjupt.org/adredir.php')) {
- link = removeTo(link, 'url=')
- } else if (link.startsWith('https://tjupt.org/jump_external.php')) {
- link = removeTo(link, 'ext_url=')
- } else {
- return
- }
- anchor.href = decodeURIComponent(link)
- })