JSHint fixes for media-views and Gruntfile.
props gcorne. fixes #27032, #27033. git-svn-id: https://develop.svn.wordpress.org/trunk@27105 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2127c9322d
commit
7ff0442a07
@ -305,7 +305,7 @@ module.exports = function(grunt) {
|
|||||||
files: {
|
files: {
|
||||||
src: [
|
src: [
|
||||||
BUILD_DIR + '/**/*.js',
|
BUILD_DIR + '/**/*.js',
|
||||||
'!' + BUILD_DIR + '/wp-content/**/*.js',
|
'!' + BUILD_DIR + '/wp-content/**/*.js'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,9 @@
|
|||||||
sensitivity = sensitivity || 2000;
|
sensitivity = sensitivity || 2000;
|
||||||
|
|
||||||
if ( $.support.transition ) {
|
if ( $.support.transition ) {
|
||||||
if ( ! (selector instanceof $) )
|
if ( ! (selector instanceof $) ) {
|
||||||
selector = $( selector );
|
selector = $( selector );
|
||||||
|
}
|
||||||
|
|
||||||
// Resolve the deferred when the first element finishes animating.
|
// Resolve the deferred when the first element finishes animating.
|
||||||
selector.first().one( $.support.transition.end, deferred.resolve );
|
selector.first().one( $.support.transition.end, deferred.resolve );
|
||||||
@ -216,7 +217,7 @@
|
|||||||
*
|
*
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
* @returns {wp.media.controller.State} Returns a State model
|
* @returns {wp.media.controller.State} Returns a State model
|
||||||
* from the StateMachine collection
|
* from the StateMachine collection
|
||||||
*/
|
*/
|
||||||
state: function( id ) {
|
state: function( id ) {
|
||||||
this.states = this.states || new Backbone.Collection();
|
this.states = this.states || new Backbone.Collection();
|
||||||
@ -269,7 +270,7 @@
|
|||||||
* active state.
|
* active state.
|
||||||
*
|
*
|
||||||
* @returns {wp.media.controller.State} Returns a State model
|
* @returns {wp.media.controller.State} Returns a State model
|
||||||
* from the StateMachine collection
|
* from the StateMachine collection
|
||||||
*/
|
*/
|
||||||
lastState: function() {
|
lastState: function() {
|
||||||
if ( this._lastState ) {
|
if ( this._lastState ) {
|
||||||
@ -535,11 +536,13 @@
|
|||||||
}) );
|
}) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! this.get('edge') )
|
if ( ! this.get('edge') ) {
|
||||||
this.set( 'edge', 120 );
|
this.set( 'edge', 120 );
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! this.get('gutter') )
|
if ( ! this.get('gutter') ) {
|
||||||
this.set( 'gutter', 8 );
|
this.set( 'gutter', 8 );
|
||||||
|
}
|
||||||
|
|
||||||
this.resetDisplays();
|
this.resetDisplays();
|
||||||
},
|
},
|
||||||
@ -893,8 +896,9 @@
|
|||||||
var library = this.get('library'),
|
var library = this.get('library'),
|
||||||
edit = this.frame.state('gallery-edit').get('library');
|
edit = this.frame.state('gallery-edit').get('library');
|
||||||
|
|
||||||
if ( this.editLibrary && this.editLibrary !== edit )
|
if ( this.editLibrary && this.editLibrary !== edit ) {
|
||||||
library.unobserve( this.editLibrary );
|
library.unobserve( this.editLibrary );
|
||||||
|
}
|
||||||
|
|
||||||
// Accepts attachments that exist in the original library and
|
// Accepts attachments that exist in the original library and
|
||||||
// that do not exist in gallery's library.
|
// that do not exist in gallery's library.
|
||||||
@ -1137,8 +1141,9 @@
|
|||||||
if ( attributes.scanners.length ) {
|
if ( attributes.scanners.length ) {
|
||||||
scanners = attributes.scanners = $.when.apply( $, attributes.scanners );
|
scanners = attributes.scanners = $.when.apply( $, attributes.scanners );
|
||||||
scanners.always( function() {
|
scanners.always( function() {
|
||||||
if ( embed.get('scanners') === scanners )
|
if ( embed.get('scanners') === scanners ) {
|
||||||
embed.set( 'loading', false );
|
embed.set( 'loading', false );
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
attributes.scanners = null;
|
attributes.scanners = null;
|
||||||
@ -1829,10 +1834,11 @@
|
|||||||
text: l10n.cancelGalleryTitle,
|
text: l10n.cancelGalleryTitle,
|
||||||
priority: 20,
|
priority: 20,
|
||||||
click: function() {
|
click: function() {
|
||||||
if ( previous )
|
if ( previous ) {
|
||||||
frame.setState( previous );
|
frame.setState( previous );
|
||||||
else
|
} else {
|
||||||
frame.close();
|
frame.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
separateCancel: new media.View({
|
separateCancel: new media.View({
|
||||||
@ -2495,8 +2501,9 @@
|
|||||||
media.transition( $el ).done( function() {
|
media.transition( $el ).done( function() {
|
||||||
// Transition end events are subject to race conditions.
|
// Transition end events are subject to race conditions.
|
||||||
// Make sure that the value is set as intended.
|
// Make sure that the value is set as intended.
|
||||||
if ( '0' === $el.css('opacity') )
|
if ( '0' === $el.css('opacity') ) {
|
||||||
$el.hide();
|
$el.hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -3023,8 +3030,9 @@
|
|||||||
// value to the `model` and remove it from the `options object.
|
// value to the `model` and remove it from the `options object.
|
||||||
_.each( this.defaults, function( def, key ) {
|
_.each( this.defaults, function( def, key ) {
|
||||||
var value = this.options[ key ];
|
var value = this.options[ key ];
|
||||||
if ( _.isUndefined( value ) )
|
if ( _.isUndefined( value ) ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.model.set( key, value );
|
this.model.set( key, value );
|
||||||
delete this.options[ key ];
|
delete this.options[ key ];
|
||||||
@ -3491,8 +3499,9 @@
|
|||||||
options.buttons = this.buttons;
|
options.buttons = this.buttons;
|
||||||
options.describe = this.controller.state().get('describe');
|
options.describe = this.controller.state().get('describe');
|
||||||
|
|
||||||
if ( 'image' === options.type )
|
if ( 'image' === options.type ) {
|
||||||
options.size = this.imageSize();
|
options.size = this.imageSize();
|
||||||
|
}
|
||||||
|
|
||||||
options.can = {};
|
options.can = {};
|
||||||
if ( options.nonces ) {
|
if ( options.nonces ) {
|
||||||
@ -3500,17 +3509,19 @@
|
|||||||
options.can.save = !! options.nonces.update;
|
options.can.save = !! options.nonces.update;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this.controller.state().get('allowLocalEdits') )
|
if ( this.controller.state().get('allowLocalEdits') ) {
|
||||||
options.allowLocalEdits = true;
|
options.allowLocalEdits = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.views.detach();
|
this.views.detach();
|
||||||
this.$el.html( this.template( options ) );
|
this.$el.html( this.template( options ) );
|
||||||
|
|
||||||
this.$el.toggleClass( 'uploading', options.uploading );
|
this.$el.toggleClass( 'uploading', options.uploading );
|
||||||
if ( options.uploading )
|
if ( options.uploading ) {
|
||||||
this.$bar = this.$('.media-progress-bar div');
|
this.$bar = this.$('.media-progress-bar div');
|
||||||
else
|
} else {
|
||||||
delete this.$bar;
|
delete this.$bar;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the model is selected.
|
// Check if the model is selected.
|
||||||
this.updateSelect();
|
this.updateSelect();
|
||||||
@ -4034,8 +4045,9 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
refreshSortable: function() {
|
refreshSortable: function() {
|
||||||
if ( ! this.options.sortable || ! $.fn.sortable )
|
if ( ! this.options.sortable || ! $.fn.sortable ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If the `collection` has a `comparator`, disable sorting.
|
// If the `collection` has a `comparator`, disable sorting.
|
||||||
var collection = this.collection,
|
var collection = this.collection,
|
||||||
@ -4387,8 +4399,9 @@
|
|||||||
|
|
||||||
if ( ! this.collection.length ) {
|
if ( ! this.collection.length ) {
|
||||||
this.collection.more().done( function() {
|
this.collection.more().done( function() {
|
||||||
if ( ! view.collection.length )
|
if ( ! view.collection.length ) {
|
||||||
view.createUploader();
|
view.createUploader();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user