版本比较
一键jc
正文
增加 41 行删除 2 行
2 行未改动34567891011121314151617181920218 行未改动30313233343536372 行未改动2 行未改动```cpp// ==UserScript==// @name Benben Auto Poster// @namespace http://tampermonkey.net/// @version 1.5// @description 一键JC(// @author a_small_OIer// @match https://www.luogu.com.cn// @grant none// @license MIT// ==/UserScript==(function() {'use strict';const TARGET_TEXT = '#I AK IOI';const INTERVAL = 30 * 1000;function sendBenben() {const input = document.querySelector('#feed-content');const btn = document.querySelector('#feed-submit');8 行未改动}}window.addEventListener('load', () => {setTimeout(() => {sendBenben();setInterval(sendBenben, INTERVAL);}, 3000);});2 行未改动2 行未改动34567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253548 行未改动63646566676869707172737475762 行未改动2 行未改动```cpp// ==UserScript==// @name Benben Auto Poster// @namespace http://tampermonkey.net/// @version 1.6// @description 一键JC(支持白名单)// @author a_small_OIer// @match https://www.luogu.com.cn// @grant none// @license MIT// ==/UserScript==(function() {'use strict';const TARGET_TEXT = '#I AK IOI';const INTERVAL = 30 * 1000;// ====== 白名单配置 ======const WHITELIST = {uids: ['1523280'], // UID 列表(字符串)names: ['a_small_OIer'] // 用户名列表(区分大小写)};// =======================function getCurrentUserInfo() {const avatarLink = document.querySelector('a[href^="/user/"] img.avatar');if (avatarLink) {const parentHref = avatarLink.closest('a[href^="/user/"]')?.href || '';const uidMatch = parentHref.match(/\/user\/(\d+)/);return {uid: uidMatch ? uidMatch[1] : null,name: avatarLink.alt || ''};}const nameSpan = document.querySelector('span[style*="font-weight: bold"]');if (nameSpan) {return { uid: null, name: nameSpan.textContent.trim() };}return { uid: null, name: '' };}function isInWhitelist(userInfo) {if (!userInfo) return false;const { uid, name } = userInfo;if (uid && WHITELIST.uids.includes(uid)) return true;if (name && WHITELIST.names.includes(name)) return true;return false;}function sendBenben() {const input = document.querySelector('#feed-content');const btn = document.querySelector('#feed-submit');8 行未改动}}window.addEventListener('load', () => {setTimeout(() => {const userInfo = getCurrentUserInfo();if (isInWhitelist(userInfo)) {const who = userInfo.name || userInfo.uid || '未知用户';console.log(`【一键JC】 用户 ${who} 在白名单中,脚本已停止。`);return;}sendBenben();setInterval(sendBenben, INTERVAL);}, 3000);});2 行未改动