Skip to content

Instantly share code, notes, and snippets.

@Uberi
Last active January 4, 2016 03:29
Show Gist options
  • Select an option

  • Save Uberi/8562032 to your computer and use it in GitHub Desktop.

Select an option

Save Uberi/8562032 to your computer and use it in GitHub Desktop.
This is a UserScript that fixes the most irritating thing about uWaterloo LEARN - the pointless, annoying alerts that your session is about to be logged out for the 50th time.
// ==UserScript==
// @name uWaterloo Learn Login
// @namespace uberi
// @description Keep the user logged into LEARN while the tab is open
// @include https://learn.uwaterloo.ca/*
// @match https://learn.uwaterloo.ca/*
// @version 1.0
// @run-at document-start
// ==/UserScript==
/*
HOW TO INSTALL (GOOGLE CHROME):
1. Download the script below to a file named `BLABLABLA.user.js`. Or press the "Download Gist" button on the left and extract it or whatever.
2. Open the extensions page (Chrome Menu > Tools > Extensions).
3. Drag and drop the script file onto the extensions page.
4. Enjoy life a little bit more.
HOW TO INSTALL (FIREFOX):
Figure it out yourself, I'm already behind on my assignments.
*/
var inject_code = [
"var old_alert = window.alert;",
"window.alert = function(message) {",
" if (typeof message !== \"string\" || !/Your session has been inactive for some time/.test(message))",
" old_alert(message);",
"}"
].join("\n");
// inject the stuff into the thing
var script_tag = document.createElement("script");
script_tag.type = "text/javascript";
script_tag.textContent = inject_code;
(document.head || document.documentElement).appendChild(script_tag);
script_tag.parentNode.removeChild(script_tag);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment