ik001xa青书学堂讨论脚本
// ==UserScript==
// @name ik001xa青书学堂讨论脚本
// @namespace your-namespace
// @version 1.0
// @description 青书学堂讨论脚本
// @match https://qingshuxuetang.com/*
// @match https://*.qingshuxuetang.com/*
// @match https://www.qingshuxuetang.com/*
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
var isAutoSubmitEnabled = false;
var isNextEnabled = false;
// 获取文本框元素
var textarea = document.getElementById('replyContent');
// 填写数字到文本框
textarea.value = '1'; // 将 '1' 替换为你想要填写的数字
// 创建一个盒子
var box = document.createElement('div');
box.style.border = '1px solid black';
box.style.padding = '10px';
box.style.position = 'fixed';
box.style.bottom = '10px';
box.style.right = '10px';
document.body.appendChild(box);
// 提交按钮
var submitButton = document.createElement('button');
submitButton.innerHTML = '提交';
submitButton.style.marginRight = '10px';
submitButton.addEventListener('click', function() {
isAutoSubmitEnabled = !isAutoSubmitEnabled;
submitButton.innerHTML = isAutoSubmitEnabled ? '停止提交' : '提交';
if (isAutoSubmitEnabled) {
setTimeout(autoSubmit, 1000); // 延迟1秒后开始自动提交
}
});
box.appendChild(submitButton);
// 下一个按钮
var nextButton = document.createElement('button');
nextButton.innerHTML = '跳转下一个';
nextButton.style.marginLeft = '10px';
nextButton.addEventListener('click', function() {
isNextEnabled = true;
nextButton.disabled = true;
setTimeout(jumpToNext, 1000); // 延迟1秒后跳转到下一个页面
});
box.appendChild(nextButton);
// 开启按钮
var toggleButton = document.createElement('button');
toggleButton.innerHTML = '开启';
toggleButton.style.marginLeft = '10px';
toggleButton.addEventListener('click', function() {
isAutoSubmitEnabled = !isAutoSubmitEnabled;
isNextEnabled = !isNextEnabled;
submitButton.innerHTML = isAutoSubmitEnabled ? '停止提交' : '提交';
nextButton.disabled = isNextEnabled;
toggleButton.innerHTML = isAutoSubmitEnabled ? '关闭' : '开启';
if (isAutoSubmitEnabled) {
setTimeout(autoSubmit, 1000); // 延迟1秒后开始提交
} else if (isNextEnabled) {
setTimeout(jumpToNext, 1000); // 延迟1秒后跳转到下一个页面
}
});
box.appendChild(toggleButton);
// 创建悬浮窗
var floatingWindow = document.createElement('div');
floatingWindow.id = 'customFloatingWindow';
floatingWindow.style.display = 'none';
floatingWindow.style.position = 'fixed';
floatingWindow.style.top = '50%';
floatingWindow.style.left = '50%';
floatingWindow.style.transform = 'translate(-50%, -50%)';
floatingWindow.style.backgroundColor = 'white';
floatingWindow.style.padding = '20px';
floatingWindow.style.border = '1px solid black';
floatingWindow.style.zIndex = '9999';
document.body.appendChild(floatingWindow);
// 创建关闭按钮
var closeButton = document.createElement('button');
closeButton.innerHTML = 'x';
closeButton.style.position = 'absolute';
closeButton.style.top = '5px';
closeButton.style.right = '5px';
closeButton.style.padding = '5px';
closeButton.style.borderRadius = '50%';
closeButton.style.backgroundColor = 'lightgray';
closeButton.style.border = 'none';
closeButton.addEventListener('click', function() {
floatingWindow.style.display = 'none';
});
floatingWindow.appendChild(closeButton);
// 自定义悬浮窗函数
function showFloatingWindow(message) {
var floatingWindow = document.getElementById('customFloatingWindow');
floatingWindow.innerHTML = message;
floatingWindow.style.display = 'block';
}
// 自动提交函数
function autoSubmit() {
if (isAutoSubmitEnabled) {
var submitLink = document.querySelector('.submit-reply');
if (submitLink) {
submitLink.click();
showFloatingWindow('提交成功!'); // 显示悬浮窗
}
setTimeout(autoSubmit, 1000); // 每隔1秒自动提交一次
}
}
// 跳转下一个函数
function jumpToNext() {
if (isNextEnabled) {
var nextLink = document.querySelector('.turn-href');
if (nextLink) {
nextLink.click(); // 触发点击下一个按钮
showFloatingWindow('跳转到下一个页面!'); // 显示悬浮窗
}
}
}
var customText = 'ik001xa青书学堂讨论脚本'; //
// 在页面加载完成后显示悬浮窗
window.addEventListener('load', function() {
showFloatingWindow(customText);
});
})();