Changeset 23110
- Timestamp:
- 12/06/2012 11:12:59 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/css/media-views.css
r23095 r23110 1250 1250 * Spinner 1251 1251 */ 1252 1253 .media-frame .spinner { 1254 background: url(../images/wpspin.gif) no-repeat; 1255 background-size: 16px 16px; 1256 display: none; 1257 opacity: 0.7; 1258 filter: alpha(opacity=70); 1259 width: 16px; 1260 height: 16px; 1261 margin: 0; 1262 } 1263 1252 1264 .media-sidebar .settings-save-status { 1253 1265 background: #f5f5f5; … … 1258 1270 1259 1271 .media-sidebar .settings-save-status .spinner { 1260 background: url(../images/wpspin.gif) no-repeat;1261 background-size: 16px 16px;1262 display: none;1263 float: right;1264 opacity: 0.7;1265 filter: alpha(opacity=70);1266 width: 16px;1267 height: 16px;1268 1272 margin: 0 5px 0; 1269 1273 } … … 1398 1402 display: block; 1399 1403 position: relative; 1400 height: 40px; 1401 padding: 0 16px 16px; 1404 padding: 0 16px 7px; 1402 1405 margin: 0; 1403 1406 z-index: 250; … … 1417 1420 } 1418 1421 1422 .media-frame .embed-url .spinner { 1423 position: absolute; 1424 top: 16px; 1425 right: 26px; 1426 } 1427 1428 .media-frame .embed-loading .embed-url .spinner { 1429 display: block; 1430 } 1431 1419 1432 .embed-link-settings, 1420 1433 .embed-image-settings { … … 1438 1451 .media-embed .thumbnail img { 1439 1452 max-height: 200px; 1453 display: block; 1440 1454 } 1441 1455 … … 1653 1667 } 1654 1668 1655 .media- sidebar .settings-save-status.spinner {1669 .media-frame .spinner { 1656 1670 background-image: url(../images/wpspin-2x.gif); 1657 1671 } -
trunk/wp-includes/js/autosave.js
r22794 r23110 231 231 setTimeout(function(){ 232 232 jQuery(':button, :submit', '#submitpost').removeAttr('disabled'); 233 jQuery('.spinner' ).hide();233 jQuery('.spinner', '#submitpost').hide(); 234 234 }, 500); 235 235 } -
trunk/wp-includes/js/media-views.js
r23098 r23110 779 779 780 780 scan: function() { 781 var attributes = { type: 'link' }; 782 783 this.trigger( 'scan', attributes ); 781 var scanners, 782 embed = this, 783 attributes = { 784 type: 'link', 785 scanners: [] 786 }; 787 788 // Scan is triggered with the list of `attributes` to set on the 789 // state, useful for the 'type' attribute and 'scanners' attribute, 790 // an array of promise objects for asynchronous scan operations. 791 if ( this.props.get('url') ) 792 this.trigger( 'scan', attributes ); 793 794 if ( attributes.scanners.length ) { 795 scanners = attributes.scanners = $.when.apply( $, attributes.scanners ); 796 scanners.always( function() { 797 if ( embed.get('scanners') === scanners ) 798 embed.set( 'loading', false ); 799 }); 800 } else { 801 attributes.scanners = null; 802 } 803 804 attributes.loading = !! attributes.scanners; 784 805 this.set( attributes ); 785 806 }, … … 789 810 state = this, 790 811 url = this.props.get('url'), 791 image = new Image(); 812 image = new Image(), 813 deferred = $.Deferred(); 814 815 attributes.scanners.push( deferred.promise() ); 792 816 793 817 // Try to load the image and find its width/height. 794 818 image.onload = function() { 819 deferred.resolve(); 820 795 821 if ( state !== frame.state() || url !== state.props.get('url') ) 796 822 return; 797 823 798 824 state.set({ 799 type: 'image', 825 type: 'image' 826 }); 827 828 state.props.set({ 800 829 width: image.width, 801 830 height: image.height … … 803 832 }; 804 833 834 image.onerror = deferred.reject; 805 835 image.src = url; 806 807 // Check if the URL looks like an image; skew toward success.808 url = url.replace( /([?|#].*)$/, '' );809 if ( /\.(png|jpe?g|gif)$/i.test( url ) )810 attributes.type = 'image';811 836 }, 812 837 … … 4148 4173 this.refresh(); 4149 4174 this.model.on( 'change:type', this.refresh, this ); 4175 this.model.on( 'change:loading', this.loading, this ); 4150 4176 }, 4151 4177 … … 4173 4199 priority: 40 4174 4200 }) ); 4201 }, 4202 4203 loading: function() { 4204 this.$el.toggleClass( 'embed-loading', this.model.get('loading') ); 4175 4205 } 4176 4206 }); … … 4195 4225 }); 4196 4226 4227 this.spinner = this.make( 'span', { 4228 'class': 'spinner' 4229 }); 4230 4197 4231 this.$input = $( this.input ); 4198 this.$el.append( this.input);4232 this.$el.append([ this.input, this.spinner ]); 4199 4233 4200 4234 this.model.on( 'change:url', this.render, this );
Note: See TracChangeset
for help on using the changeset viewer.