您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automate certain actions on a webpage with a stylish button trigger
当前为
// ==UserScript== // @name 教评助手 // @namespace http://tampermonkey.net/ // @version 1.0 // @description Automate certain actions on a webpage with a stylish button trigger // @author Bailu // @license MIT // @match https://my.gdip.edu.cn/EducationEvaluation/EducationEvaluation-EvaluationFillListStudent // @grant none // ==/UserScript== (function() { 'use strict'; // 定义sleep函数 async function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } // 定义example函数 async function example(i) { let c = document.querySelectorAll(".table-item-action span:nth-child(2) button.el-button--text"); for (let c1 of c) { let e = document.querySelector(".table-item-action span:nth-child(2) button.el-button--text"); e.click(); await sleep(1000); if (document.querySelector(".player-video video")!= null) { document.querySelector(".el-checkbox span").click(); document.querySelector(".player-video video").play(); await sleep(30 * 1000); document.querySelector(".player-video video").currentTime = 180; await sleep(1000); document.querySelector("span .el-button--primary").click(); } await sleep(1000); if (i == 0) { // 合格 var a = document.querySelectorAll("label.el-radio:nth-child(2)"); } else if (i == 1) { // 满分 var a = document.querySelectorAll("label.el-radio:nth-child(1)"); } await sleep(1000); a.forEach((e) => { e.click(); }); await sleep(1000); let b = document.querySelector("button.el-button--primary"); b.click(); await sleep(1000); } } // 创建并添加美化后的按钮 function addButton() { const button = document.createElement('button'); button.textContent = 'Run Automation'; button.id = 'runAutomationButton'; document.body.appendChild(button); // 添加CSS样式 const style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = ` #runAutomationButton { padding: 10px 20px; font-size: 16px; color: #fff; background-color: #007bff; border: none; border-radius: 5px; cursor: pointer; outline: none; position: fixed; top: 100px; right: 10px; z-index: 9999; transition: background-color 0.3s ease; } #runAutomationButton:hover { background-color: #0056b3; } `; document.head.appendChild(style); // 添加点击事件 button.onclick = function() { example(0); // 假设默认为合格,可以根据需要修改 }; } // 页面加载完毕后添加按钮 window.addEventListener('load', addButton); })();