您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自动签到脚本,从本地读取上次签到时间并判断是否是新的一天进行签到
当前为
// ==UserScript== // @name 共创世界(CCW)自动签到 // @namespace https://greasyfork.org/zh-CN/scripts/481630-%E5%85%B1%E5%88%9B%E4%B8%96%E7%95%8C-ccw-%E8%87%AA%E5%8A%A8%E7%AD%BE%E5%88%B0 // @version 1.1 // @description 自动签到脚本,从本地读取上次签到时间并判断是否是新的一天进行签到 // @author kukemc // @match *ccw.site // @grant GM_setValue // @grant GM_getValue // @license MIT // ==/UserScript== (function() { 'use strict'; // 从本地读取上次签到时间 var lastCheckinTime = GM_getValue('lastCheckinTime'); // 获取当前日期 var currentDate = new Date().toLocaleDateString(); console.log('开始判断签到'); // 判断是否是新的一天 if (lastCheckinTime !== currentDate) { console.log('执行签到'); // 执行签到操作 var token = document.cookie .split('; ') .find(row => row.startsWith('token=')) .split('=')[1]; var headers = { 'Content-Type': 'application/json', 'token': token }; var payload = { 'scene': 'HOMEPAGE' }; // 发送签到请求 fetch('https://community-web.ccw.site/study-community/check_in_record/insert', { method: 'POST', headers: headers, body: JSON.stringify(payload) }) .then(response => response.json()) .then(data => { console.log(data); // 控制台输出签到结果 // 将签到时间写入本地存储 GM_setValue('lastCheckinTime', currentDate); }) .catch(error => console.error(error)); } else { console.log("用户已签到过"); // 控制台输出不是新的一天 } })();