Last active
August 29, 2015 14:03
-
-
Save jwoglom/d3766451eac95a237fad to your computer and use it in GitHub Desktop.
Pearson Successnet Keepalive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Pearson Successnet Keepalive | |
// @namespace http://www.wogloms.com/ | |
// @version 1 | |
// @description Keeps the Pearson Successnet login connection activated by sending a ping every 60 seconds, instead of opening a popup dialog to extend the session every 10 minutes and expiring every 15. | |
// @match https://www.pearsonsuccessnet.com/snpapp/iText/BrowseITEXTServlet* | |
// @copyright WTFPL | |
// ==/UserScript== | |
console.log("Loaded scn "+new Date()); | |
setInterval(function() { | |
// Ripped from source code | |
console.log("Sending ping at "+new Date()); | |
var xmlHttp; | |
var output; | |
if (window.XMLHttpRequest) | |
{ // Mozilla, Safari, ... | |
var xmlHttp = new XMLHttpRequest(); | |
}else if (window.ActiveXObject) | |
{ // IE | |
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); | |
} | |
xmlHttp.open('POST', "/snpapp/login/ping.jsp", true); | |
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |
xmlHttp.onreadystatechange = function() | |
{ | |
if (xmlHttp.readyState == 4) | |
{ | |
output=xmlHttp.responseText; | |
if(output=="sessionrenewed") | |
{ | |
console.log("muy bien"); | |
} else console.log("muy malo"); | |
} | |
} | |
xmlHttp.send("/snpapp/login/ping.jsp"); | |
}, 60000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment