安徽工业大学教务系统计算GPA

try to take over the world!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         安徽工业大学教务系统计算GPA
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  try to take over the world!
// @author       Z
// @match        http://jwxt.ahut.edu.cn/jsxsd/kscj/cjcx_list
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // Your code here...
    var mytable=document.querySelector("#dataList")
    if(mytable && mytable.rows[1].cells[0].innerText!="未查询到数据"){
        var sumCredits=0//定义总学分
        var totalScore=0//定义总成绩
        for (var i=1;i<mytable.rows.length;i++){
            if(!isNaN(parseFloat(mytable.rows[i].cells[6].innerText))){
                sumCredits+=parseFloat(mytable.rows[i].cells[8].innerText)
                totalScore+=parseFloat(mytable.rows[i].cells[8].innerText)*parseFloat(mytable.rows[i].cells[6].innerText)}}
    var gpa= totalScore/sumCredits
    alert("您的平均学分绩是"+gpa.toFixed(2))}
})();