XODI
(XODI)
1
前景提要
最近有很多人在发邀请链接(包括我
但是大家应该都很担心受到骚扰
所以我搞了一个油猴脚本,有大佬可以优化一下。
// ==UserScript==
// @name 邀请链接拦截器
// @namespace https://linux.do
// @version 1.0
// @description 拦截某些人的邀请链接
// @author XODI
// @match https://linux.do/invites/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 获取链接
var currentURL = window.location.href;
if(currentURL.includes("https://linux.do/invites/")) {
var inviteCode = currentURL.split("https://linux.do/invites/")[1];
window.location.replace("https://linux.do");
}
})();
5 个赞
Hua
(Hua)
12
你这变量没必要啊 这样就行了
(function() {
'use strict';
if (window.location.href.includes("https://linux.do/invites/")) {
window.location.replace("https://linux.do");
}
})();
1 个赞
结合 @Hua 大佬的浅浅粗糙修改了一下,把帖内的邀请链接也直接修改成linux.do
了
// ==UserScript==
// @name Linux.do邀请链接拦截器
// @namespace https://linux.do
// @version 1.0
// @description 拦截某些人的邀请链接
// @author XODI
// @match https://linux.do/invites/*
// @match https://linux.do/t/topic/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=linux.do
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 获取链接
if (window.location.href.includes("https://linux.do/invites/")) {
window.location.replace("https://linux.do");
}
// 获取页面中的链接
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll("div .regular .contents").forEach((el) => {
el.querySelectorAll("a").forEach((a) => {
if(a.href.includes("https://linux.do/invites/")) {
a.href = "https://linux.do";
}
})
});
});
})();
2 个赞
我这里貌似在linux.do里面跳转的链接油猴脚本都不会生效
就比如我从主页点进这个帖子,油猴脚本不会作用于你发的那个“链接测试”,必须刷新才行
我昨天装的另一位大佬发的检测离3级差距的脚本也是这样