Ticket #26035: 26035.patch
File 26035.patch, 4.1 KB (added by , 12 years ago) |
---|
-
src/wp-includes/js/autosave.js
1 var autosave, autosaveLast = '', autosavePeriodical, autosaveDelayPreview = false, notSaved = true, blockSave = false, fullscreen, autosaveLockRelease = true; 1 /* global switchEditors, autosaveL10n, tinymce, ajaxurl, wpAjax, makeSlugeditClickable, wpCookies */ 2 var autosave, autosaveLast = '', autosavePeriodical, autosaveDelayPreview = false, notSaved = true, blockSave = false, fullscreen, autosaveLockRelease = true, doPreview; 2 3 3 4 jQuery(document).ready( function($) { 4 5 … … 15 16 autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true}); 16 17 17 18 //Disable autosave after the form has been submitted 18 $( "#post").submit(function() {19 $('#post').submit(function() { 19 20 $.cancel(autosavePeriodical); 20 21 autosaveLockRelease = false; 21 22 }); … … 106 107 } 107 108 108 109 $('input#wp-preview').val(''); 109 } 110 }; 110 111 111 112 // This code is meant to allow tabbing from Title to Post content. 112 113 $('#title').on('keydown.editor-focus', function(e) { … … 120 121 ed = tinymce.get('content'); 121 122 122 123 if ( ed && !ed.isHidden() ) { 123 $(this).one('keyup', function( e){124 $(this).one('keyup', function(){ 124 125 $('#content_tbl td.mceToolbar > a').focus(); 125 126 }); 126 127 } else { … … 282 283 return false; 283 284 284 285 // No autosave while thickbox is open (media buttons) 285 if ( jQuery( "#TB_window").css('display') == 'block' )286 if ( jQuery('#TB_window').css('display') == 'block' ) 286 287 return false; 287 288 288 289 compareString = wp.autosave.getCompareString( post_data ); … … 292 293 return false; 293 294 294 295 autosaveLast = compareString; 295 jQuery(document).triggerHandler('wpcountwords', [ post_data ["content"]]);296 jQuery(document).triggerHandler('wpcountwords', [ post_data.content ]); 296 297 297 298 // Disable buttons until we know the save completed. 298 299 autosave_disable_buttons(); 299 300 300 if ( post_data ["auto_draft"]== '1' ) {301 if ( post_data.auto_draft == '1' ) { 301 302 successCallback = autosave_saved_new; // new post 302 303 } else { 303 304 successCallback = autosave_saved; // pre-existing post … … 306 307 jQuery.ajax({ 307 308 data: post_data, 308 309 beforeSend: autosave_loading, 309 type: "POST",310 type: 'POST', 310 311 url: ajaxurl, 311 312 success: successCallback 312 313 }); 313 314 314 315 return true; 315 } 316 }; 316 317 317 318 // Autosave in localStorage 318 319 // set as simple object/mixin for now … … 347 348 } 348 349 349 350 if ( typeof fullscreen != 'undefined' && fullscreen.settings.visible ) { 350 data ['post_title']= $('#wp-fullscreen-title').val() || '';351 data ['content']= $('#wp_mce_fullscreen').val() || '';351 data.post_title = $('#wp-fullscreen-title').val() || ''; 352 data.content = $('#wp_mce_fullscreen').val() || ''; 352 353 } else { 353 data ['post_title']= $('#title').val() || '';354 data ['content']= $('#content').val() || '';354 data.post_title = $('#title').val() || ''; 355 data.content = $('#content').val() || ''; 355 356 } 356 357 357 358 /* … … 364 365 $('input[id^="in-category-"]:checked').each( function() { 365 366 cats.push(this.value); 366 367 }); 367 data ['catslist']= cats.join(',');368 data.catslist = cats.join(','); 368 369 369 370 if ( post_name = $('#post_name').val() ) 370 data ['post_name']= post_name;371 data.post_name = post_name; 371 372 372 373 if ( parent_id = $('#parent_id').val() ) 373 data ['parent_id']= parent_id;374 data.parent_id = parent_id; 374 375 375 376 if ( $('#comment_status').prop('checked') ) 376 data ['comment_status']= 'open';377 data.comment_status = 'open'; 377 378 378 379 if ( $('#ping_status').prop('checked') ) 379 data ['ping_status']= 'open';380 data.ping_status = 'open'; 380 381 381 382 if ( $('#auto_draft').val() == '1' ) 382 data ['auto_draft']= '1';383 data.auto_draft = '1'; 383 384 384 385 return data; 385 386 }; … … 520 521 if ( compareString == this.lastSavedData ) 521 522 return false; 522 523 523 post_data ['save_time']= (new Date()).getTime();524 post_data ['status']= $('#post_status').val() || '';524 post_data.save_time = (new Date()).getTime(); 525 post_data.status = $('#post_status').val() || ''; 525 526 result = this.setData( post_data ); 526 527 527 528 if ( result )