Changeset 29312
- Timestamp:
- 07/27/2014 05:57:25 PM (10 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-grid.js
r29306 r29312 207 207 suggestedHeight: state.get('suggestedHeight'), 208 208 209 AttachmentView: state.get('AttachmentView') 209 AttachmentView: state.get('AttachmentView'), 210 211 scrollElement: document 210 212 }); 211 213 } -
trunk/src/wp-includes/js/media-views.js
r29299 r29312 5202 5202 cssTemplate: media.template('attachments-css'), 5203 5203 5204 events: {5205 'scroll': 'scroll'5206 },5207 5208 5204 initialize: function() { 5209 5205 this.el.id = _.uniqueId('__attachments-view-'); … … 5236 5232 this.collection.on( 'reset', this.render, this ); 5237 5233 5238 // Throttle the scroll handler .5234 // Throttle the scroll handler and bind this. 5239 5235 this.scroll = _.chain( this.scroll ).bind( this ).throttle( this.options.refreshSensitivity ).value(); 5236 5237 this.options.scrollElement = this.options.scrollElement || this.el; 5238 $( this.options.scrollElement ).on( 'scroll', this.scroll ); 5240 5239 5241 5240 this.initSortable(); … … 5407 5406 scroll: function() { 5408 5407 var view = this, 5408 el = this.options.scrollElement, 5409 scrollTop = el.scrollTop, 5409 5410 toolbar; 5410 5411 5411 if ( ! this.$el.is(':visible') || ! this.collection.hasMore() ) { 5412 // The scroll event occurs on the document, but the element 5413 // that should be checked is the document body. 5414 if ( el == document ) { 5415 el = document.body; 5416 scrollTop = $(document).scrollTop(); 5417 } 5418 5419 if ( ! $(el).is(':visible') || ! this.collection.hasMore() ) { 5412 5420 return; 5413 5421 } … … 5416 5424 5417 5425 // Show the spinner only if we are close to the bottom. 5418 if ( this.el.scrollHeight - ( this.el.scrollTop + this.el.clientHeight ) < this.el.clientHeight / 3 ) {5426 if ( el.scrollHeight - ( scrollTop + el.clientHeight ) < el.clientHeight / 3 ) { 5419 5427 toolbar.get('spinner').show(); 5420 5428 } 5421 5429 5422 if ( this.el.scrollHeight < this.el.scrollTop + ( this.el.clientHeight * this.options.refreshThreshold ) ) {5430 if ( el.scrollHeight < scrollTop + ( el.clientHeight * this.options.refreshThreshold ) ) { 5423 5431 this.collection.more().done(function() { 5424 5432 view.scroll(); … … 5860 5868 model: this.model, 5861 5869 sortable: this.options.sortable, 5870 scrollElement: this.options.scrollElement, 5862 5871 5863 5872 // The single `Attachment` view to be used in the `Attachments` view.
Note: See TracChangeset
for help on using the changeset viewer.