Simple GPA Calculator for SUSTC

Tired of punching calculators? Bookmark this and open your URP System. Navigate to “综合查询 》 本学期成绩“ and click the bookmark. Done!

Add this to your bookmark

function defer(a){window.$?a():setTimeout(function(){defer(a)},50)}function compute_gpa(){a=$("frameset",$("[name='bottomFrame']").contentDocument).children("[name='bottomFrame']"),$.each($("thead > tr",$(".displayTag",$("frameset",a.contents()).children()[2].contentDocument)),function(a,b){0!=a&&(avg+=(parseFloat(b.children[9].innerHTML.replace(/(^\s+)|(\s+$)/g,""))>=60?trans[100-Math.floor(parseFloat(b.children[9].innerHTML.replace(/(^\s+)|(\s+$)/g,"")))]:0)*parseFloat(b.children[4].innerHTML.replace(/(^\s+)|(\s+$)/g,"")),t+=parseFloat(b.children[4].innerHTML.replace(/(^\s+)|(\s+$)/g,"")))}),alert(avg/t)}t=0,avg=0;var trans=[4,4,3.99,3.98,3.97,3.95,3.93,3.91,3.88,3.85,3.81,3.77,3.73,3.68,3.63,3.58,3.52,3.46,3.39,3.32,3.25,3.17,3.09,3.01,2.92,2.83,2.73,2.63,2.53,2.42,2.31,2.2,2.08,1.96,1.83,1.7,1.57,1.43,1.29,1.15,1,0];defer(compute_gpa);

Source


function defer(a) {
  window.$ ? a() : setTimeout(function() {
    defer(a)
  }, 50)
}

function compute_gpa() {
  a = $("frameset", $("[name='bottomFrame']").contentDocument).children("[name='bottomFrame']"), $.each($("thead > tr", $(".displayTag", $("frameset", a.contents()).children()[2].contentDocument)), function(a, b) {
    0 != a & amp; & amp;
    (avg += (parseFloat(b.children[9].innerHTML.replace(/(^\s+)|(\s+$)/g, "")) & gt; = 60 ? trans[100 - Math.floor(parseFloat(b.children[9].innerHTML.replace(/(^\s+)|(\s+$)/g, "")))] : 0) * parseFloat(b.children[4].innerHTML.replace(/(^\s+)|(\s+$)/g, "")), t += parseFloat(b.children[4].innerHTML.replace(/(^\s+)|(\s+$)/g, "")))
  }), alert(avg / t)
}
t = 0, avg = 0;
var trans = [4, 4, 3.99, 3.98, 3.97, 3.95, 3.93, 3.91, 3.88, 3.85, 3.81, 3.77, 3.73, 3.68, 3.63, 3.58, 3.52, 3.46, 3.39, 3.32, 3.25, 3.17, 3.09, 3.01, 2.92, 2.83, 2.73, 2.63, 2.53, 2.42, 2.31, 2.2, 2.08, 1.96, 1.83, 1.7, 1.57, 1.43, 1.29, 1.15, 1, 0];
defer(compute_gpa);