Fix JSHint errors in media-views.js.

props kadamwhite.
fixes #25974.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-11-14 05:54:10 +00:00
parent a749e31b75
commit a5d83b489b
2 changed files with 20 additions and 25 deletions

View File

@ -1,8 +1,8 @@
/* global _wpMediaViewsL10n, confirm, getUserSetting, setUserSetting */
(function($){ (function($){
var media = wp.media, var media = wp.media,
Attachment = media.model.Attachment, Attachment = media.model.Attachment,
Attachments = media.model.Attachments, Attachments = media.model.Attachments,
Query = media.model.Query,
l10n; l10n;
// Link any localized strings. // Link any localized strings.
@ -118,11 +118,12 @@
}, },
trigger: function( event ) { trigger: function( event ) {
var base; var base, args;
if ( ! this._mode ) if ( ! this._mode )
return; return;
var args = _.toArray( arguments ); args = _.toArray( arguments );
base = this.id + ':' + event; base = this.id + ':' + event;
// Trigger `region:action:mode` event. // Trigger `region:action:mode` event.
@ -455,7 +456,7 @@
}, },
defaultDisplaySettings: function( attachment ) { defaultDisplaySettings: function( attachment ) {
settings = this._defaultDisplaySettings; var settings = this._defaultDisplaySettings;
if ( settings.canEmbed = this.canEmbed( attachment ) ) if ( settings.canEmbed = this.canEmbed( attachment ) )
settings.link = 'embed'; settings.link = 'embed';
return settings; return settings;
@ -495,8 +496,7 @@
recordSelection: function() { recordSelection: function() {
var selection = this.get('selection'), var selection = this.get('selection'),
manager = this.frame._selection, manager = this.frame._selection;
filtered;
if ( ! this.get('syncSelection') || ! manager || ! selection ) if ( ! this.get('syncSelection') || ! manager || ! selection )
return; return;
@ -1059,7 +1059,7 @@
// Generate the tab states. // Generate the tab states.
_.each( tabs, function( title, id ) { _.each( tabs, function( title, id ) {
var frame = this.state( 'iframe:' + id ).set( _.defaults({ this.state( 'iframe:' + id ).set( _.defaults({
tab: id, tab: id,
src: tabUrl + '&tab=' + id, src: tabUrl + '&tab=' + id,
title: title, title: title,
@ -1123,7 +1123,7 @@
// Map some of the modal's methods to the frame. // Map some of the modal's methods to the frame.
_.each(['open','close','attach','detach','escape'], function( method ) { _.each(['open','close','attach','detach','escape'], function( method ) {
media.view.MediaFrame.prototype[ method ] = function( view ) { media.view.MediaFrame.prototype[ method ] = function() {
if ( this.modal ) if ( this.modal )
this.modal[ method ].apply( this.modal, arguments ); this.modal[ method ].apply( this.modal, arguments );
return this; return this;
@ -1150,8 +1150,7 @@
}, },
createSelection: function() { createSelection: function() {
var controller = this, var selection = this.options.selection;
selection = this.options.selection;
if ( ! (selection instanceof media.model.Selection) ) { if ( ! (selection instanceof media.model.Selection) ) {
this.options.selection = new media.model.Selection( selection, { this.options.selection = new media.model.Selection( selection, {
@ -1931,8 +1930,7 @@
progress: function() { progress: function() {
var queue = this.queue, var queue = this.queue,
$bar = this.$bar, $bar = this.$bar;
memo = 0;
if ( ! $bar || ! queue.length ) if ( ! $bar || ! queue.length )
return; return;
@ -2111,9 +2109,7 @@
// ---------------------------- // ----------------------------
media.view.Toolbar.Select = media.view.Toolbar.extend({ media.view.Toolbar.Select = media.view.Toolbar.extend({
initialize: function() { initialize: function() {
var options = this.options, var options = this.options;
controller = options.controller,
selection = controller.state().get('selection');
_.bindAll( this, 'clickSelect' ); _.bindAll( this, 'clickSelect' );
@ -2618,7 +2614,7 @@
selection = this.options.selection, selection = this.options.selection,
model = this.model, model = this.model,
method = options && options.method, method = options && options.method,
single, between, models, singleIndex, modelIndex; single, models, singleIndex, modelIndex;
if ( ! selection ) if ( ! selection )
return; return;
@ -2899,13 +2895,13 @@
this._viewsByCid = {}; this._viewsByCid = {};
this.collection.on( 'add', function( attachment, attachments, options ) { this.collection.on( 'add', function( attachment ) {
this.views.add( this.createAttachmentView( attachment ), { this.views.add( this.createAttachmentView( attachment ), {
at: this.collection.indexOf( attachment ) at: this.collection.indexOf( attachment )
}); });
}, this ); }, this );
this.collection.on( 'remove', function( attachment, attachments, options ) { this.collection.on( 'remove', function( attachment ) {
var view = this._viewsByCid[ attachment.cid ]; var view = this._viewsByCid[ attachment.cid ];
delete this._viewsByCid[ attachment.cid ]; delete this._viewsByCid[ attachment.cid ];
@ -3066,7 +3062,7 @@
this.scroll(); this.scroll();
}, },
scroll: function( event ) { scroll: function() {
// @todo: is this still necessary? // @todo: is this still necessary?
if ( ! this.$el.is(':visible') ) if ( ! this.$el.is(':visible') )
return; return;
@ -3149,7 +3145,7 @@
this.filters = {}; this.filters = {};
}, },
change: function( event ) { change: function() {
var filter = this.filters[ this.el.value ]; var filter = this.filters[ this.el.value ];
if ( filter ) if ( filter )
@ -3396,8 +3392,7 @@
createSingle: function() { createSingle: function() {
var sidebar = this.sidebar, var sidebar = this.sidebar,
single = this.options.selection.single(), single = this.options.selection.single();
views = {};
sidebar.set( 'details', new media.view.Attachment.Details({ sidebar.set( 'details', new media.view.Attachment.Details({
controller: this.controller, controller: this.controller,
@ -3630,7 +3625,7 @@
setUserSetting( userSetting, value ); setUserSetting( userSetting, value );
}, },
updateChanges: function( model, options ) { updateChanges: function( model ) {
if ( model.hasChanged() ) if ( model.hasChanged() )
_( model.changed ).chain().keys().each( this.update, this ); _( model.changed ).chain().keys().each( this.update, this );
} }
@ -3756,7 +3751,7 @@
this.model.destroy(); this.model.destroy();
}, },
editAttachment: function( event ) { editAttachment: function() {
this.$el.addClass('needs-refresh'); this.$el.addClass('needs-refresh');
}, },

File diff suppressed because one or more lines are too long