0004-forms-let-autosave-call-finish-before-starting-a-new.patch
wcs/qommon/static/js/qommon.forms.js | ||
---|---|---|
5 | 5 |
}); |
6 | 6 |
if ($('form[data-has-draft]').length == 1) { |
7 | 7 |
var last_auto_save = $('form[data-has-draft]').serialize(); |
8 |
var timeout_id = window.setInterval(function() { |
|
8 |
var timeout_id = null; |
|
9 |
function autosave() { |
|
9 | 10 |
var new_auto_save = $('form[data-has-draft]').serialize(); |
10 |
if (last_auto_save == new_auto_save) return; |
|
11 |
if (last_auto_save == new_auto_save) { |
|
12 |
timeout_id = window.setTimeout(autosave, 5000); |
|
13 |
return; |
|
14 |
} |
|
11 | 15 |
$.ajax({ |
12 | 16 |
type: 'POST', |
13 | 17 |
url: window.location.pathname + 'autosave', |
... | ... | |
16 | 20 |
if (json.result == 'success') { |
17 | 21 |
last_auto_save = new_auto_save; |
18 | 22 |
} |
23 |
timeout_id = window.setTimeout(autosave, 5000); |
|
19 | 24 |
} |
20 | 25 |
}); |
21 |
}, 5000); |
|
26 |
} |
|
27 |
timeout_id = window.setTimeout(autosave, 5000); |
|
22 | 28 |
} |
23 | 29 |
$('#tracking-code button').click(function() { |
24 | 30 |
$('input[name=savedraft]').click(); |
25 |
- |