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

Version vom 28.10.2019. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);
    });
   
  });