Imagine you're filling a complex form on site, or typing effervescent and extensive comment. And when you're almost done with that browser is crashed, or you closed tab mistakenly, or electricity is turned off, or something else break your efforts. Disgusting, huh?
With Sisyphus on site you just reopen page in your modern (with HTML5 support) browser and see all your changes at that forms. It's lightweight (3.5 KB) jQuery plugin uses Local Storage to prevent your work being lost. And Sisyphus is easy to use and needs you just to select forms to protect:
$('#form1, #form2').sisyphus();
Or protect all forms on page (for this page these two variants are equal):$('form').sisyphus();
Local Storage will be freed of these forms values on submit or reset.
Following options are defaults but customizable:
{
customKeyPrefix: '',
timeout: 0,
onSave: function() {},
onRestore: function() {},
onRelease: function() {},
excludeFields: null
}
customKeyPrefix is an addition to key in Local Storage to store form fields values
timeout is an interval in seconds to perform saving data. If 0 - save every time field is updated.
onSave is function fired each time data are saved to Local Storage
onRestore is function fired if form's data are restored from Local Storage. Unlike onSaveCallback it's common for whole form, not for each field
onRelease is function fired when Local Storage is freed of previously stored form data
excludeFields is selector to exclude specified fields from observing, ex: $( "textarea, :text" )
For example, following code will force Sisyphus to save each text field value every 5 seconds:
$('form').sisyphus({timeout: 5});
That's it!


