Fix JSHint errors in autosave.js.

props seanchayes.
fixes #26035.

Built from https://develop.svn.wordpress.org/trunk@26202


git-svn-id: http://core.svn.wordpress.org/trunk@26110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-11-15 05:20:10 +00:00
parent 69fc43dcb6
commit 1a7610a34d
2 changed files with 28 additions and 22 deletions

View File

@ -1,4 +1,10 @@
var autosave, autosaveLast = '', autosavePeriodical, autosaveDelayPreview = false, notSaved = true, blockSave = false, fullscreen, autosaveLockRelease = true;
/* global switchEditors, autosaveL10n, tinymce, ajaxurl, wpAjax, makeSlugeditClickable, wpCookies */
var autosave, autosavePeriodical, fullscreen, doPreview,
autosaveLast = '',
autosaveDelayPreview = false,
notSaved = true,
blockSave = false,
autosaveLockRelease = true;
jQuery(document).ready( function($) {
@ -15,7 +21,7 @@ jQuery(document).ready( function($) {
autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
//Disable autosave after the form has been submitted
$("#post").submit(function() {
$('#post').submit(function() {
$.cancel(autosavePeriodical);
autosaveLockRelease = false;
});
@ -106,7 +112,7 @@ jQuery(document).ready( function($) {
}
$('input#wp-preview').val('');
}
};
// This code is meant to allow tabbing from Title to Post content.
$('#title').on('keydown.editor-focus', function(e) {
@ -120,7 +126,7 @@ jQuery(document).ready( function($) {
ed = tinymce.get('content');
if ( ed && !ed.isHidden() ) {
$(this).one('keyup', function(e){
$(this).one('keyup', function(){
$('#content_tbl td.mceToolbar > a').focus();
});
} else {
@ -282,7 +288,7 @@ autosave = function() {
return false;
// No autosave while thickbox is open (media buttons)
if ( jQuery("#TB_window").css('display') == 'block' )
if ( jQuery('#TB_window').css('display') == 'block' )
return false;
compareString = wp.autosave.getCompareString( post_data );
@ -292,12 +298,12 @@ autosave = function() {
return false;
autosaveLast = compareString;
jQuery(document).triggerHandler('wpcountwords', [ post_data["content"] ]);
jQuery(document).triggerHandler('wpcountwords', [ post_data.content ]);
// Disable buttons until we know the save completed.
autosave_disable_buttons();
if ( post_data["auto_draft"] == '1' ) {
if ( post_data.auto_draft == '1' ) {
successCallback = autosave_saved_new; // new post
} else {
successCallback = autosave_saved; // pre-existing post
@ -306,13 +312,13 @@ autosave = function() {
jQuery.ajax({
data: post_data,
beforeSend: autosave_loading,
type: "POST",
type: 'POST',
url: ajaxurl,
success: successCallback
});
return true;
}
};
// Autosave in localStorage
// set as simple object/mixin for now
@ -347,11 +353,11 @@ wp.autosave.getPostData = function() {
}
if ( typeof fullscreen != 'undefined' && fullscreen.settings.visible ) {
data['post_title'] = $('#wp-fullscreen-title').val() || '';
data['content'] = $('#wp_mce_fullscreen').val() || '';
data.post_title = $('#wp-fullscreen-title').val() || '';
data.content = $('#wp_mce_fullscreen').val() || '';
} else {
data['post_title'] = $('#title').val() || '';
data['content'] = $('#content').val() || '';
data.post_title = $('#title').val() || '';
data.content = $('#content').val() || '';
}
/*
@ -364,22 +370,22 @@ wp.autosave.getPostData = function() {
$('input[id^="in-category-"]:checked').each( function() {
cats.push(this.value);
});
data['catslist'] = cats.join(',');
data.catslist = cats.join(',');
if ( post_name = $('#post_name').val() )
data['post_name'] = post_name;
data.post_name = post_name;
if ( parent_id = $('#parent_id').val() )
data['parent_id'] = parent_id;
data.parent_id = parent_id;
if ( $('#comment_status').prop('checked') )
data['comment_status'] = 'open';
data.comment_status = 'open';
if ( $('#ping_status').prop('checked') )
data['ping_status'] = 'open';
data.ping_status = 'open';
if ( $('#auto_draft').val() == '1' )
data['auto_draft'] = '1';
data.auto_draft = '1';
return data;
};
@ -520,8 +526,8 @@ wp.autosave.local = {
if ( compareString == this.lastSavedData )
return false;
post_data['save_time'] = (new Date()).getTime();
post_data['status'] = $('#post_status').val() || '';
post_data.save_time = (new Date()).getTime();
post_data.status = $('#post_status').val() || '';
result = this.setData( post_data );
if ( result )

File diff suppressed because one or more lines are too long