Greasy Fork is available in English.
自动签到,签到速度取决于未签到的吧的数量和网速,签到完成后关注的吧那里会有提示,如果签到失败,会显示失败+失败的吧的数量,具体情况请按F12查看控制台
当前为
// ==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);
}
}