-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.user.js
58 lines (55 loc) · 2.8 KB
/
content.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
// ==UserScript==
// @name MMU_Portals
// @namespace undefined
// @version 0.1
// @description try to take over MMU!
// @author .Js0n
// @updateURL https://github.com/walaoaaa1234/MMU_Portals/raw/master/content.user.js
// @downloadURL https://github.com/walaoaaa1234/MMU_Portals/raw/master/content.user.js
// @match *://mmls.mmu.edu.my/
// @match *://cms.mmu.edu.my/*
// @match *://online.mmu.edu.my/*
// @require http://code.jquery.com/jquery-latest.js
// @grant none
// ==/UserScript==
var username = '';
var password = '';
$(document).ready(function(){
'use strict';
if (username === '' || password === '') {
alert('Please config the script file');
} else if (window.location.hostname == "cms.mmu.edu.my" && getCookie("PS_TOKEN") === '') {
//alert(getCookie("PS_TOKEN"));
$("#userid").val(username);
$("#pwd").val(password);
submitAction(document.login);
} else if (window.location.hostname == 'cms.mmu.edu.my' && /My%20Weekly%20Schedule/.test(window.location.href)) {
$("#DERIVED_CLASS_S_SSR_DISP_TITLE").click();
submitAction_win0(document.win0,'DERIVED_CLASS_S_SSR_REFRESH_CAL$38$');
} else if (window.location.href == "https://mmls.mmu.edu.my/") {
$("body > div.container > div:nth-child(4) > div > div > div > div.col-sm-4 > div.row.hidden-xs > div > div > div.panel-body > form > fieldset > div > div > div:nth-child(1) > div > input").val(username);
$("body > div.container > div:nth-child(4) > div > div > div > div.col-sm-4 > div.row.hidden-xs > div > div > div.panel-body > form > fieldset > div > div > div:nth-child(2) > div > #alert_msg").val(password);
$("body > div.container > div:nth-child(4) > div > div > div > div.col-sm-4 > div.row.hidden-xs > div > div > div.panel-body > form").submit();
} else if (window.location.href === "https://cms.mmu.edu.my/psc/csprd/EMPLOYEE/HRMS/s/WEBLIB_TIMEOUT.PT_TIMEOUTWARNING.FieldFormula.IScript_TIMEOUTWARNING?") {
window.location.href = 'https://cms.mmu.edu.my/psp/csprd/EMPLOYEE/HRMS/?cmd=resettimeout';
this.close();
} else if (window.location.hostname == "online.mmu.edu.my") {
$("#form_loginUsername").val(username);
$("#login-password").val(password);
$("#login-form > fieldset > input").click();
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) === 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
});