Ticket #5491: autosave.2.diff
| File autosave.2.diff, 2.5 KB (added by , 19 years ago) |
|---|
-
wp-includes/js/autosave.js
1 1 var autosaveLast = ''; 2 2 var autosavePeriodical; 3 3 4 function disable_autosave() { 5 autosavePeriodical.currentlyExecuting = true; 6 } 7 4 8 function autosave_start_timer() { 5 9 var form = $('post'); 6 10 autosaveLast = form.post_title.value+form.content.value; … … 8 12 autosavePeriodical = new PeriodicalExecuter(autosave, autosaveL10n.autosaveInterval); 9 13 //Disable autosave after the form has been submitted 10 14 if(form.addEventListener) { 11 form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false);15 Event.observe('post', 'submit', disable_autosave); 12 16 } 13 17 if(form.attachEvent) { 14 form.save ? form.save.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null;15 form.submit ? form.submit.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null;16 form.publish ? form.publish.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null;17 form.deletepost ? form.deletepost.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null;18 Event.observe('save', 'click', disable_autosave); 19 Event.observe('submit', 'click', disable_autosave); 20 Event.observe('publish', 'click', disable_autosave); 21 Event.observe('deletepost', 'click', disable_autosave); 18 22 } 23 Event.observe('tags-input', 'focus', function() { autosavePeriodical.saveTags = false; }); 24 Event.observe('tags-input', 'blur', function() { autosavePeriodical.saveTags = true; }); 19 25 } 20 26 addLoadEvent(autosave_start_timer) 21 27 22 28 function autosave_cur_time() { 23 29 var now = new Date(); 24 return "" + ((now.getHours() >12) ? now.getHours() -12 : now.getHours()) + 30 return "" + ((now.getHours() >12) ? now.getHours() -12 : now.getHours()) + 25 31 ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes() + 26 32 ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds(); 27 33 } … … 131 137 autosaveAjax.setVar("post_ID", $("post_ID").value); 132 138 autosaveAjax.setVar("post_title", form.post_title.value); 133 139 autosaveAjax.setVar("post_type", form.post_type.value); 134 autosaveAjax.setVar("tags_input", form.tags_input.value); 140 if ( autosavePeriodical.saveTags ) 141 autosaveAjax.setVar("tags_input", form.tags_input.value); 135 142 if ( form.comment_status.checked ) 136 143 autosaveAjax.setVar("comment_status", 'open'); 137 144 if ( form.ping_status.checked )
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)