Skip to content

Instantly share code, notes, and snippets.

@billmei
Created January 14, 2021 16:17
Show Gist options
  • Save billmei/44a5c48b46ea3ace70bd36852197e55e to your computer and use it in GitHub Desktop.
Save billmei/44a5c48b46ea3ace70bd36852197e55e to your computer and use it in GitHub Desktop.
Tampermonkey script to prevent Queen's MyCareer, Moodle, and D2L sessions from timing out.
// ==UserScript==
// @name KeepAlive
// @namespace https://billmei.net
// @version 0.1
// @description Prevents Queen's MyCareer, Moodle, and D2L from timing out
// @include https://careers.sso.queensu.ca/*
// @include https://moodle.queensu.ca/*
// @include https://qsblearning.ca/*
// @copyright 2014, Bill Mei
// ==/UserScript==
// MyCareer
if (document.location.hostname === "careers.sso.queensu.ca") {
countdownNum = null;
countdownInterval = null;
beginCountdown = null;
countdown = null;
sessionTimeoutTimeout = null;
sessionTimeoutPopup = function() {
keepMeLoggedIn.open('get', '/keepAlive.html?rand=' + Math.floor(Math.random()*100000));
keepMeLoggedIn.send(null);
};
}
// Moodle
if (document.location.hostname === "moodle.queensu.ca") {
var keepalive_timeout = setTimeout(function(){
M.ajax_warn_logout.showBar = function() {
var url = M.cfg.wwwroot + '/local/ajax_logout_warn/ajax_renew.php',
cfg = {
method: 'GET',
on: {
complete: function(id, o, p) {
M.ajax_warn_logout.resetTimer();
}
}
};
Y.io(url, cfg);
};
M.ajax_warn_logout.showBar();
clearTimeout(keepalive_timeout);
}, (3*1000));
}
// D2L
if (document.location.hostname === "qsblearning.ca") {
D2L.PT.Auth.SessionTimeout.Expire = null;
D2L.PT.Auth.SessionTimeout.IsExpired = function(){return false;};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment