Greasy Fork

Greasy Fork is available in English.

AHNU平均绩点查看

安徽师范大学-教务网-培养方案完成情况-查看平均绩点

当前为 2021-07-14 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         AHNU平均绩点查看
// @namespace    3hex
// @version      0.1.1
// @description  安徽师范大学-教务网-培养方案完成情况-查看平均绩点
// @author       3hex
// @match        http://jw.ahnu.edu.cn/student/for-std/program-completion-preview/info*
// @icon         http://t12.baidu.com/it/u=516966630,3245333137&fm=179&app=42&f=JPEG?w=120&h=120&s=8020FC16729173F55B8109840300B060
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_setClipboard
// @grant GM_log
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @grant window.close
// @grant window.focus
// @require https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';
    var i=0;
    var score_sum = 0;
    var grade_sum = 0;
    var all_5 = 0;
    var all_4 = 0;
    var all_3 = 0;
    var all_2 = 0;
    var info = $('.table-field tbody tr');
    for(i=0;i<info.length;i++){
        if($($(info[i]).children()[7]).text() == "通过"){
            //console.log($($(info[i]).children()[0]).text());
            score_sum += parseFloat($($(info[i]).children()[4]).text());
            grade_sum += parseFloat($($(info[i]).children()[4]).text() * $($(info[i]).children()[6]).text());

            //console.log(parseFloat($($(info[i]).children()[4]).text()), parseFloat($($(info[i]).children()[6]).text()));
            switch(parseInt($($(info[i]).children()[6]).text())){
                case 5: $($(info[i]).children()[6]).css("background-color","darkgreen").css("color","#fff");  all_5++; break;
                case 4: $($(info[i]).children()[6]).css("background-color","green").css("color","#fff");  all_4++;  break;
                case 3: $($(info[i]).children()[6]).css("background-color","mediumseagreen").css("color","#fff");   all_3++; break;
                case 2: $($(info[i]).children()[6]).css("background-color","mediumaquamarine").css("color","#fff");  all_2++;  break;
                default: $($(info[i]).children()[6]).css("background-color","red").css("color","#fff");   break; break;
            }
            $($(info[i]).children()[0]).css("background-color","palegreen");
        }else{
            $($(info[i]).children()[0]).css("background-color","navajowhite");
        }
    }

    console.log("不统计计划外:",score_sum.toFixed(2), grade_sum.toFixed(2), (grade_sum/score_sum).toFixed(2));

    var txt=$("<p style='color:white;background-color:red;'></p>").text("平均绩点(不统计计划外):" + (grade_sum/score_sum).toFixed(2));
    $(".course-modules").append(txt);

    info = $('.outer-course-table tbody tr');
    for(i=0;i<info.length;i++){
        if($($(info[i]).children()[7]).text() == "通过"){
            //console.log($($(info[i]).children()[0]).text());
            score_sum += parseFloat($($(info[i]).children()[4]).text());
            grade_sum += parseFloat($($(info[i]).children()[4]).text() * $($(info[i]).children()[6]).text());

            switch(parseInt($($(info[i]).children()[6]).text())){
                case 5: $($(info[i]).children()[6]).css("background-color","darkgreen");  break;
                case 4: $($(info[i]).children()[6]).css("background-color","green");  break;
                case 3: $($(info[i]).children()[6]).css("background-color","lime");  break;
                case 2: $($(info[i]).children()[6]).css("background-color","Orange");  break;
                default: $($(info[i]).children()[6]).css("background-color","red");  break; break;
            }

        }
    }
   console.log(":",score_sum.toFixed(2), grade_sum.toFixed(2), (grade_sum/score_sum).toFixed(2));

    txt=$("<p style='color:white;background-color:red;'></p>").text("平均绩点(统计计划外):" + (grade_sum/score_sum).toFixed(2));
    $(".course-modules").append(txt);

})();