防止邀请脚本

前景提要

最近有很多人在发邀请链接(包括我

但是大家应该都很担心受到骚扰

所以我搞了一个油猴脚本,有大佬可以优化一下。

// ==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 个赞

说的就是你,musifei

6,不光是我,明明还有其他人的

点了会怎么样,我点了。。。

变成别人的下级

道高一尺,魔高一丈

下次就应该有《 防止防止邀请脚本》了

1 个赞

这个是bug 啊,已注册用户还能被邀请

666

快进到《 防止防止防止邀请脚本》

常规话题软件开发

你这变量没必要啊 这样就行了

(function() {
    'use strict';
    if (window.location.href.includes("https://linux.do/invites/")) {
        window.location.replace("https://linux.do");
    }
})();
1 个赞

真好!最好能有佬传到greasyfork上

结合 @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 个赞

链接测试

1 个赞

可以 从源头断绝

1 个赞

看来搭的短链服务能派上用场了(

我这里貌似在linux.do里面跳转的链接油猴脚本都不会生效
就比如我从主页点进这个帖子,油猴脚本不会作用于你发的那个“链接测试”,必须刷新才行
我昨天装的另一位大佬发的检测离3级差距的脚本也是这样

那是因为页面没刷新吧 没检测到

油猴区大佬