-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
60 lines (60 loc) · 2.13 KB
/
script.js
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
60
// ==UserScript==
// @name URP教务处验证码自动填写
// @namespace JerryWang
// @version 0.25
// @description 教务处验证码自动识别填写(理论支持所有新版URP教务系统)
// @author JerryWang
// @match http://jwxs.hebut.edu.cn/login
// @match http://zhjw.scu.edu.cn/login
// @grant none
// @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// ==/UserScript==
$("a").click(function(){
setTimeout(function () {
var img = $("#captchaImg")[0];
var canvas = document.createElement("canvas");
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight);
var dataURL = canvas.toDataURL("image/png");
$.ajax({
url: "http://81.70.144.40:5005/predict",
dataType: "json",
type: "get",
async:false,
data: {
data: dataURL
},
success: function (res) {
console.log(res.captcha)
$("#input_checkcode")[0].value = res.captcha
}
});
}, 200);
});
(function () {
$("#formFooter")[0].innerHTML += "<br><span id=\"clicked\" style=\"color: #7b0003;\">如验证码识别错误 可点击图片重新识别</span>";
setTimeout(function () {
var img = $("#captchaImg")[0];
var canvas = document.createElement("canvas");
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight);
var dataURL = canvas.toDataURL("image/png");
$.ajax({
url: "http://81.70.144.40:5005/predict",
dataType: "json",
type: "get",
async:false,
data: {
data: dataURL
},
success: function (res) {
console.log(res.captcha)
$("#input_checkcode")[0].value = res.captcha
}
});
}, 200);
})();