// ==UserScript== // @name SDU本科生院教务系统助手 // @namespace http://tampermonkey.net/ // @version 0.2 // @description try to take over the world! // @author You // @match http://bkjws.sdu.edu.cn/f/common/main // @icon https://www.google.com/s2/favicons?domain=. // @grant GM_getValue // @grant GM_setValue // ==/UserScript== (function() { 'use strict'; // Your code here... if(GM_getValue("zdpj") != false){ GM_setValue("zdpj", true) } var wfzjd = {"2017-1": 0, "2017-2": 0, "2018-1": 0, "2018-2": 0, "2019-1": 0, "2019-2": 0, "2020-1": 0,"2020-2": 0, "2021-1": 0,"2021-2": 0, "2022-1": 0,"2022-2": 0,} var xf = {"2017-1": 0, "2017-2": 0, "2018-1": 0, "2018-2": 0, "2019-1": 0, "2019-2": 0, "2020-1": 0,"2020-2": 0, "2021-1": 0,"2021-2": 0, "2022-1": 0,"2022-2": 0,} var AutoView = true var total_xf = 0 var total_wfzjd = 0 if(GM_getValue("pjjy") == null){ console.log("没有找到自定义评价建议,将使用默认评价建议") } var appendScriptUnitVar = setInterval(function(){appendScriptUnit()}, 10) setInterval(function(){ if(GM_getValue("zdpj") == true){ viewAll() rapidSubmit() } }, 10) function appendScriptUnit(){ if(document.querySelector('body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li:nth-child(5)') != null){ var cloneUnit = document.querySelector('body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li:nth-child(5)') var Unit = cloneUnit.cloneNode(true) var ul = document.querySelector("body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul") ul.appendChild(Unit) document.querySelector('body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li:nth-child(10) > a > span.title').innerHTML = "脚本设置" var AutoViewSetting = document.querySelector('body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li:nth-child(10) > ul > li:nth-child(1) > a') if(GM_getValue("zdpj") == false){ AutoViewSetting.innerHTML = "自动评教设置:关" } else{ AutoViewSetting.innerHTML = "自动评教设置:开" } AutoViewSetting.removeAttribute("href") AutoViewSetting.removeAttribute("class") AutoViewSetting.addEventListener("click", AutoViewSettingPage) var enquireGPA = document.querySelector('body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li:nth-child(10) > ul > li:nth-child(2) > a') enquireGPA.innerHTML = "绩点查询" enquireGPA.removeAttribute("href") enquireGPA.removeAttribute("class") enquireGPA.addEventListener("click", function(){enquireGPAPage1(); enquireGPAPage2()}) document.querySelector('body > div.page-container > div.page-content > div').innerHTML = '

欢迎使用SDU本科生院教务系统助手

脚本使用说明

1.进入评教界面后自动填充

2.点击[脚本设置]-[自动评教设置]可以开启或关闭自动评教

