目錄
前言
一、為什么要寫這么個腳本?
二、使用步驟
1.創建腳本
2.源代碼
3.運用
總結
前言
本文章主要目的是對油猴寫腳本的簡單運用,還是希望大家認真評教,任何后果本人不負責,本人測驗后應該是沒什么問題的,但是不排除bug的,畢竟為了方便寫的很簡單,歡迎交流討論,
一、為什么要寫這么個腳本?
因為評教時每個老師都有9個選項,老師們都比較優秀,所以都要點優秀選項是個重復麻煩的事情(主要是自己懶),所以想到借助油猴來完成評教,
二、使用步驟
1.創建腳本
本文默認在Chrome中安裝好了油猴拓展,網上有很多教程,,這里不再贅述,
點擊拓展按鈕中的Tampermonkey(左),點擊“添加新腳本...”(右)

2.源代碼

我們可以看到油猴腳本的撰寫界面(上),把原來的文本洗掉,將下面的源代碼復制粘貼到腳本中,按ctrl+s保存
// ==UserScript==
// @name 北理評教系統
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://pj.bit.edu.cn/*/*
// @icon https://www.google.com/s2/favicons?domain=bit.edu.cn
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
alert("評教系統我來啦——Ws3")
document.getElementById("pjnr_1_1").setAttribute("checked", "checked");
document.getElementById("pjnr_2_1").setAttribute("checked", "checked");
document.getElementById("pjnr_3_1").setAttribute("checked", "checked");
document.getElementById("pjnr_4_1").setAttribute("checked", "checked");
document.getElementById("pjnr_5_1").setAttribute("checked", "checked");
document.getElementById("pjnr_6_1").setAttribute("checked", "checked");
document.getElementById("pjnr_7_1").setAttribute("checked", "checked");
document.getElementById("pjnr_8_1").setAttribute("checked", "checked");
document.getElementById("pjnr_9_1").setAttribute("checked", "checked");
})();
這時候我們回到油猴的“管理面板”就可以看見我們的評教系統的腳本了,把他啟用
3.運用

這個時候我們的腳本已經添加完畢了,我們打開評教查看結果,可以看到,打開主界面已經有訊息提示了

我們現在有已評的和未評的,我們點擊“評教”按鈕(左),發現頁面已經點擊成了“優秀”

我們再點擊評教,(半)自動評教功能已經實作了
總結
以上就是今天要講的內容,本文僅僅簡單介紹了油猴的使用,大家還是認真評教,這個腳本技術性不高,有問題歡迎大家和我交流 QQ:747311667
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/401667.html
標籤:其他
