mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-19 09:05:22 +01:00
Fix JSHint errors in post.js.
props atimmer. fixes #25994. Built from https://develop.svn.wordpress.org/trunk@26204 git-svn-id: http://core.svn.wordpress.org/trunk@26112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0b0ab09ae8
commit
42dab0d17f
@ -1,3 +1,6 @@
|
|||||||
|
/* global postL10n, ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting, getUserSetting, setUserSetting */
|
||||||
|
/* global theList:true, theExtraList:true, autosave:true */
|
||||||
|
|
||||||
var tagBox, commentsBox, editPermalink, makeSlugeditClickable, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint;
|
var tagBox, commentsBox, editPermalink, makeSlugeditClickable, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint;
|
||||||
|
|
||||||
// return an array with any duplicate, whitespace or values removed
|
// return an array with any duplicate, whitespace or values removed
|
||||||
@ -81,11 +84,11 @@ tagBox = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
flushTags : function(el, a, f) {
|
flushTags : function(el, a, f) {
|
||||||
a = a || false;
|
var tagsval, newtags, text,
|
||||||
var tags = $('.the-tags', el),
|
tags = $('.the-tags', el),
|
||||||
newtag = $('input.newtag', el),
|
newtag = $('input.newtag', el),
|
||||||
comma = postL10n.comma,
|
comma = postL10n.comma;
|
||||||
newtags, text;
|
a = a || false;
|
||||||
|
|
||||||
text = a ? $(a).text() : newtag.val();
|
text = a ? $(a).text() : newtag.val();
|
||||||
tagsval = tags.val();
|
tagsval = tags.val();
|
||||||
@ -108,7 +111,7 @@ tagBox = {
|
|||||||
var tax = id.substr(id.indexOf('-')+1);
|
var tax = id.substr(id.indexOf('-')+1);
|
||||||
|
|
||||||
$.post(ajaxurl, {'action':'get-tagcloud', 'tax':tax}, function(r, stat) {
|
$.post(ajaxurl, {'action':'get-tagcloud', 'tax':tax}, function(r, stat) {
|
||||||
if ( 0 == r || 'success' != stat )
|
if ( 0 === r || 'success' != stat )
|
||||||
r = wpAjax.broken;
|
r = wpAjax.broken;
|
||||||
|
|
||||||
r = $('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+'</p>');
|
r = $('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+'</p>');
|
||||||
@ -137,7 +140,7 @@ tagBox = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('input.newtag', ajaxtag).blur(function() {
|
$('input.newtag', ajaxtag).blur(function() {
|
||||||
if ( this.value == '' )
|
if ( '' === this.value )
|
||||||
$(this).parent().siblings('.taghint').css('visibility', '');
|
$(this).parent().siblings('.taghint').css('visibility', '');
|
||||||
}).focus(function(){
|
}).focus(function(){
|
||||||
$(this).parent().siblings('.taghint').css('visibility', 'hidden');
|
$(this).parent().siblings('.taghint').css('visibility', 'hidden');
|
||||||
@ -206,7 +209,7 @@ commentsBox = {
|
|||||||
$('#the-comment-list').append( r.responses[0].data );
|
$('#the-comment-list').append( r.responses[0].data );
|
||||||
|
|
||||||
theList = theExtraList = null;
|
theList = theExtraList = null;
|
||||||
$("a[className*=':']").unbind();
|
$( 'a[className*=\':\']' ).unbind();
|
||||||
|
|
||||||
if ( commentsBox.st > commentsBox.total )
|
if ( commentsBox.st > commentsBox.total )
|
||||||
$('#show-comments').hide();
|
$('#show-comments').hide();
|
||||||
@ -240,7 +243,7 @@ WPSetThumbnailID = function(id){
|
|||||||
|
|
||||||
WPRemoveThumbnail = function(nonce){
|
WPRemoveThumbnail = function(nonce){
|
||||||
$.post(ajaxurl, {
|
$.post(ajaxurl, {
|
||||||
action:"set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
|
action: 'set-post-thumbnail', post_id: $( '#post_ID' ).val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
|
||||||
}, function(str){
|
}, function(str){
|
||||||
if ( str == '0' ) {
|
if ( str == '0' ) {
|
||||||
alert( setPostThumbnailL10n.error );
|
alert( setPostThumbnailL10n.error );
|
||||||
@ -259,10 +262,10 @@ $(document).on( 'heartbeat-send.refresh-lock', function( e, data ) {
|
|||||||
if ( ! post_id || ! $('#post-lock-dialog').length )
|
if ( ! post_id || ! $('#post-lock-dialog').length )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
send['post_id'] = post_id;
|
send.post_id = post_id;
|
||||||
|
|
||||||
if ( lock )
|
if ( lock )
|
||||||
send['lock'] = lock;
|
send.lock = lock;
|
||||||
|
|
||||||
data['wp-refresh-post-lock'] = send;
|
data['wp-refresh-post-lock'] = send;
|
||||||
});
|
});
|
||||||
@ -351,7 +354,8 @@ $(document).on( 'heartbeat-tick.refresh-lock', function( e, data ) {
|
|||||||
}(jQuery));
|
}(jQuery));
|
||||||
|
|
||||||
jQuery(document).ready( function($) {
|
jQuery(document).ready( function($) {
|
||||||
var stamp, visibility, sticky = '', last = 0, co = $('#content');
|
var stamp, visibility, updateVisibility, updateText,
|
||||||
|
sticky = '', last = 0, co = $('#content');
|
||||||
|
|
||||||
postboxes.add_postbox_toggles(pagenow);
|
postboxes.add_postbox_toggles(pagenow);
|
||||||
|
|
||||||
@ -406,17 +410,17 @@ jQuery(document).ready( function($) {
|
|||||||
$('#' + taxonomy + '-tabs').siblings('.tabs-panel').hide();
|
$('#' + taxonomy + '-tabs').siblings('.tabs-panel').hide();
|
||||||
$(t).show();
|
$(t).show();
|
||||||
if ( '#' + taxonomy + '-all' == t )
|
if ( '#' + taxonomy + '-all' == t )
|
||||||
deleteUserSetting(settingName);
|
deleteUserSetting( settingName );
|
||||||
else
|
else
|
||||||
setUserSetting(settingName, 'pop');
|
setUserSetting( settingName, 'pop' );
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( getUserSetting(settingName) )
|
if ( getUserSetting( settingName ) )
|
||||||
$('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click();
|
$('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click();
|
||||||
|
|
||||||
// Ajax Cat
|
// Ajax Cat
|
||||||
$('#new' + taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
|
$( '#new' + taxonomy ).one( 'focus', function() { $( this ).val( '' ).removeClass( 'form-input-tip' ); } );
|
||||||
|
|
||||||
$('#new' + taxonomy).keypress( function(event){
|
$('#new' + taxonomy).keypress( function(event){
|
||||||
if( 13 === event.keyCode ) {
|
if( 13 === event.keyCode ) {
|
||||||
@ -468,7 +472,7 @@ jQuery(document).ready( function($) {
|
|||||||
|
|
||||||
// Custom Fields
|
// Custom Fields
|
||||||
if ( $('#postcustom').length ) {
|
if ( $('#postcustom').length ) {
|
||||||
$('#the-list').wpList( { addAfter: function( xml, s ) {
|
$( '#the-list' ).wpList( { addAfter: function() {
|
||||||
$('table#list-table').show();
|
$('table#list-table').show();
|
||||||
}, addBefore: function( s ) {
|
}, addBefore: function( s ) {
|
||||||
s.data += '&post_id=' + $('#post_ID').val();
|
s.data += '&post_id=' + $('#post_ID').val();
|
||||||
@ -482,7 +486,7 @@ jQuery(document).ready( function($) {
|
|||||||
stamp = $('#timestamp').html();
|
stamp = $('#timestamp').html();
|
||||||
visibility = $('#post-visibility-display').html();
|
visibility = $('#post-visibility-display').html();
|
||||||
|
|
||||||
function updateVisibility() {
|
updateVisibility = function() {
|
||||||
var pvSelect = $('#post-visibility-select');
|
var pvSelect = $('#post-visibility-select');
|
||||||
if ( $('input:radio:checked', pvSelect).val() != 'public' ) {
|
if ( $('input:radio:checked', pvSelect).val() != 'public' ) {
|
||||||
$('#sticky').prop('checked', false);
|
$('#sticky').prop('checked', false);
|
||||||
@ -495,9 +499,9 @@ jQuery(document).ready( function($) {
|
|||||||
} else {
|
} else {
|
||||||
$('#password-span').show();
|
$('#password-span').show();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function updateText() {
|
updateText = function() {
|
||||||
|
|
||||||
if ( ! $('#timestampdiv').length )
|
if ( ! $('#timestampdiv').length )
|
||||||
return true;
|
return true;
|
||||||
@ -536,14 +540,14 @@ jQuery(document).ready( function($) {
|
|||||||
.replace( '%2$s', jj )
|
.replace( '%2$s', jj )
|
||||||
.replace( '%3$s', aa )
|
.replace( '%3$s', aa )
|
||||||
.replace( '%4$s', hh )
|
.replace( '%4$s', hh )
|
||||||
.replace( '%5$s', mn )
|
.replace( '%5$s', mn ) +
|
||||||
+ '</b> '
|
'</b> '
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $('input:radio:checked', '#post-visibility-select').val() == 'private' ) {
|
if ( $('input:radio:checked', '#post-visibility-select').val() == 'private' ) {
|
||||||
$('#publish').val( postL10n.update );
|
$('#publish').val( postL10n.update );
|
||||||
if ( optPublish.length == 0 ) {
|
if ( 0 === optPublish.length ) {
|
||||||
postStatus.append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
|
postStatus.append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
|
||||||
} else {
|
} else {
|
||||||
optPublish.html( postL10n.privatelyPublished );
|
optPublish.html( postL10n.privatelyPublished );
|
||||||
@ -574,10 +578,10 @@ jQuery(document).ready( function($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
$('.edit-visibility', '#visibility').click(function () {
|
$('.edit-visibility', '#visibility').click(function () {
|
||||||
if ($('#post-visibility-select').is(":hidden")) {
|
if ( $( '#post-visibility-select' ).is( ':hidden' ) ) {
|
||||||
updateVisibility();
|
updateVisibility();
|
||||||
$('#post-visibility-select').slideDown('fast');
|
$('#post-visibility-select').slideDown('fast');
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
@ -607,7 +611,7 @@ jQuery(document).ready( function($) {
|
|||||||
$('#sticky').prop('checked', false);
|
$('#sticky').prop('checked', false);
|
||||||
} // WEAPON LOCKED
|
} // WEAPON LOCKED
|
||||||
|
|
||||||
if ( true == $('#sticky').prop('checked') ) {
|
if ( $('#sticky').prop('checked') ) {
|
||||||
sticky = 'Sticky';
|
sticky = 'Sticky';
|
||||||
} else {
|
} else {
|
||||||
sticky = '';
|
sticky = '';
|
||||||
@ -622,7 +626,7 @@ jQuery(document).ready( function($) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#timestampdiv').siblings('a.edit-timestamp').click(function() {
|
$('#timestampdiv').siblings('a.edit-timestamp').click(function() {
|
||||||
if ($('#timestampdiv').is(":hidden")) {
|
if ( $( '#timestampdiv' ).is( ':hidden' ) ) {
|
||||||
$('#timestampdiv').slideDown('fast');
|
$('#timestampdiv').slideDown('fast');
|
||||||
$('#mm').focus();
|
$('#mm').focus();
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
@ -661,7 +665,7 @@ jQuery(document).ready( function($) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#post-status-select').siblings('a.edit-post-status').click(function() {
|
$('#post-status-select').siblings('a.edit-post-status').click(function() {
|
||||||
if ($('#post-status-select').is(":hidden")) {
|
if ( $( '#post-status-select' ).is( ':hidden' ) ) {
|
||||||
$('#post-status-select').slideDown('fast');
|
$('#post-status-select').slideDown('fast');
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
}
|
}
|
||||||
@ -687,7 +691,15 @@ jQuery(document).ready( function($) {
|
|||||||
// permalink
|
// permalink
|
||||||
if ( $('#edit-slug-box').length ) {
|
if ( $('#edit-slug-box').length ) {
|
||||||
editPermalink = function(post_id) {
|
editPermalink = function(post_id) {
|
||||||
var i, c = 0, e = $('#editable-post-name'), revert_e = e.html(), real_slug = $('#post_name'), revert_slug = real_slug.val(), b = $('#edit-slug-buttons'), revert_b = b.html(), full = $('#editable-post-name-full').html();
|
var slug_value, i,
|
||||||
|
c = 0,
|
||||||
|
e = $( '#editable-post-name' ),
|
||||||
|
revert_e = e.html(),
|
||||||
|
real_slug = $( '#post_name' ),
|
||||||
|
revert_slug = real_slug.val(),
|
||||||
|
b = $( '#edit-slug-buttons' ),
|
||||||
|
revert_b = b.html(),
|
||||||
|
full = $( '#editable-post-name-full' ).html();
|
||||||
|
|
||||||
$('#view-post-btn').hide();
|
$('#view-post-btn').hide();
|
||||||
b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
|
b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
|
||||||
@ -743,16 +755,16 @@ jQuery(document).ready( function($) {
|
|||||||
b.children('.cancel').click();
|
b.children('.cancel').click();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).keyup(function(e) {
|
} ).keyup( function() {
|
||||||
real_slug.val(this.value);
|
real_slug.val(this.value);
|
||||||
}).focus();
|
}).focus();
|
||||||
}
|
};
|
||||||
|
|
||||||
makeSlugeditClickable = function() {
|
makeSlugeditClickable = function() {
|
||||||
$('#editable-post-name').click(function() {
|
$('#editable-post-name').click(function() {
|
||||||
$('#edit-slug-buttons').children('.edit-slug').click();
|
$('#edit-slug-buttons').children('.edit-slug').click();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
makeSlugeditClickable();
|
makeSlugeditClickable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,7 +791,7 @@ jQuery(document).ready( function($) {
|
|||||||
|
|
||||||
var title = $('#' + id), titleprompt = $('#' + id + '-prompt-text');
|
var title = $('#' + id), titleprompt = $('#' + id + '-prompt-text');
|
||||||
|
|
||||||
if ( title.val() == '' )
|
if ( '' === title.val() )
|
||||||
titleprompt.removeClass('screen-reader-text');
|
titleprompt.removeClass('screen-reader-text');
|
||||||
|
|
||||||
titleprompt.click(function(){
|
titleprompt.click(function(){
|
||||||
@ -788,7 +800,7 @@ jQuery(document).ready( function($) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
title.blur(function(){
|
title.blur(function(){
|
||||||
if ( this.value == '' )
|
if ( '' === this.value )
|
||||||
titleprompt.removeClass('screen-reader-text');
|
titleprompt.removeClass('screen-reader-text');
|
||||||
}).focus(function(){
|
}).focus(function(){
|
||||||
titleprompt.addClass('screen-reader-text');
|
titleprompt.addClass('screen-reader-text');
|
||||||
@ -796,7 +808,7 @@ jQuery(document).ready( function($) {
|
|||||||
titleprompt.addClass('screen-reader-text');
|
titleprompt.addClass('screen-reader-text');
|
||||||
$(this).unbind(e);
|
$(this).unbind(e);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
wptitlehint();
|
wptitlehint();
|
||||||
|
|
||||||
@ -812,7 +824,7 @@ jQuery(document).ready( function($) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function endDrag(e) {
|
function endDrag() {
|
||||||
var height;
|
var height;
|
||||||
|
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
@ -859,7 +871,7 @@ jQuery(document).ready( function($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resize TinyMCE to match the textarea height when switching Text -> Visual
|
// resize TinyMCE to match the textarea height when switching Text -> Visual
|
||||||
ed.onLoadContent.add( function(ed, o) {
|
ed.onLoadContent.add( function() {
|
||||||
var ifr_height, node = document.getElementById('content'),
|
var ifr_height, node = document.getElementById('content'),
|
||||||
height = node ? parseInt( node.style.height, 10 ) : 0,
|
height = node ? parseInt( node.style.height, 10 ) : 0,
|
||||||
tb_height = $('#content_tbl tr.mceFirst').height() || 33;
|
tb_height = $('#content_tbl tr.mceFirst').height() || 33;
|
||||||
@ -882,7 +894,7 @@ jQuery(document).ready( function($) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// resize the textarea to match TinyMCE's height when switching Visual -> Text
|
// resize the textarea to match TinyMCE's height when switching Visual -> Text
|
||||||
ed.onSaveContent.add( function(ed, o) {
|
ed.onSaveContent.add( function() {
|
||||||
var height = getHeight();
|
var height = getHeight();
|
||||||
|
|
||||||
if ( !height || height < 50 || height > 5000 )
|
if ( !height || height < 50 || height > 5000 )
|
||||||
@ -893,8 +905,8 @@ jQuery(document).ready( function($) {
|
|||||||
|
|
||||||
// save on resizing TinyMCE
|
// save on resizing TinyMCE
|
||||||
ed.onPostRender.add(function() {
|
ed.onPostRender.add(function() {
|
||||||
$('#content_resize').on('mousedown.wp-mce-resize', function(e){
|
$( '#content_resize' ).on( 'mousedown.wp-mce-resize', function() {
|
||||||
$(document).on('mouseup.wp-mce-resize', function(e){
|
$( document ).on( 'mouseup.wp-mce-resize', function() {
|
||||||
var height;
|
var height;
|
||||||
|
|
||||||
$(document).off('mouseup.wp-mce-resize');
|
$(document).off('mouseup.wp-mce-resize');
|
||||||
@ -909,7 +921,7 @@ jQuery(document).ready( function($) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// When changing post formats, change the editor body class
|
// When changing post formats, change the editor body class
|
||||||
$('#post-formats-select input.post-format').on( 'change.set-editor-class', function( event ) {
|
$( '#post-formats-select input.post-format' ).on( 'change.set-editor-class', function() {
|
||||||
var editor, body, format = this.id;
|
var editor, body, format = this.id;
|
||||||
|
|
||||||
if ( format && $( this ).prop('checked') ) {
|
if ( format && $( this ).prop('checked') ) {
|
||||||
|
2
wp-admin/js/post.min.js
vendored
2
wp-admin/js/post.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user