云开 - 在线作业

2023/9/16 上午9:40:49

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        云开 - 在线作业
// @namespace   Violentmonkey Scripts
// @match       https://teach.ynou.edu.cn/hw/student/studentStartHomework.action*
// @require      https://cdn.staticfile.org/jquery/3.6.3/jquery.min.js
// @grant       none
// @version     1.2
// @license MIT
// @author      -
// @description 2023/9/16 上午9:40:49
// ==/UserScript==

(function ($) {
    'use strict';
    // 获取试卷ID
    var url = `https://teach.ynou.edu.cn/hw/student/studentViewHomework.action?paper_id=${paper_id}&studentClass=${studentClass}`
    $.get(url, function(data, status, jqXHR) {
      // 获取试卷试题ID
      $('input[type="radio"]').each(function() {
          // 获取当前 <input> 元素的 id 属性
          var inputId = $(this).attr('id');
          var da = $(data).find("#"+inputId+"_right_answer font").text()
          if($(this).attr('value') == da){
            // 输出 id 属性
            console.log('Input ID:', $(this));
            $(this).click()
          }
      });
      // 获取试卷试题ID
      $('input[type="checkbox"]').each(function() {
          // 获取当前 <input> 元素的 id 属性
          var inputId = $(this).attr('id');
          var da = $(data).find("#"+inputId+"_right_answer font").text()
          if(da.includes($(this).attr('value'))){
            // 输出 id 属性
            console.log('Input ID:', $(this));
            $(this).click()
          }
      });
    });

})(jQuery.noConflict(true));