From 3cbad655d52b2dab052fc99421348f18774ddab9 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 11 Aug 2006 18:19:32 +0000 Subject: [PATCH] wpTriggerSave for autosave. does not move cursor. git-svn-id: https://develop.svn.wordpress.org/trunk@4085 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/js/autosave.js.php | 14 ++-- .../plugins/wordpress/editor_plugin.js | 83 +++++++++++++++++++ 2 files changed, 92 insertions(+), 5 deletions(-) diff --git a/wp-includes/js/autosave.js.php b/wp-includes/js/autosave.js.php index 768c917b49..72c3dea517 100644 --- a/wp-includes/js/autosave.js.php +++ b/wp-includes/js/autosave.js.php @@ -7,6 +7,7 @@ header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT") ?> +var autosaveLast = ''; function autosave_timer() { autosave(); setTimeout("autosave_timer()", ); @@ -56,20 +57,23 @@ function autosave_saved() { } function autosave() { + var form = $('post'); + autosaveAjax = new sack(); - form = $('post'); /* Gotta do this up here so we can check the length when tinyMCE is in use */ if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) { autosaveAjax.setVar("content", form.content.value); } else { - tinyMCE.triggerSave(); + tinyMCE.wpTriggerSave(); autosaveAjax.setVar("content", form.content.value); } - if(form.post_title.value.length==0 || form.content.value.length==0) + if(form.post_title.value.length==0 || form.content.value.length==0 || form.post_title.value+form.content.value == autosaveLast) return; - + + autosaveLast = form.post_title.value+form.content.value; + cats = document.getElementsByName("post_category[]"); goodcats = ([]); for(i=0;i