-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcmaster-login.user.js
130 lines (117 loc) · 5.39 KB
/
mcmaster-login.user.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// ==UserScript==
// @name McMaster Login
// @namespace https://github.com/boranseckin/mcmaster-login/
// @version 0.1
// @description Login to McMaster websites with your Mac ID.
// @author Boran Seckin
// @match https://avenue.mcmaster.ca/
// @match https://avenue.cllmcmaster.ca/d2l/#?sessionExpired=*&target=*
// @match https://cap.mcmaster.ca/mcauth/#.jsp?app_id=*&app_name=*
// @match https://sso.mcmaster.ca/*
// @match https://epprd.mcmaster.ca/*
// @match https://www.childsmath.ca/*
// @match https://loncapa.mcmaster.ca/*
// @match https://app.crowdmark.com/sign-in
// @match https://#.echo360.ca/*
// @match https://www.oscarplusmcmaster.ca/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const username = 'macid';
const email = 'macid@mcmaster.ca';
const password = 'supersecretpassword';
window.addEventListener('load', function() {
const url = window.location.href;
// MACID Login
if (url.indexOf('cap.mcmaster') > -1) {
console.log('MACID');
document.querySelector('#user_id').value = username;
document.querySelector('#pin').value = password;
document.querySelector('#submit').click();
}
else if (url.indexOf('sso.mcmaster') > -1) {
console.log('MACID - 2');
document.querySelector('#username').value = username;
document.querySelector('#password').value = password;
document.querySelector('#submit').click();
}
// Avenue
else if (url.indexOf('avenue.mcmaster') > -1) {
console.log('Avenue Login');
document.querySelector('#login_button').click();
}
else if (url.indexOf('avenue.cllmcmaster.ca/d2l/#?sessionExpired') > -1) {
console.log('Avenue Redirect');
window.location.href = 'https://cap.mcmaster.ca/mcauth/#.jsp?app_id=1505&app_name=Avenue';
}
// Mosaic
else if (url.indexOf('mcmaster.ca/psp/prepprd/?cmd=login') > -1) {
console.log('Mosaic');
document.querySelector('#userid').value = username;
document.querySelector('#pwd').value = password;
document.querySelector('#login > div > div.ps_signinentry > div:nth-child(6) > span > input').click();
}
// Childsmath
else if (url.indexOf('childsmath.ca/childsa/forms/main_intro.php') > -1) {
return;
}
else if (url.indexOf('childsmath.ca/childsa/forms/main_login') > -1) {
console.log('Childsmath Login');
document.querySelector('#submit').click();
}
else if (url.indexOf('childsmath.ca') > -1) {
console.log('Childsmath Press');
document.querySelector('body > div:nth-child(3) > font > a').click();
}
// Echo360
else if (url.indexOf('login.echo360.ca') > -1) {
console.log('Echo360');
document.querySelector('#email').value = email;
document.querySelector('#submitBtn').click();
}
// Echo360
else if (url.indexOf('login.echo360.ca') > -1) {
console.log('Echo360');
document.querySelector('#email').value = email;
document.querySelector('#submitBtn').click();
}
// LONCAPA
else if (url.indexOf('loncapa.mcmaster.ca/adm/roles') > -1) {
try {
console.log('LONCAPA Login');
document.querySelector('#uname').value = username;
document.querySelector('body > div > div:nth-child(3) > div:nth-child(1) > form > input[type=password]:nth-child(9)').value = password;
document.querySelector('body > div > div:nth-child(3) > div:nth-child(1) > form > input[type=submit]:nth-child(15)').click();
} catch (error) {}
try {
console.log('LONCAPA Select');
document.querySelector('body > form:nth-child(12) > table > tbody > tr:nth-child(2) > td.LC_roles_is > input[type=button]').click();
} catch (error) {}
try {
console.log('LONCAPA Select');
document.querySelector('body > form:nth-child(12) > table > tbody > tr:nth-child(4) > td.LC_roles_selected > input[type=button]').click();
} catch (error) {}
}
else if (url.indexOf('loncapa.mcmaster.ca/public/macphys/') > -1) {
console.log('LONCAPA Content');
document.querySelector('#LC_secondary_menu > li:nth-child(2) > a').click();
}
// Crowdmark
else if (url.indexOf('app.crowdmark.com/sign-in') > -1) {
console.log('Crowdmark');
document.querySelector('#user_email').value = email;
document.querySelector('#user_password').value = password;
document.querySelector('#new_user > div > input').click();
}
// OSCARplus
else if (url.indexOf('oscarplusmcmaster.ca/home') > -1) {
console.log('OSCARplus Home');
document.querySelector('#a11y-menu > ul > li:nth-child(2) > a').click();
}
else if (url.indexOf('oscarplusmcmaster.ca/studentLogin') > -1) {
console.log('OSCARplus Student');
document.querySelector('#main > div > div > table > tbody > tr > td > div > a').click();
}
});
})();