vtsatskin/Refuse2Logout — pull request #2 by crazy2be (2014-03-26 14:35:25+00:00)
Title: Fix race condition in Chrome, contain all alert boxes.

You might only want to merge part of this, depending on what you want your version to do. There are two significant changes:

1) Add an injected script that makes alert dialog boxes contained to the d2l page. So, if you get logged out, it will display a banner at the top of the affected page, and not interrupt whatever else you are doing (see screenshot).

2) Fix race condition in chrome. Sometimes the script doesn't get injected until after the document has already loaded, so the 'load' event never fires. Thus, sometimes, the script just doesn't work. This change fixes that by checking if the document is already loaded, and running the code immediately in that case.