Greasy Fork

Greasy Fork is available in English.

贴吧签到助手

自动签到,签到速度取决于未签到的吧的数量和网速,签到完成后关注的吧那里会有提示,如果签到失败,会显示失败+失败的吧的数量,具体情况请按F12查看控制台

当前为 2020-09-02 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         贴吧签到助手
// @namespace    https://hsmyldk.top
// @version      0.4
// @description  自动签到,签到速度取决于未签到的吧的数量和网速,签到完成后关注的吧那里会有提示,如果签到失败,会显示失败+失败的吧的数量,具体情况请按F12查看控制台
// @author       Hsmyldk
// @match        https://tieba.baidu.com
// @match        https://tieba.baidu.com/index.html
// @grant        none
// ==/UserScript==

var tieba = [];
var badTieba = [];
var badItems = 0;
var first = true;
$('#moreforum').trigger(new Event('mouseenter'));
$('#moreforum').trigger(new Event('click'));
var items = document.getElementsByClassName('unsign');
for (var i = 0; i < items.length; i++) {
    var href = items[i].href;
    tieba.push(decodeURI(href.substring(('https://tieba.baidu.com/f?kw=').length, href.indexOf('&fr=index'))));
}
console.log(tieba);
if (tieba.length != 0)
    qd();

function qd() {
    if (tieba.length != 0) {
        var xml = new XMLHttpRequest();
        xml.open("POST", "https://tieba.baidu.com/sign/add?ie=utf-8&kw=" + tieba[0])
        xml.send();
        xml.onload = e => {
            var response = JSON.parse(e.currentTarget.response);
            if (response.no == 0) {
                console.log(tieba[0] + "签到成功");
            } else {
                if (decodeURI(response.error) == 'need vcode') {
                    badTieba.push(tieba[0]);
                } else {
                    console.log(tieba[0] + "签到失败:" + decodeURI(response.error))
                    badItems++;
                }
            }
            tieba.splice(0, 1);
            if (tieba.length == 0 && first) {
                tieba = badTieba;
                badTieba = [];
                first = false;
            }
            setTimeout(() => {
                qd();
            }, 100);
        }
    } else {
        var a = document.createElement('a');
        a.href = "#";
        a.className = "u-f-item sign";
        if (badItems == 0) {
            a.innerHTML = "已签到";
        } else {
            a.innerHTML = "失败" + badItems;
        }
        document.getElementById('likeforumwraper').append(a);
    }
}