Skip to content

Instantly share code, notes, and snippets.

@pagreczner
Last active April 3, 2022 20:54
Show Gist options
  • Save pagreczner/9d346547a9499c313035 to your computer and use it in GitHub Desktop.
Save pagreczner/9d346547a9499c313035 to your computer and use it in GitHub Desktop.
Gist Autosave bookmark (Chrome only?)
javascript:(function(){
setInterval(function(){
console.log("Auto Saving...");
var data = $("#gist-form").serialize();
var actionUrl = $("#gist-form").attr('action');
try {
$.post(actionUrl, data); }
catch(err) {}
$("<p class='cjs-autosave'>Autosaved gist!</p>").insertAfter("div.main #gists");
$("p.cjs-autosave").fadeOut(4000);
}, 10000);
}())
@pagreczner
Copy link
Author

While on a Gist /edit page on github.com, you can click on a bookmark containing this code to have it auto save the gist every 10 seconds. Modify to your needs.

Useful for google doc autosave-esque functionality.

@ThomasMorrison
Copy link

This actually works great as a greasemonkey script as well!

@benchonaut
Copy link

Firefox declined to do it via debug console , gets NULL at line 4 or 5 ,

so i did it from shell
https://gist.github.com/benchonaut/605235721ba775ddd3df371fb287afe3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment