-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.js
31 lines (27 loc) · 858 Bytes
/
content.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
function fillForm() {
var form = document.forms['MainForm'];
var login = form.elements['UN'];
var pass = form.elements['PW'];
chrome.storage.local.get(['login', 'password', 'autologin'], function(storage) {
login.value = storage.login;
pass.value = storage.password;
if(storage.autologin) {
pressButton();
}
})
};
function pressButton() {
setTimeout(function() {
if (document.getElementsByClassName('button-login')[0] && document.getElementById("schools").options.length) {
document.getElementsByClassName('button-login')[0].click();
document.getElementById("schools").val = 1;
} else {
pressButton();
}
}, 100);
}
if (/comp|inter|loaded/.test(document.readyState)){
fillForm();
} else {
document.addEventListener('DOMContentLoaded', fillForm, false);
}