]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/media-views.js
WordPress 3.8.1-scripts
[autoinstalls/wordpress.git] / wp-includes / js / media-views.js
index a14a57b042ba3e581fc23032f7246ac124d0d5a0..3ac04c5608e4c1c4d60c8ca372de4ee131a283a2 100644 (file)
@@ -1,8 +1,8 @@
+/* global _wpMediaViewsL10n, confirm, getUserSetting, setUserSetting */
 (function($){
        var media       = wp.media,
                Attachment  = media.model.Attachment,
                Attachments = media.model.Attachments,
-               Query       = media.model.Query,
                l10n;
 
        // Link any localized strings.
                },
 
                trigger: function( event ) {
-                       var base;
+                       var base, args;
+
                        if ( ! this._mode )
                                return;
 
-                       var args = _.toArray( arguments );
+                       args = _.toArray( arguments );
                        base = this.id + ':' + event;
 
                        // Trigger `region:action:mode` event.
                },
 
                defaultDisplaySettings: function( attachment ) {
-                       settings = this._defaultDisplaySettings;
+                       var settings = this._defaultDisplaySettings;
                        if ( settings.canEmbed = this.canEmbed( attachment ) )
                                settings.link = 'embed';
                        return settings;
 
                recordSelection: function() {
                        var selection = this.get('selection'),
-                               manager = this.frame._selection,
-                               filtered;
+                               manager = this.frame._selection;
 
                        if ( ! this.get('syncSelection') || ! manager || ! selection )
                                return;
 
                        // Generate the tab states.
                        _.each( tabs, function( title, id ) {
-                               var frame = this.state( 'iframe:' + id ).set( _.defaults({
+                               this.state( 'iframe:' + id ).set( _.defaults({
                                        tab:     id,
                                        src:     tabUrl + '&tab=' + id,
                                        title:   title,
 
        // Map some of the modal's methods to the frame.
        _.each(['open','close','attach','detach','escape'], function( method ) {
-               media.view.MediaFrame.prototype[ method ] = function( view ) {
+               media.view.MediaFrame.prototype[ method ] = function() {
                        if ( this.modal )
                                this.modal[ method ].apply( this.modal, arguments );
                        return this;
                },
 
                createSelection: function() {
-                       var controller = this,
-                               selection = this.options.selection;
+                       var selection = this.options.selection;
 
                        if ( ! (selection instanceof media.model.Selection) ) {
                                this.options.selection = new media.model.Selection( selection, {
 
                progress: function() {
                        var queue = this.queue,
-                               $bar = this.$bar,
-                               memo = 0;
+                               $bar = this.$bar;
 
                        if ( ! $bar || ! queue.length )
                                return;
        // ----------------------------
        media.view.Toolbar.Select = media.view.Toolbar.extend({
                initialize: function() {
-                       var options = this.options,
-                               controller = options.controller,
-                               selection = controller.state().get('selection');
+                       var options = this.options;
 
                        _.bindAll( this, 'clickSelect' );
 
                                selection = this.options.selection,
                                model = this.model,
                                method = options && options.method,
-                               single, between, models, singleIndex, modelIndex;
+                               single, models, singleIndex, modelIndex;
 
                        if ( ! selection )
                                return;
 
                        this._viewsByCid = {};
 
-                       this.collection.on( 'add', function( attachment, attachments, options ) {
+                       this.collection.on( 'add', function( attachment ) {
                                this.views.add( this.createAttachmentView( attachment ), {
                                        at: this.collection.indexOf( attachment )
                                });
                        }, this );
 
-                       this.collection.on( 'remove', function( attachment, attachments, options ) {
+                       this.collection.on( 'remove', function( attachment ) {
                                var view = this._viewsByCid[ attachment.cid ];
                                delete this._viewsByCid[ attachment.cid ];
 
                        this.scroll();
                },
 
-               scroll: function( event ) {
+               scroll: function() {
                        // @todo: is this still necessary?
                        if ( ! this.$el.is(':visible') )
                                return;
                        this.filters = {};
                },
 
-               change: function( event ) {
+               change: function() {
                        var filter = this.filters[ this.el.value ];
 
                        if ( filter )
 
                createSingle: function() {
                        var sidebar = this.sidebar,
-                               single = this.options.selection.single(),
-                               views = {};
+                               single = this.options.selection.single();
 
                        sidebar.set( 'details', new media.view.Attachment.Details({
                                controller: this.controller,
                                setUserSetting( userSetting, value );
                },
 
-               updateChanges: function( model, options ) {
+               updateChanges: function( model ) {
                        if ( model.hasChanged() )
                                _( model.changed ).chain().keys().each( this.update, this );
                }
                                this.model.destroy();
                },
 
-               editAttachment: function( event ) {
+               editAttachment: function() {
                        this.$el.addClass('needs-refresh');
                },