Skip to content

Instantly share code, notes, and snippets.

@Swader
Created November 7, 2012 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Swader/4031850 to your computer and use it in GitHub Desktop.
Save Swader/4031850 to your computer and use it in GitHub Desktop.
Codeskulptor Autosave - Main JS
chrome.extension.sendRequest({}, function(response) {
var readyStateCheckInterval = setInterval(function() {
if (document.readyState === "complete") {
clearInterval(readyStateCheckInterval);
var saveButton = document.getElementById("save");
var autosaveInterval = setInterval(function() {
if (document.URL.indexOf("/#user") != -1 && saveButton !== null) {
var evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true );
saveButton.dispatchEvent(evt);
}
}, response.freq * 1000 * 60);
}
}, 10);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment