跳到正文

剪贴板

剪贴板 02vm3moy

原文
剪贴板信息

剪贴板信息

收录
更新
神虎牌删信器\color{steelblue}\colorbox{steelblue}{\boxed{\Huge\color{cadetblue}\colorbox{#E0FDFF}{\textbf{神虎牌删信器}}}}

神虎钛强啦

操作步骤

  1. 将下方的这段代码粘贴到油猴中。
JavaScript
// ==UserScript==
// @name         luogu-chat-delete
// @match        https://www.luogu.com.cn/chat
// @require      https://cdn.luogu.com.cn/js/jquery-2.1.1.min.js
// ==/UserScript==

function delete_chat(id, csrf) {
    $.ajax({
        url: 'https://www.luogu.com.cn/api/chat/delete',
        type: 'post',
        dataType: 'json',
        data: JSON.stringify({id: id}),
        cache: false,
        headers: {
            'Content-Type': 'application/json',
            'x-csrf-token': csrf
        },
        xhrFields: {
      withCredentials: true
    }
    });
}

function do_delete(uid, csrf) {
    $.get('https://www.luogu.com.cn/api/chat/record?user=' + uid, {}, function (res) {
        console.log(res);
        var t = res['messages']['result'];
        for (var i = 0; i < t.length; i++) {
            console.log(t[i].id + ' ' + t[i].content);
            delete_chat(t[i].id, csrf);
        }
    })
}

(function() {
    'use strict';
    window.onload = function () {
        var csrf = document.getElementsByName('csrf-token')[0].content;
        console.log(csrf);
        if (csrf == null || csrf == undefined) {
            alert('获取x-csrf-token失败!');
            return;
        }
        var name = prompt('请输入要删除私信的uid或用户名:');
        if (name == null || name == undefined) return;
        $.get('https://www.luogu.com.cn/api/user/search?keyword=' + name, {}, function (res) {
            var users = res['users'];
            for (var i = 0; i < users.length; i++) {
                if (users[i] != null) {
                    console.log(users[i]['uid'] + ' ' + users[i]['name']);
                    do_delete(users[i]['uid'], csrf);
                }
            }
        })
    }
})();
  1. 访问洛谷私信

  2. 接着按照提示操作即可。

  3. 如果出现 503\rm 503 界面重新再次重复上述过程。

直到删完为止,重新加载整个界面,建议重启浏览器。

最后就完成了删除私信的过程。