UESTC评教

用法:导入油猴。进入评教页,点击右上角按钮。(除星星外都帮你填好)

当前为 2023-12-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         UESTC评教
// @namespace    BlingCc_UESTC
// @version      1.2.7
// @description  用法:导入油猴。进入评教页,点击右上角按钮。(除星星外都帮你填好)
// @match        http://eams.uestc.edu.cn/eams/*
// @match        https://eams.uestc.edu.cn/eams/*
// @grant        none
// @author       BlingCc
// @license      GNU General Public License v3.0 or later

// ==/UserScript==

(function() {
    'use strict';

    const button = document.createElement('button');
    button.innerText = '一键评教';
    button.style.position = 'fixed';
    button.style.top = '50px';
    button.style.right = '50px';
    button.style.backgroundColor = '#FEFEFE';
    button.style.boxShadow = '0 4px 20px rgba(0,0,0,.3)';
    button.style.fontWeight = '600';
    button.style.fontSize = "1.2em";
    button.style.padding = '0.75em 1em';
    button.style.color = '#80AAD3';
    button.style.border = '0.15em solid #80AAD3';
    button.style.borderRadius = '2em';
    button.style.cursor = 'pointer';
    button.style.transition = '0.4s';

button.addEventListener('mouseover', function() {
    button.style.backgroundColor = '#80AAD3';
    button.style.color  = '#FEFEFE';
    button.style.border = '0.15em solid #FEFEFE';

  });
  
  button.addEventListener('mouseout', function() {

    button.style.backgroundColor = '#FEFEFE';
    button.style.color  = '#80AAD3';
    button.style.border = '0.15em solid #80AAD3';

  });
    
    button.addEventListener('click', () => {
        button.style.border = '0.15em solid #232323';
        button.style.color  = '#232323';


        var idRegex = /^option_(\d+)_0$/;
        var inputs = document.getElementsByTagName('input');

        for (var i = 0; i < inputs.length; i++) {
            var input = inputs[i];
            
            if (input.id && idRegex.test(input.id)) {
                
                var num = idRegex.exec(input.id)[1];
                
                if (num >= 0 && num <= 100) {  // 这里可以根据你的具体条件进行修改
                    input.checked = true;
                }
            }
        }
        
        const checkboxes = document.querySelectorAll('input[type="checkbox"][id="evaIndex"]');
        checkboxes.forEach((checkbox) => {
            checkbox.checked = true;
        });



        const inputBox = document.querySelector('textarea[id="evaText"]');
        var fourthTdContent = document.querySelector('body > div#BodyBg > div#MainBody.bg1 > div#main.ajax_container > form > table.infoTitle2 > tbody > tr:nth-child(2) > td:nth-child(4)').textContent;
        if (inputBox) {
            const randomNumber = Math.floor(Math.random() * 301);
            inputBox.value = '我认为'+fourthTdContent.toString()+'老师讲的好得很,认真学习就能……' + randomNumber.toString();
        }

        var submitButton = document.getElementById('sub');
        if (submitButton) {
            submitButton.click();
        }
    });

    document.body.appendChild(button);
})();