New Userscript

Tính điểm trung bình của sinh viên FPT tại http://fap.fpt.edu.vn/Grade/StudentTranscript.aspx

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      2.1.2
// @description  Tính điểm trung bình của sinh viên FPT tại http://fap.fpt.edu.vn/Grade/StudentTranscript.aspx
// @author       You
// @match        http://fap.fpt.edu.vn/Grade/StudentTranscript.aspx*
// @require      http://code.jquery.com/jquery-1.9.1.js
// @grant        none
// ==/UserScript==

$(document).ready(function() {
    $('body').append('<input type="button" value="Tính điểm trung bình" id="btnCal">')
    $("#btnCal").css("position", "fixed").css("top", 0).css("left", 0);
    $('#btnCal').click(function(){
        var tbody = $($('.table')[0]).find('tbody');
        var length = $(tbody).find('tr').length;
        var gradeSummary = 0;
        var creditSummary = 0;
        var totalCredit = 0;
        for(var i = 0; i< length;i++){
            var tr = (tbody).find('tr')[i];
            try {
                var subject = $(tr).find('td')[3].innerText;
                var credit = parseFloat($(tr).find('td')[6].innerText);
                var point = parseFloat($($($(tr).find('td')[7]).find('span'))[0].innerText);
                var status = $($($(tr).find('td')[8]).find('span'))[0].innerText;
                if(!subject.includes('OJ') && !subject.includes('VOV')  ){
                    if(status == 'Passed'){
                        if(point > 0){
                            gradeSummary += credit*point;
                            creditSummary += credit;
                        }
                    }
                }
                if(status == 'Passed'){
                    totalCredit += credit;
                }
            } catch (error) {
                continue;
            }
        }
        alert('Điểm trung bình :'+gradeSummary/creditSummary+'\n Số tín chỉ đã học :'+totalCredit);
    });
   
  });