Greasy Fork

来自缓存

Greasy Fork is available in English.

方正教务系统自动评价

自动选择所有"很满意"

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         方正教务系统自动评价
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  自动选择所有"很满意"
// @author       wyg
// @match        *://*edu.cn/jwglxt/*
// @grant        none
// @license    MIT
// ==/UserScript==

(function() {
    'use strict';

    function selectVerySatisfied() {    
        console.log('开始执行')
        const radios = document.querySelectorAll('input.radio-pjf');
        console.log(`找到 ${radios.length} 个单选按钮。`);

        radios.forEach(radio => {
            console.log(`单选按钮 data-dyf: ${radio.getAttribute('data-dyf')}`);

            // 检查单选按钮的 data-dyf 属性是否为 '5'(表示“很满意”)
            if (radio.getAttribute('data-dyf') === '5') {
                radio.checked = true;
                console.log("单选按钮已设置为“很满意”。");
            }
        });
    }

    const observer = new MutationObserver(() => {
        selectVerySatisfied();
    });

    observer.observe(document.body, { childList: true, subtree: true });

    selectVerySatisfied();
})();