Greasy Fork

来自缓存

Greasy Fork is available in English.

Stage1自动签到

进行Stage1自动签到

当前为 2024-04-27 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Stage1自动签到
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  进行Stage1自动签到
// @author       serj005
// @license      MIT
// @match        https://bbs.saraba1st.com/2b/forum.php
// @icon         https://bbs.saraba1st.com/favicon.ico
// @grant        none
// ==/UserScript==
(() => {
    'use strict'
    const a = document.getElementById('um')
        ?.getElementsByTagName('p')[0]
        ?.getElementsByTagName('a')[2]
    if (!(a && a.innerText && a.innerText.includes('打卡签到') && a.href)) return;
    fetch(a.href).then(response => {
        if (!response.ok) throw new Error('网络响应不正常。');
        showAlert("签到成功", 2)
        a.previousElementSibling.remove()
        a.remove()
    })
    .catch(error => {
        console.error('您的fetch操作出现问题:', error);
        showAlert('签到过程中出现错误', 3)
    });
})();

function showAlert(message, delayInSeconds) {
    const alertBox = document.createElement('div');
    alertBox.style.cssText = 'position:fixed;z-index:1000;padding:20px;background-color:rgb(51,51,51);color:white;border-radius:5px;font-size:16px;width:300px;text-align:center;box-shadow:rgba(0,0,0,0.3) 0px 2px 5px;left:50%;top:20%;transform:translateX(-50%);transition:opacity 0.2s ease-in-out 0s;display:block;opacity: 0'
    alertBox.textContent = message;
    document.body.appendChild(alertBox);
    setTimeout(() => {
        alertBox.style.opacity = '1'
    }, 1)
    setTimeout(() => {
        alertBox.style.opacity = '0'
        setTimeout(() => {alertBox.remove()}, 200)
    }, delayInSeconds * 1000);
}