Greasy Fork

Greasy Fork is available in English.

🔥任何网页下完成🔥52破解论坛&吾爱破解论坛自动签到

在任何网页下完成吾爱破解论坛签到, 使用了tampermonkey进行跨域请求, 弹出提示请选择"总是允许域名"

当前为 2025-03-23 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         🔥任何网页下完成🔥52破解论坛&吾爱破解论坛自动签到
// @namespace    http://greasyfork.icu/zh-CN/users/690532-xht1810
// @version      1.0.1.0
// @description  在任何网页下完成吾爱破解论坛签到, 使用了tampermonkey进行跨域请求, 弹出提示请选择"总是允许域名"
// @require      https://cdn.jsdelivr.net/npm/sweetalert2@9
// @author       雷锋
// @match        http://*/*
// @match        https://*/*
// @grant        GM_xmlhttpRequest
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_openInTab
// @license MIT
// @noframes
// ==/UserScript==
/* global Swal */
const url = "https://www.52pojie.cn/home.php?mod=task&do=apply&id=2"; // https://www.52pojie.cn/home.php?mod=task&do=draw&id=2

const checkNewDay = (ts) => {
    const t = new Date(ts);
    t.setMinutes(t.getMinutes());
    t.setHours(0, 0, 0, 0);
    const d = new Date();
    d.setMinutes(t.getMinutes());
    return (d - t > 86400e3);
};

const sign = () => {
    if (GM_getValue("notified")) {
        sendRequest();
    } else {
        Swal.fire(`由于脚本使用了tampermonkey进行跨域请求, 弹出提示请选择"总是允许域名"`).then(() => {
            GM_setValue("notified", true);
            sendRequest();
        });
    }
};

const sendRequest = () => {
    GM_xmlhttpRequest({
        method: "GET",
        url: url,
        timeout: 10e3,
        onload: response => {
            response = response.response;
            if (response.match("任务已完成") !== null) {
                Swal.fire({
                    icon: 'success',
                    title: '52破解论坛自动签到',
                    html: `<strong>成功!</strong>`
                });
                GM_setValue("ts", Date.now());
            } else if (response.match("您已申请过此任务") !== null) {
                Swal.fire({
                    icon: 'warning',
                    title: '52破解论坛自动签到',
                    text: '您已经签到过了!'
                });
                GM_setValue("ts", Date.now());
            } else if (response.match("您需要先登录才能继续本操作") !== null) {
                Swal.fire({
                    icon: 'error',
                    title: '52破解论坛自动签到',
                    text: '您需要先登录才能继续本操作!'
                });
            } else {
                console.log(response);
                Swal.fire({
                    icon: 'error',
                    title: '52破解论坛自动签到',
                    text: '未知返回信息❗ 请打开控制台查看详情。',
                    cancelButtonText: '取消',
                    confirmButtonText: '手动打开',
                    focusConfirm: true,
                    showCancelButton: true,
                    allowOutsideClick: false,
                    allowEscapeKey: false
                }).then(res => {
                    if (res.isConfirmed) {
                        GM_openInTab(url, {
                            loadInBackground: true
                        });
                    }
                    Swal.fire({
                        icon: 'info',
                        title: '52破解论坛自动签到',
                        text: '今日是否不再尝试签到?',
                        cancelButtonText: '否',
                        confirmButtonText: '是',
                        focusConfirm: true,
                        showCancelButton: true,
                        allowOutsideClick: false,
                        allowEscapeKey: false
                    }).then(res => {
                        if (res.isConfirmed) {
                            GM_setValue("ts", Date.now());
                        }
                    });
                });
            }
        },
        onerror: function () {
            Swal.fire({
                icon: 'error',
                title: '52破解论坛自动签到',
                text: '请求签到时发生错误, 请检查网络或代理, 防火墙等',
            });
        }
    });
};

window.onload = () => {
    if (!window.location.href.match("52pojie.cn") && (!GM_getValue("ts") || checkNewDay(GM_getValue("ts")))) {
        sign();
    }
};