' var cloneLi = document.querySelector('body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li:nth-child(10) > ul > li:nth-child(2)') var Li_input_pjjy = cloneLi.cloneNode(true) var ul2 = document.querySelector('body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li:nth-child(10) > ul') ul2.appendChild(Li_input_pjjy) document.querySelector('body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li:nth-child(10) > ul > li:nth-child(3) > a').innerText = "自定义评教建议" Li_input_pjjy.addEventListener("click", function(){input_pjjy()}) clearInterval(appendScriptUnitVar) } } function AutoViewSettingPage(){ var AA = document.querySelector('body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li.open > ul > li:nth-child(1) > a') if(GM_getValue("zdpj") == false){ AA.innerText = "自动评教设置:开" GM_setValue("zdpj", true) } else{ AA.innerText = "自动评教设置:关" GM_setValue("zdpj", false) } } function enquireGPAPage1(){ console.log(xf) var http = new XMLHttpRequest() var url = 'http://bkjws.sdu.edu.cn/b/cj/cjcx/xs/lscx' var params = 'aoData=[{"name":"sEcho","value":2},{"name":"iColumns","value":10},{"name":"sColumns","value":""},{"name":"iDisplayStart","value":0},{"name":"iDisplayLength","value":-1},{"name":"mDataProp_0","value":"xnxq"},{"name":"mDataProp_1","value":"kch"},{"name":"mDataProp_2","value":"kcm"},{"name":"mDataProp_3","value":"kxh"},{"name":"mDataProp_4","value":"xf"},{"name":"mDataProp_5","value":"kssj"},{"name":"mDataProp_6","value":"kscjView"},{"name":"mDataProp_7","value":"wfzjd"},{"name":"mDataProp_8","value":"wfzdj"},{"name":"mDataProp_9","value":"kcsx"},{"name":"iSortCol_0","value":5},{"name":"sSortDir_0","value":"desc"},{"name":"iSortingCols","value":1},{"name":"bSortable_0","value":false},{"name":"bSortable_1","value":false},{"name":"bSortable_2","value":false},{"name":"bSortable_3","value":false},{"name":"bSortable_4","value":false},{"name":"bSortable_5","value":true},{"name":"bSortable_6","value":false},{"name":"bSortable_7","value":false},{"name":"bSortable_8","value":false},{"name":"bSortable_9","value":false}]' http.open('POST', url, true) http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8') http.onreadystatechange = function() { if(http.readyState == 4 && http.status == 200) { var resp1 = http.responseText var obj = JSON.parse(resp1) //console.log(obj.object.aaData['0'].wfzjd) for(var i = 0; i "20210300" && obj.object.aaData[i].kssj < "20210900"){ xf["2020-2"] += obj.object.aaData[i].xf wfzjd["2020-2"] += obj.object.aaData[i].wfzjd * obj.object.aaData[i].xf }else if(obj.object.aaData[i].kssj > "20210900" && obj.object.aaData[i].kssj < "20220300"){ xf["2021-1"] += obj.object.aaData[i].xf wfzjd["2021-1"] += obj.object.aaData[i].wfzjd * obj.object.aaData[i].xf }else if(obj.object.aaData[i].kssj > "20220300" && obj.object.aaData[i].kssj < "20220900"){ xf["2021-2"] += obj.object.aaData[i].xf wfzjd["2021-2"] += obj.object.aaData[i].wfzjd * obj.object.aaData[i].xf } } } for(var j = 0; j<5; j++){ if(xf[2017 + j +"-1"] !=0){ console.log(2017 + j + "-" + (2017 + j + 1) + "-1学期绩点:" + (wfzjd[2017 + j +"-1"] / xf[2017 + j +"-1"]).toFixed(2)) console.log(2017 + j + "-" + (2017 + j + 1) + "-2学期绩点:" + (wfzjd[2017 + j +"-2"] / xf[2017 + j +"-2"]).toFixed(2)) } } console.log("总绩点:" + (total_wfzjd / total_xf).toFixed(2)) } } http.send(params) } function viewAll(){ if(document.querySelector("#zbda_1") != null){ var i = 0 while(i < 21){ document.querySelector("#zbda_" + i).click() i++ } document.querySelector("input[value=\"课程难度适中\"]").click() if(GM_getValue("pjjy") == null){ document.querySelector("#zbda_21").value = "讲课生动,受益良多" } else{ document.querySelector("#zbda_21").value = GM_getValue("pjjy") } } } function rapidSubmit(){ var Button1 = document.querySelector("body > div.aui_state_lock.aui_state_focus > div > table > tbody > tr:nth-child(2) > td.aui_c > div > table > tbody > tr:nth-child(3) > td > div > button.aui_state_highlight") var Button2 = document.querySelector("body > div.aui_state_focus.aui_state_lock > div > table > tbody > tr:nth-child(2) > td.aui_c > div > table > tbody > tr:nth-child(3) > td > div > button") var Button3 = document.querySelector("body > div.page-container > div.page-sidebar.nav-collapse.collapse > ul > li.open.active > ul > li.active > a") if(Button1 != null){ Button1.click() Button2.click() Button3.click() } } function input_pjjy(){ GM_setValue("pjjy", prompt("请输入您想要设定的评教建议:","")) } })();