8種機械鍵盤軸體對比
本人程式員,要買一個寫代碼的鍵盤,請問紅軸和茶軸怎麼選?
搶課腳本
本文檔腳本内容适用于USTC研究所學生選課系統
如下文所說,你需要指定自己想選的課程号,并可以修改你想要的每次查詢時間間隔
方法1 浏覽器console
此方法需要每次打開選課首頁手動粘貼運作腳本
Chrome下,F12快捷鍵打開開發者工具
點選上方Console進入控制台(如上圖紅圈)
确認目前在top域(如上圖紅圈),在console中粘貼如下代碼,并按回車:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45var ids = ["CH6520501", "CH6620401", "CH2522301"];
var times = 5000;
var got = [];
for (var i = 0; i < ids.length; i++) {
got.push(false);
}
var inter = setInterval(function(){
var log_string = "";
var table = frames["mainFrame"].frames["I2"].frames["xkpFrame"].document.children[0].children[1].children[0].children[0].children[2].children[0];
for (var i = 0; i < ids.length; i++) {
var line = get_line_with_id(table, ids[i]);
var people = line.children[8];
if (got[i] === false) {
if (people.childNodes[0].data != (people.childNodes[3].innerText + "/")) {
frames["mainFrame"].frames["I2"].frames["xkpFrame"].xk(ids[i]);
got[i] = true;
alert("class" + toString(i) + " get!");
} else {
log_string = log_string + line.children[3].children[0].innerText + " : " + people.childNodes[0].data + people.childNodes[3].innerText + "n";
}
}
}
for (var i = 0; i < got.length; i++) {
if (got[i] === false) {
console.log(log_string);
frames["mainFrame"].frames["I2"].frames["xkpFrame"].cxdxkc();
return;
}
}
clearInterval(inter);
alert("all get!");
return;
}, times);
function (table, id){
for (i = 1; i < table.rows.length; i++) {
if (table.rows[i].children[2].innerText == id) {
return table.rows[i];
}
}
return null;
}
每查詢一次,腳本将在console中輸出當次查詢的人數結果:
若你不想有這樣的輸出,将上圖中Default levels中的Info取消勾選
當你想結束查詢時,請重新整理選課接口
方法2 使用插件Tampermonkey
此方法可以自動在選課頁面打開時進行刷課,無需人工幹預
在Chrome擴充商店中搜尋Tampermonkey并安裝,安裝完成後在Chrome位址欄右側将出現該擴充的圖示:
點選該圖示,并選擇添加新腳本,進入下圖接口
你可以:将上文中的代碼粘貼到圖中// Your code here...的位置,并用選課網頁位址替換掉圖中match之後的http開頭的内容
(推薦)将編輯區中所有内容清除,替換為下文内容:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59// @name yanjiusheng
// @namespace http://tampermonkey.net/
// @version 1.1
// @description multiple classes supported
// @author Jeffery
// @match http://mis.teach.ustc.edu.cn/gradLoginSuc.do
// @grant none
// ==/UserScript==
(function(){
;
//在這裡添加你想要的課程号們,不限制個數
var ids = ["CH6520501", "CH6620401", "CH2522301"];
//在這裡修改每多久查詢一次,機關毫秒。不要過于頻繁以免被伺服器封禁。原為5000。
var times = 5000;
var got = [];
for (var i = 0; i < ids.length; i++) {
got.push(false);
}
var inter = setInterval(function(){
var log_string = "";
var table = frames["mainFrame"].frames["I2"].frames["xkpFrame"].document.children[0].children[1].children[0].children[0].children[2].children[0];
for (var i = 0; i < ids.length; i++) {
var line = get_line_with_id(table, ids[i]);
var people = line.children[8];
if (got[i] === false) {
if (people.childNodes[0].data != (people.childNodes[3].innerText + "/")) {
frames["mainFrame"].frames["I2"].frames["xkpFrame"].xk(ids[i]);
got[i] = true;
alert("class" + toString(i) + " get!");
} else {
log_string = log_string + line.children[3].children[0].innerText + " : " + people.childNodes[0].data + people.childNodes[3].innerText + "n";
//console.log(line.children[3].children[0].innerText + " : " + people.childNodes[0].data + people.childNodes[3].innerText);
}
}
}
for (var i = 0; i < got.length; i++) {
if (got[i] === false) {
console.log(log_string);
frames["mainFrame"].frames["I2"].frames["xkpFrame"].cxdxkc();
return;
}
}
clearInterval(inter);
alert("all get!");
return;
}, times);
function get_line_with_id(table, id){
for (i = 1; i < table.rows.length; i++) {
if (table.rows[i].children[2].innerText == id) {
return table.rows[i];
}
}
return null;
}
// Your code here...
})();
點選儲存按鈕
啟用腳本方法:打開選課标簽頁
點選Tampermonkey擴充按鈕,将出現目前腳本的開關
打開該開關,并重新整理選課頁面(重新整理後才開啟生效),若觀察到隔指定時間(5000ms)頁面自動查詢,或在Chrome console看到課程人數的輸出并且字首數字增加,則為開啟成功:
Tip: 你可以選擇開課機關,以減少每次查找的流量、時間開銷
關閉腳本方法:同啟用腳本的方法,僅将打開開關改為關閉開關。别忘了重新整理頁面!
Note:如果你有舊的搶課腳本,請在開啟腳本的小彈窗關閉它并保持關閉,或在Tampermonkey管理面闆永久删除它: