WordPress.org

Make WordPress Core

Changeset 7394


Ignore:
Timestamp:
03/19/08 05:38:58 (6 years ago)
Author:
markjaquith
Message:

Autosave when title has content and loses focus. props ryan. see #5749

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/page.js

    r7341 r7394  
    22    add_postbox_toggles('page'); 
    33    make_slugedit_clickable(); 
     4 
     5    jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } ); 
    46 
    57    // hide advanced slug field 
  • trunk/wp-admin/js/post.js

    r7338 r7394  
    6363    add_postbox_toggles('post'); 
    6464 
    65     // If no tags on the page, skip the tag and category stuff. 
    66     if ( !jQuery('#tags-input').size() ) { 
    67         return; 
    68     } 
    69  
    7065    // Editable slugs 
    7166    make_slugedit_clickable(); 
     
    9186    jQuery('#publish').click( tag_save_on_publish ); 
    9287    jQuery('#save-post').click( tag_save_on_publish ); 
     88 
     89    jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } ); 
    9390 
    9491    // auto-suggest stuff 
  • trunk/wp-includes/general-template.php

    r7313 r7394  
    978978            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 
    979979                if ( tinyMCE.activeEditor ) { 
     980                    if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); } 
    980981                    e = null; 
    981982                    if ( tinyMCE.activeEditor.isHidden() ) return true; 
  • trunk/wp-includes/js/autosave.js

    r7375 r7394  
    99    //Disable autosave after the form has been submitted 
    1010    $("#post").submit(function() { $.cancel(autosavePeriodical); }); 
    11  
    12     // Autosave early on for a new post.  Why?  Should this only be run once? 
    13     $("#content").keypress(function() { 
    14         if ( 1 === ( $(this).val().length % 15 ) && 1 > parseInt($("#post_ID").val(),10) ) 
    15             setTimeout(autosave, 5000); 
    16     }); 
    1711}); 
    1812 
     
    149143 
    150144    // Nothing to save or no change. 
    151     if(post_data["post_title"].length==0 || post_data["content"].length==0 || post_data["post_title"] + post_data["content"] == autosaveLast) { 
     145    if( (post_data["post_title"].length==0 && post_data["content"].length==0) || post_data["post_title"] + post_data["content"] == autosaveLast) { 
    152146        doAutoSave = false 
    153147    } 
  • trunk/wp-includes/script-loader.php

    r7384 r7394  
    4848        ) ); 
    4949 
    50         $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080312' ); 
     50        $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080317' ); 
    5151 
    5252        $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); 
     
    142142                'cancel' => __('Cancel'), 
    143143            ) ); 
    144             $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080221' ); 
     144            $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080318' ); 
    145145            $this->localize( 'post', 'postL10n', array( 
    146146                'tagsUsed' =>  __('Tags used on this post:'), 
     
    151151                'edit' => __('Edit'), 
    152152            ) ); 
    153             $this->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080208' ); 
     153            $this->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080318' ); 
    154154            $this->localize( 'page', 'postL10n', array( 
    155155                'cancel' => __('Cancel'), 
Note: See TracChangeset for help on using the changeset viewer.