Greasy Fork

Greasy Fork is available in English.

zjutyjs_selectCourses

improve the selectCourse pages

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         zjutyjs_selectCourses
// @namespace    https://github.com/silevilence/zjutyjs
// @version      0.3
// @description  improve the selectCourse pages
// @author       Silevilence
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js
// @match        http://yjs.zjut.edu.cn/tasks/selectCourse-tree.asp
// @match        http://yjs.zjut.edu.cn/tasks/selectCourse-master.asp
// @match        http://yjs.zjut.edu.cn/tasks/selectCourse.asp
// ==/UserScript==

(function () {
    'use strict';

    // 提取课程号和班级号的正则
    const regId = /selectCourse-detail-noLearn.asp\?kcbh=(\d+)&bjdm=(\d+)/;

    let linksAdd;

    // 删除课程的表格
    let linksDel = $('form[action="selectCourse-tree-DelItem.asp"] table tbody tr td a');
    linksDel.each(function () {
        let href = $(this).attr('href');
        let ids = regId.exec(href);
        let courseId = ids[1];
        // noinspection SpellCheckingInspection
        $(this).parent().prev().prev().html(`<input type="checkbox" name="ckbdel" value="${courseId}">`);
    });

    // 增加课程的表格
    linksAdd = $('form[action="selectCourse-master-AddItem.asp"] table tbody tr td a');
    linksAdd.each(function () {
        let href = $(this).attr('href');
        let ids = regId.exec(href);
        let courseId = ids[1],
            classId = ids[2];
        // noinspection SpellCheckingInspection
        $(this).parent().prev().prev().html(`<input type="checkbox" name="cboke" value="${courseId}${classId}">`);
    });
})();