Skip to content

Instantly share code, notes, and snippets.

@Rainboylvx
Created February 22, 2025 02:47
Show Gist options
  • Save Rainboylvx/7dec3b8100f53ecee56708ca1d7a269d to your computer and use it in GitHub Desktop.
Save Rainboylvx/7dec3b8100f53ecee56708ca1d7a269d to your computer and use it in GitHub Desktop.
NJU-计算机解决问题-替换链接-油猴脚本
// ==UserScript==
// @name NJU-计算机解决问题-替换链接
// @namespace https://github.com/rainboylvx
// @version 0.1
// @description 将http://114.212.10.6/开头的链接替换为http://cslabcms.nju.edu.cn/
// @author rainboy ([email protected])
// @match http://cslabcms.nju.edu.cn/problem_solving/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 获取页面中所有的链接
const links = document.querySelectorAll('a[href^="http://114.212.10.6/"]');
links.forEach(link => {
// 替换链接
link.href = link.href.replace('http://114.212.10.6/', 'http://cslabcms.nju.edu.cn/');
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment