Slug edit for pages. Hide advanced slug field if JS enabled. Trigger first autosave after 15 chars. Set autosave interval to 60s. Props filosofo. see #5749

git-svn-id: https://develop.svn.wordpress.org/trunk@6955 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-02-21 20:19:34 +00:00
parent 908e657b61
commit da73b7408d
8 changed files with 31 additions and 10 deletions
+8
View File
@@ -12,6 +12,12 @@ function autosave_start_timer() {
jQuery("#post #submit").click(function() { jQuery.cancel(autosavePeriodical); });
jQuery("#post #publish").click(function() { jQuery.cancel(autosavePeriodical); });
jQuery("#post #deletepost").click(function() { jQuery.cancel(autosavePeriodical); });
// Autosave early on for a new post
jQuery("#content").keypress(function() {
if ( 1 === ( jQuery(this).val().length % 15 ) && 1 > parseInt(jQuery("#post_ID").val(),10) )
setTimeout(autosave, 5000);
});
}
addLoadEvent(autosave_start_timer)
@@ -132,6 +138,8 @@ function autosave() {
}
post_data["content"] = jQuery("#content").val();
if ( jQuery('#post_name').val() )
post_data["post_name"] = jQuery('#post_name').val();
if(post_data["post_title"].length==0 || post_data["content"].length==0 || post_data["post_title"] + post_data["content"] == autosaveLast) {
return;