您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
兰州交通大学实验室安全教育学习考试平台考试助手
// ==UserScript== // @name 实验室安全考试 // @namespace http://tampermonkey.net/ // @version 3.0 // @description 兰州交通大学实验室安全教育学习考试平台考试助手 // @author 白白小草 // @match http://labmis.lzjtu.edu.cn/safe/client_pc/kstest-begin.html* // @icon https://www.google.com/s2/favicons?sz=64&domain=lzjtu.edu.cn // @grant none // @license AGPL License // ==/UserScript== (function() { 'use strict'; // Your code here... setTimeout(() => { const floatingInfo = document.createElement('div'); floatingInfo.className = 'floating-info'; var info = '<div style="position: fixed; left: 0; top: 20%; transform: translateY(-50%); background-color: #3498db; color: #fff; padding: 10px; z-index: 1000;">选择题对应选项为<br> 1-A<br> 2-B<br> 3-C<br> 4-D<br/>判断题为<br> 0-错误<br> 1-正确</div>'; floatingInfo.innerHTML = info; const header = document.getElementsByClassName('top'); for (const head of header){ head.appendChild(floatingInfo) } var answers = document.getElementsByClassName('CorrectAnswer'); const valuesArray = Object.values(answers).map(item => item.value); // console.log(valuesArray) document.addEventListener('click', function(event) { const answerDiv = document.getElementById('answer'); if (answerDiv) { // 获取父元素 const parentElement = answerDiv.parentNode.parentNode; // 从父元素中移除 id="answer" 的 div 元素 parentElement.removeChild(answerDiv.parentNode); } // 当前的题目数 const tsIngValue = document.querySelector('.ts-ing').textContent; let count = valuesArray[tsIngValue - 1]; // console.log('value:', count) if(count == 4){ count = 3; }else if(count == 8){ count = 4; } // 创建浮动图标元素 const floatingIcon = document.createElement('div'); floatingIcon.className = 'floating-icon'; var html1 = '<div id="answer" style="position: fixed; left: 0; top: 50%; transform: translateY(-50%); background-color: #3498db; color: #fff; padding: 10px; border-radius: 50% 0 0 50%; z-index: 1000;">'; var html2 = '</div>'; floatingIcon.innerHTML = html1 + count + '<br>' + html2; // 将浮动图标添加到 #mashangxz 中 // document.getElementById('mashangxz').appendChild(floatingIcon); const header = document.getElementsByClassName('top'); for (const head of header){ head.appendChild(floatingIcon) } // document.getElementsByClassName('top').appendChild(floatingIcon); }); }, 500) })();