forked from DRAGONMANU/chrome_IIT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
79 lines (67 loc) · 2.33 KB
/
popup.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
window.onload = function() {
var userid = "";
chrome.storage.sync.get('username',function (data) {
userid=data.username;
});
var password = "";
chrome.storage.sync.get('password',function (data) {
password=data.password;
});
var auto1 = false;
chrome.storage.sync.get('auto',function (data) {
auto1=data.auto;
});
/* var proxy = false;
chrome.storage.sync.get('proxy',function (data) {
proxy=data.proxy;
}); */
var moodle = false;
chrome.storage.sync.get('moodle',function (data) {
moodle=data.moodle;
});
var webmail = false;
chrome.storage.sync.get('webmail',function (data) {
webmail=data.webmail;
});
var delayMillis = 10;
setTimeout(function() {
if(typeof userid!="undefined")
{
document.getElementById('username').value = userid;
document.getElementById('password').value = password;
}
document.getElementById('autologin').checked = auto1;
// document.getElementById('proxy').checked = proxy;
document.getElementById('moodle').checked = moodle;
document.getElementById('webmail').checked = webmail;
}, delayMillis);
/* document.getElementById('proxy').onclick = function() {
var proxy = document.getElementById('proxy').checked;
chrome.storage.sync.set({'proxy': proxy},function() {});
//console.log(proxy);
chrome.runtime.sendMessage('proxy');
} */
document.getElementById('autologin').onclick = function() {
var autologin = document.getElementById('autologin').checked;
chrome.storage.sync.set({'auto': autologin},function() {});
console.log("moodle");
}
document.getElementById('moodle').onclick = function() {
var moodle = document.getElementById('moodle').checked;
chrome.storage.sync.set({'moodle': moodle},function() {});
console.log("moodle");
chrome.runtime.sendMessage('moodle');
}
document.getElementById('webmail').onclick = function() {
var webmail = document.getElementById('webmail').checked;
chrome.storage.sync.set({'webmail': webmail},function() {});
console.log("webmail");
chrome.runtime.sendMessage('webmail');
}
document.getElementById('save').onclick = function() {
var username = document.getElementById('username').value;
var pass = document.getElementById('password').value;
chrome.storage.sync.set({'username': username},function() {});
chrome.storage.sync.set({'password': pass},function() {});
};
}