去你妈的评教

自动点击评教系统的选项

// ==UserScript==
// @name         去你妈的评教
// @namespace    https://github.com/Cindy-Master
// @version      0.0.1
// @description  自动点击评教系统的选项
// @author       Cindy-Master
// @match        http://202.204.17.157/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 等待页面完全加载
    window.addEventListener('load', function() {
        $("div.ti").each(function() {
            var topOptions = []; 


            $(this).find("input[type='radio']").each(function() {
                var score = parseInt($(this).val(), 10); 
                topOptions.push({score: score, input: $(this)});
            });


            topOptions.sort(function(a, b) {
                return b.score - a.score;
            });


            if (topOptions.length >= 2) {
                var choice = Math.random() < 0.5 ? 0 : 1; 
                topOptions[choice].input.prop("checked", true);
            } else if (topOptions.length === 1) {
                topOptions[0].input.prop("checked", true);
            }
        });
    }, false);
})();