[\s\S]*?(\d.\d)(?=[\s\S]*?<\/div><\/td>)/)[0];
xf[n]=RegExp.$2;
fs[n]=a[n].match(/(
[\s\S]*?){7} | (.+)(?=<\/a>[\s\S]*?<\/div><\/td>)|( | [\s\S]*?){7} | [\s]*(.+)(?=[\s]*<\/div><\/td>)/)[0];
fs[n]=RegExp.$2+RegExp.$4;
kch[n]=a[n].match(/ | (.*)(?=<\/div><\/td>)/)[0];
kch[n]=RegExp.$1;
}
lastxq="0";
thisxq="1";
for (n=0;n ";
writestr+=""+" "+"<\/div>";
writestr+=" "+"========== "+thisxq+" =========="+"<\/div>";
writestr+="<\/div>";
}
lastxq=thisxq;
writestr+=" ";
writestr+=" "+kc[n]+"<\/div>";
writestr+=" "+xf[n]+"<\/div>";
writestr+=" "+fs[n]+"<\/div>";
writestr+=" "+" "+"<\/div>";
writestr+="<\/div>";
}
}catch(e){
writestr+=" ";
writestr+=" <\/p> 对不起!脚本运行出错!如果愿意,请按如下方法反馈:右键——查看网页源代码,把里面的东西复制下来,保存在文本文件里(可以删去学号和姓名),发送到GroundMelon@gmail.com。感谢您的支持!<\/p>";
writestr+="<\/div>";
mydiv.innerHTML=writestr;
document.getElementById("savebtn").addEventListener('click',save,false);
document.getElementById("loadbtn").addEventListener('click',load,false);
}
writestr+=" ";
writestr+=" ";
writestr+=" ";
writestr+=" ";
writestr+=" ";
writestr+=" ";
writestr+="<\/div>";
writestr+=" <\/div>";
writestr+=" ";
writestr+=" ";
writestr+=" ";
writestr+="<\/div>";
writestr+=" ";
writestr+=" <\/p>对成绩不满意?点击这里<\/a>修改成绩";
writestr+="<\/div>";
writestr+="<\/div>";
mydiv.innerHTML=writestr;
}
document.body.appendChild(mydiv);
document.getElementById("clearbtn").addEventListener('click',clearcalc,false);
document.getElementById("unfoldbtn").addEventListener('click',unfold,false);
document.getElementById("foldbtn").addEventListener('click',fold,false);
if (location.href!=XIAOWAICHAXUN)
{
document.getElementById("calcbtn").addEventListener('click',calc,false);
document.getElementById("chooseallbtn").addEventListener('click',chooseall,false);
document.getElementById("unchooseallbtn").addEventListener('click',unchooseall,false);
document.getElementById("choosebtn").addEventListener('click',choose,false);
document.getElementById("unfoldbtn").addEventListener('click',unfold,false);
document.getElementById("foldbtn").addEventListener('click',fold,false);
document.getElementById("savebtn").addEventListener('click',save,false);
document.getElementById("loadbtn").addEventListener('click',load,false);
unchooseall();
choose();
fold();
}
function unfold()
{
//elem=document.getElementById("gpadiv");
//elem.style.height="auto";
elem=document.getElementById("content");
elem.style.display="block";
}
function fold()
{
//elem=document.getElementById("gpadiv");
//elem.style.height="60px";
elem=document.getElementById("content");
elem.style.display="none";
}
function calc()
{
var ixf,xfj,bz,gj,bd;
var s;
rstdiv = document.createElement("div");
rstdiv.id = "rstdiv";
rstdiv.style.zIndex = "100";
rstdiv.style.position = "absolute";
rstdiv.style.margin = "-150px 0px 0px -200px";
rstdiv.style.left = "50%";
rstdiv.style.top =(document.documentElement.scrollTop || document.body.scrollTop)+parseInt(window.screen.availHeight/2)+"px";
rstdiv.style.width = "400px";
rstdiv.style.height = "300px";
rstdiv.style.border = "5px solid";
rstdiv.style.overflow = "auto";
rstdiv.style.backgroundColor = "#F7F4EC";
rstdiv.style.color="#000000";
rstdiv.style.fontSize="16px";
rstdiv.style.lineHeight="1.2";
document.body.appendChild(rstdiv);
ixf=0;xfj=0;bz=bd=gj=0;
for (n=0;n=85) {gj=gj+parseFloat(xf[n])*parseFloat(4);}
else{
if (fs[n]>=70) {gj=gj+parseFloat(xf[n])*parseFloat(3);}
else{
if (fs[n]>=60) {gj=gj+parseFloat(xf[n])*parseFloat(2);}
}
}
//北大
if (fs[n]>=90) {bd=bd+parseFloat(xf[n])*parseFloat(4);}
else{
if (fs[n]>=85) {bd=bd+parseFloat(xf[n])*parseFloat(3.7);}
else{
if (fs[n]>=82) {bd=bd+parseFloat(xf[n])*parseFloat(3.3);}
else{
if (fs[n]>=78) {bd=bd+parseFloat(xf[n])*parseFloat(3.0);}
else{
if (fs[n]>=75) {bd=bd+parseFloat(xf[n])*parseFloat(2.7);}
else{
if (fs[n]>=72) {bd=bd+parseFloat(xf[n])*parseFloat(2.3);}
else{
if (fs[n]>=68) {bd=bd+parseFloat(xf[n])*parseFloat(2.0);}
else{
if (fs[n]>=64) {bd=bd+parseFloat(xf[n])*parseFloat(1.5);}
else{
if (fs[n]>=60) {bd=bd+parseFloat(xf[n])*parseFloat(1.0);}
}
}
}
}
}
}
}
}
}
}
rstdiv.innerHTML+=""
rstdiv.innerHTML+=" 所选科目的学分绩是:"+toDecimal(xfj/ixf)+" ";
rstdiv.innerHTML+=""+" ";
rstdiv.innerHTML+=" 所选科目的GPA是:";
rstdiv.innerHTML+=" 标准算法 :"+toDecimal(xfj/ixf/25)+" ";
rstdiv.innerHTML+=" 标准4.0算法 :"+toDecimal(bz/ixf)+" ";
rstdiv.innerHTML+="改进4.0算法 :"+toDecimal(gj/ixf)+" ";
rstdiv.innerHTML+=" 北大4.0算法 :"+toDecimal(bd/ixf)+" ";
rstdiv.innerHTML+=" "+" ";
rstdiv.innerHTML+=" "+" ";
rstdiv.innerHTML+=" "+"算法说明请点击这里<\/a>"+" "+" ";
rstdiv.innerHTML+=" ";
document.getElementById("clrrstbtn").addEventListener('click',clearrst,false);
}
function clearcalc()
{
try{
elem=document.getElementById("rstdiv");
document.body.removeChild(elem);
}catch(e){}
elem=document.getElementById("gpadiv");
document.body.removeChild(elem);
}
function clearrst()
{
elem=document.getElementById("rstdiv");
document.body.removeChild(elem);
}
function chooseall()
{
for (n=0;n =2.5)
{
document.getElementById(s).checked=true;
}else{
document.getElementById(s).checked=false;
}
}
}
function unchooseall()
{
for (n=0;n0)
{
c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1)
{
c_start=c_start + c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
}
}
return ""
}
function toDecimal(x) {
var f = parseFloat(x);
if (isNaN(f)) {
return;
}
f = Math.round(x*100)/100;
return f;
}
var winWidth = 0;
var winHeight = 0;
var x;
function findDimensions() //函数:获取尺寸
{
//获取窗口宽度
if (window.innerWidth)
winWidth = window.innerWidth;
else if ((document.body) && (document.body.clientWidth))
winWidth = document.body.clientWidth;
//获取窗口高度
if (window.innerHeight)
winHeight = window.innerHeight;
else if ((document.body) && (document.body.clientHeight))
winHeight = document.body.clientHeight;
//通过深入Document内部对body进行检测,获取窗口大小
if (document.documentElement && document.documentElement.clientHeight &&
document.documentElement.clientWidth)
{
winHeight = document.documentElement.clientHeight;
winWidth = document.documentElement.clientWidth;
}
if (location.href==XIAOWAICHAXUN){
x=""+((winWidth-670)/2+670)+"px";
document.getElementById("gpadiv").style.left=x;
document.getElementById("gpadiv").style.width="400px";
document.body.scrollLeft=document.body.scrollWidth;
}else{
x=""+((winWidth-340)/2+340)+"px";
document.getElementById("gpadiv").style.left=x;
}
}
findDimensions(); //调用函数,获取数值
window.onresize=findDimensions; |