Created
November 7, 2012 14:15
-
-
Save Swader/4031850 to your computer and use it in GitHub Desktop.
Codeskulptor Autosave - Main JS
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
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