Skip to content

Instantly share code, notes, and snippets.

@karlding
Last active September 26, 2016 17:01
Show Gist options
  • Save karlding/4b3c8e376cd88d5bbd7a to your computer and use it in GitHub Desktop.
Save karlding/4b3c8e376cd88d5bbd7a to your computer and use it in GitHub Desktop.
Prevents uWaterloo's JobMine system from logging you out automatically
// ==UserScript==
// @name JobMine4Days
// @namespace https://github.com/karlding
// @version 1.1
// @description Prevents uWaterloo's JobMine system from logging you out automatically
// @author Karl Ding
// @include https://jobmine.ccol.uwaterloo.ca/psp/SS*
// @include https://jobmine.ccol.uwaterloo.ca/psc/SS*
// @include https://jobmine.ccol.uwaterloo.ca/psp/ES*
// @include https://jobmine.ccol.uwaterloo.ca/psc/ES*
// @grant none
// ==/UserScript==
window.addEventListener('load', function() {
var poll = function() {
var request = new XMLHttpRequest();
var url = '//jobmine.ccol.uwaterloo.ca/psp/SS/EMPLOYEE/WORK/?cmd=resettimeout';
request.open('GET', url, true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
console.log(request.responseText);
} else {
console.warn("Error: HTTP Status Code " + request.status);
}
};
request.onerror = function(e) {
console.warn("Error: Retrying request");
setTimeout(function() {
poll();
}, 60000); // 60000ms = 1min
};
request.send();
};
// warningTimeoutMilliseconds / 2 = 1080000ms / 2 = 9min
setInterval(poll, warningTimeoutMilliseconds / 2);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment