Fix JSHint errors in customize-controls.js.
props jorbin. fixes #25917. Built from https://develop.svn.wordpress.org/trunk@26206 git-svn-id: http://core.svn.wordpress.org/trunk@26114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eb1151b590
commit
4e72213373
|
@ -8,8 +8,6 @@
|
||||||
*/
|
*/
|
||||||
api.Setting = api.Value.extend({
|
api.Setting = api.Value.extend({
|
||||||
initialize: function( id, value, options ) {
|
initialize: function( id, value, options ) {
|
||||||
var element;
|
|
||||||
|
|
||||||
api.Value.prototype.initialize.call( this, value, options );
|
api.Value.prototype.initialize.call( this, value, options );
|
||||||
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -85,18 +83,17 @@
|
||||||
ready: function() {},
|
ready: function() {},
|
||||||
|
|
||||||
dropdownInit: function() {
|
dropdownInit: function() {
|
||||||
var control = this,
|
var control = this,
|
||||||
statuses = this.container.find('.dropdown-status'),
|
statuses = this.container.find('.dropdown-status'),
|
||||||
params = this.params,
|
params = this.params,
|
||||||
update = function( to ) {
|
toggleFreeze = false,
|
||||||
if ( typeof to === 'string' && params.statuses && params.statuses[ to ] )
|
update = function( to ) {
|
||||||
|
if ( typeof to === 'string' && params.statuses && params.statuses[ to ] )
|
||||||
statuses.html( params.statuses[ to ] ).show();
|
statuses.html( params.statuses[ to ] ).show();
|
||||||
else
|
else
|
||||||
statuses.hide();
|
statuses.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
var toggleFreeze = false;
|
|
||||||
|
|
||||||
// Support the .dropdown class to open/close complex elements
|
// Support the .dropdown class to open/close complex elements
|
||||||
this.container.on( 'click keydown', '.dropdown', function( event ) {
|
this.container.on( 'click keydown', '.dropdown', function( event ) {
|
||||||
if ( event.type === 'keydown' && 13 !== event.which ) // enter
|
if ( event.type === 'keydown' && 13 !== event.which ) // enter
|
||||||
|
@ -128,12 +125,12 @@
|
||||||
picker = this.container.find('.color-picker-hex');
|
picker = this.container.find('.color-picker-hex');
|
||||||
|
|
||||||
picker.val( control.setting() ).wpColorPicker({
|
picker.val( control.setting() ).wpColorPicker({
|
||||||
change: function( event, options ) {
|
change: function() {
|
||||||
control.setting.set( picker.wpColorPicker('color') );
|
control.setting.set( picker.wpColorPicker('color') );
|
||||||
},
|
},
|
||||||
clear: function() {
|
clear: function() {
|
||||||
control.setting.set( false );
|
control.setting.set( false );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -197,7 +194,7 @@
|
||||||
panels;
|
panels;
|
||||||
|
|
||||||
this.uploader = {
|
this.uploader = {
|
||||||
init: function( up ) {
|
init: function() {
|
||||||
var fallback, button;
|
var fallback, button;
|
||||||
|
|
||||||
if ( this.supports.dragdrop )
|
if ( this.supports.dragdrop )
|
||||||
|
@ -319,8 +316,7 @@
|
||||||
sensitivity: 2000,
|
sensitivity: 2000,
|
||||||
|
|
||||||
initialize: function( params, options ) {
|
initialize: function( params, options ) {
|
||||||
var deferred = $.Deferred(),
|
var deferred = $.Deferred();
|
||||||
self = this;
|
|
||||||
|
|
||||||
// This is the promise object.
|
// This is the promise object.
|
||||||
deferred.promise( this );
|
deferred.promise( this );
|
||||||
|
@ -488,8 +484,7 @@
|
||||||
*/
|
*/
|
||||||
initialize: function( params, options ) {
|
initialize: function( params, options ) {
|
||||||
var self = this,
|
var self = this,
|
||||||
rscheme = /^https?/,
|
rscheme = /^https?/;
|
||||||
url;
|
|
||||||
|
|
||||||
$.extend( this, options || {} );
|
$.extend( this, options || {} );
|
||||||
|
|
||||||
|
@ -706,9 +701,9 @@
|
||||||
if ( ! $.support.postMessage || ( ! $.support.cors && api.settings.isCrossDomain ) )
|
if ( ! $.support.postMessage || ( ! $.support.cors && api.settings.isCrossDomain ) )
|
||||||
return window.location = api.settings.url.fallback;
|
return window.location = api.settings.url.fallback;
|
||||||
|
|
||||||
var body = $( document.body ),
|
var previewer, parent, topFocus,
|
||||||
overlay = body.children('.wp-full-overlay'),
|
body = $( document.body ),
|
||||||
query, previewer, parent;
|
overlay = body.children('.wp-full-overlay');
|
||||||
|
|
||||||
// Prevent the form from saving when enter is pressed.
|
// Prevent the form from saving when enter is pressed.
|
||||||
$('#customize-controls').on( 'keydown', function( e ) {
|
$('#customize-controls').on( 'keydown', function( e ) {
|
||||||
|
@ -733,9 +728,9 @@
|
||||||
query: function() {
|
query: function() {
|
||||||
return {
|
return {
|
||||||
wp_customize: 'on',
|
wp_customize: 'on',
|
||||||
theme: api.settings.theme.stylesheet,
|
theme: api.settings.theme.stylesheet,
|
||||||
customized: JSON.stringify( api.get() ),
|
customized: JSON.stringify( api.get() ),
|
||||||
nonce: this.nonce.preview
|
nonce: this.nonce.preview
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -778,9 +773,9 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// Refresh the nonces if the preview sends updated nonces over.
|
// Refresh the nonces if the preview sends updated nonces over.
|
||||||
previewer.bind( 'nonce', function( nonce ) {
|
previewer.bind( 'nonce', function( nonce ) {
|
||||||
$.extend( this.nonce, nonce );
|
$.extend( this.nonce, nonce );
|
||||||
});
|
});
|
||||||
|
|
||||||
$.each( api.settings.settings, function( id, data ) {
|
$.each( api.settings.settings, function( id, data ) {
|
||||||
api.create( id, id, data.value, {
|
api.create( id, id, data.value, {
|
||||||
|
@ -920,15 +915,15 @@
|
||||||
$.each({
|
$.each({
|
||||||
'background_image': {
|
'background_image': {
|
||||||
controls: [ 'background_repeat', 'background_position_x', 'background_attachment' ],
|
controls: [ 'background_repeat', 'background_position_x', 'background_attachment' ],
|
||||||
callback: function( to ) { return !! to }
|
callback: function( to ) { return !! to; }
|
||||||
},
|
},
|
||||||
'show_on_front': {
|
'show_on_front': {
|
||||||
controls: [ 'page_on_front', 'page_for_posts' ],
|
controls: [ 'page_on_front', 'page_for_posts' ],
|
||||||
callback: function( to ) { return 'page' === to }
|
callback: function( to ) { return 'page' === to; }
|
||||||
},
|
},
|
||||||
'header_textcolor': {
|
'header_textcolor': {
|
||||||
controls: [ 'header_textcolor' ],
|
controls: [ 'header_textcolor' ],
|
||||||
callback: function( to ) { return 'blank' !== to }
|
callback: function( to ) { return 'blank' !== to; }
|
||||||
}
|
}
|
||||||
}, function( settingId, o ) {
|
}, function( settingId, o ) {
|
||||||
api( settingId, function( setting ) {
|
api( settingId, function( setting ) {
|
||||||
|
@ -973,7 +968,7 @@
|
||||||
control.settings.data.set( false );
|
control.settings.data.set( false );
|
||||||
});
|
});
|
||||||
|
|
||||||
control.library.on( 'click', 'a', function( event ) {
|
control.library.on( 'click', 'a', function() {
|
||||||
control.settings.data.set( $(this).data('customizeHeaderImageData') );
|
control.settings.data.set( $(this).data('customizeHeaderImageData') );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -998,7 +993,7 @@
|
||||||
api.trigger( 'ready' );
|
api.trigger( 'ready' );
|
||||||
|
|
||||||
// Make sure left column gets focus
|
// Make sure left column gets focus
|
||||||
var topFocus = $('.back');
|
topFocus = $('.back');
|
||||||
topFocus.focus();
|
topFocus.focus();
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
topFocus.focus();
|
topFocus.focus();
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue