4 * Copyright (c) 2009-2014 Fil (fil@rezo.net)
5 * Dual licensed under the MIT and GPL licenses:
6 * http://www.opensource.org/licenses/mit-license.php
7 * http://www.gnu.org/licenses/gpl.html
12 * Usage: $("form").autosave({options...});
13 * to use with SPIP's action/session.php
17 $.fn
.autosave = function(opt
) {
20 confirmstring
: 'Sauvegarder ?'
23 .bind('unload',function() {
24 $('form.autosavechanged')
26 if (!opt
.confirm
|| confirm(opt
.confirmstring
)) {
27 var contenu
= $(this).serialize();
30 'var': 'autosave_' + $('input[name=autosave]', this).val(),
37 .bind('change keyup', function() {
38 $(this).addClass('autosavechanged');
40 .bind('submit',function() {
41 $(this).removeClass('autosavechanged');