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