惠州学院 HZU | 教务系统查分助手

没有任何引流和诱导,不需要手动输入代码,安装后访问学校教务系统,然后进入"学籍预警查询"或查分助手即可查询成绩信息。同时在主菜单添加快速入口。

目前為 2025-06-23 提交的版本,檢視 最新版本

// ==UserScript==
// @name         惠州学院 HZU | 教务系统查分助手
// @namespace    http://tampermonkey.net/
// @version      1.1.0
// @description  没有任何引流和诱导,不需要手动输入代码,安装后访问学校教务系统,然后进入"学籍预警查询"或查分助手即可查询成绩信息。同时在主菜单添加快速入口。
// @author       [email protected]
// @license      Apache License 2.0
// @match        https://jwxt.hzu.edu.cn/xjyj/*
// @match        https://jwxt.hzu.edu.cn/xtgl/*
// @homepage     https://gf.qytechs.cn/en/scripts/500594
// @homepage     https://github.com/Ckrvxr
// ==/UserScript==

(function() {
    function addMainMenuItem() {
        const nav = document.querySelector('#cdNav .nav.navbar-nav');
        if (nav) {
            const menuItem = document.createElement('li');
            menuItem.className = 'dropdown';
            menuItem.style.marginLeft = '8px';
            const link = document.createElement('a');
            link.href = 'https://jwxt.hzu.edu.cn/xjyj/xjyj_cxXjyjIndex.html?gnmkdm=N105505&layout=default';
            link.textContent = '查分助手';
            link.style.fontWeight = 'bold';
            link.style.color = '#8fbda0';
            link.style.boxShadow = 'inset 0 0 0 3px #8fbda0';
            menuItem.appendChild(link);
            nav.appendChild(menuItem);
        }
    }

    function handleScoreQuery() {
        const c = "https://jwxt.hzu.edu.cn/xjyj/xjyj_cxXjyjjdlb.html";
        function s() {
            return {
                jg_id: document.getElementById("jg_id").value,
                njdm_id: document.getElementById("njdm_id").value,
                zyh_id: document.getElementById("zyh_id").value
            };
        }
        function a(t) {
            const e = new URLSearchParams(t).toString();
            return fetch(c, {
                method: "POST",
                headers: {
                    "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
                },
                body: e
            }).then((o) => o.json());
        }
        function i(t) {
            let e = [];
            return t.forEach((o) => {
                o.kcList && o.kcList.forEach((n) => {
                    n.kcmc && n.bfzcj && e.push({
                        name: n.kcmc,
                        score: parseFloat(n.bfzcj)
                    });
                });
            }), e.sort((o, n) => o.name.localeCompare(n.name, "zh-CN"));
        }
        function d(t) {
            return t.map((e) => `
                            <div class="course-score ${e.score < 60 ? "fail" : "pass"}">
                                <span class="course-name">${e.name}</span>
                                <span class="course-score-value">${e.score}</span>
                            </div>
                        `).join("");
        }
        function r(t, e = !1, o = null) {
            // Calculate counts for each filter
            const allCount = o.length;
            const passCount = o.filter(course => course.score >= 60).length;
            const failCount = o.filter(course => course.score < 60).length;

            const n = document.createElement("div");
            n.id = "custom-modal", n.innerHTML = `
                        <div class="modal-content">
                            <h2 class="modal-title">${e ? "错误" : "您的成绩"}</h2>
                            <div class="filter-buttons">
                                <button class="filter-btn active" data-filter="all">全部 (${allCount})</button>
                                <button class="filter-btn" data-filter="pass">及格 (${passCount})</button>
                                <button class="filter-btn" data-filter="fail">不及格 (${failCount})</button>
                            </div>
                            <div class="scores-container">${t}</div>
                            <button class="close-btn">×</button>
                        </div>
                    `, document.body.appendChild(n);

            const l = n.querySelector(".close-btn");
            l.onclick = () => n.remove();

            if (!e) {
                const u = n.querySelectorAll(".filter-btn");
                u.forEach((m) => {
                    m.onclick = () => {
                        u.forEach((h) => h.classList.remove("active"));
                        m.classList.add("active");
                        const f = m.dataset.filter;
                        n.querySelectorAll(".course-score").forEach((h) => {
                            h.style.display = f === "all" ? "flex" :
                                            f === "pass" ? (h.classList.contains("pass") ? "flex" : "none") :
                                            (h.classList.contains("fail") ? "flex" : "none");
                        });
                    };
                });
            }
        }
        function l() {
            const t = document.createElement("style");
            t.textContent = `
                        #custom-modal {
                            position: fixed;
                            left: 0;
                            top: 0;
                            width: 100%;
                            height: 100%;
                            display: flex;
                            justify-content: center;
                            align-items: center;
                            z-index: 10000;
                            backdrop-filter: blur(10px) saturate(180%);
                        }
                        .modal-content {
                            background-color: #fff;
                            border-radius: 10px;
                            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
                            width: 90%;
                            max-width: 500px;
                            max-height: 80vh;
                            display: flex;
                            flex-direction: column;
                            overflow: hidden;
                            position: relative;
                        }
                        .modal-title {
                            font-size: 24px;
                            color: #333;
                            margin: 0;
                            padding: 20px;
                            background-color: #fff;
                            border-bottom: 2px solid #f0f0f0;
                            text-align: center;
                            position: sticky;
                            top: 0;
                            z-index: 2;
                        }
                        .filter-buttons {
                            display: flex;
                            justify-content: center;
                            gap: 10px;
                            padding: 10px 20px;
                            background-color: #f8f9fa;
                            border-bottom: 1px solid #e9ecef;
                        }
                        .filter-btn {
                            padding: 6px 12px;
                            border: none;
                            border-radius: 4px;
                            background-color: #e9ecef;
                            color: #495057;
                            cursor: pointer;
                            transition: all 0.3s ease;
                            font-size: 14px;
                        }
                        .filter-btn:hover {
                            background-color: #dee2e6;
                        }
                        .filter-btn.active {
                            background-color: #8fbda0;
                            color: white;
                            font-weight: bold;
                        }
                        .scores-container {
                            padding: 20px;
                            overflow-y: auto;
                            flex-grow: 1;
                        }
                        .course-score {
                            display: flex;
                            justify-content: space-between;
                            align-items: center;
                            padding: 12px 15px;
                            margin-bottom: 10px;
                            border-radius: 5px;
                            transition: all 0.3s ease;
                        }
                        .course-score:hover {
                            transform: translateY(-3px);
                            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
                        }
                        .course-score.pass {
                            background-color: #e8f5e9;
                            border-left: 4px solid #4caf50;
                        }
                        .course-score.fail {
                            background-color: #ffebee;
                            border-left: 4px solid #f44336;
                        }
                        .course-name {
                            font-weight: bold;
                            color: #333;
                            flex-grow: 1;
                            margin-right: 10px;
                        }
                        .course-score-value {
                            font-weight: bold;
                            font-size: 18px;
                        }
                        .pass .course-score-value {
                            color: #4caf50;
                        }
                        .fail .course-score-value {
                            color: #f44336;
                        }
                        .close-btn {
                            position: absolute;
                            top: 10px;
                            right: 10px;
                            border: none;
                            background: none;
                            font-size: 48px;
                            color: #999;
                            cursor: pointer;
                            transition: color 0.3s ease;
                            z-index: 20020;
                        }
                        .close-btn:hover {
                            color: #fc4e4e;
                        }
                        .scores-container::-webkit-scrollbar {
                            width: 8px;
                        }
                        .scores-container::-webkit-scrollbar-track {
                            background: #f1f1f1;
                            border-radius: 4px;
                        }
                        .scores-container::-webkit-scrollbar-thumb {
                            background: #888;
                            border-radius: 4px;
                        }
                        .scores-container::-webkit-scrollbar-thumb:hover {
                            background: #555;
                        }
                    `, document.head.appendChild(t);
        }
        function u() {
            const t = s();
            a(t).then(i).then((e) => {
                const o = d(e);
                r(o, false, e); // Pass the original course data to the modal function
            }).catch((e) => {
                r(`错误: ${e.message}`, !0);
            });
        }
        l();
        u();
    }

    if (window.location.href.includes('xtgl/')) {
        addMainMenuItem();
    } else if (window.location.href.includes('xjyj/')) {
        // On xjyj page - handle score query
        window.addEventListener("load", handleScoreQuery);
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址