Ticket #22796: 22796.2.diff
File 22796.2.diff, 4.9 KB (added by , 12 years ago) |
---|
-
wp-includes/css/media-views.css
1249 1249 /** 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; 1254 1266 float: right; … … 1257 1269 } 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 } 1270 1274 … … 1397 1401 .embed-url { 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; 1404 1407 background: #fff; … … 1416 1419 box-shadow: inset 2px 2px 4px -2px rgba( 0, 0, 0, 0.1 ); 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 { 1421 1434 position: absolute; … … 1437 1450 1438 1451 .media-embed .thumbnail img { 1439 1452 max-height: 200px; 1453 display: block; 1440 1454 } 1441 1455 1442 1456 .media-embed .thumbnail:after { … … 1652 1666 background-size: 134px 15px; 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 } 1658 1672 } 1673 No newline at end of file -
wp-includes/js/autosave.js
230 230 // delay that a bit to avoid some rare collisions while the DOM is being updated. 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 } 236 236 -
wp-includes/js/media-views.js
778 778 }, 779 779 780 780 scan: function() { 781 var attributes = { type: 'link' }; 781 var scanners, 782 embed = this, 783 attributes = { 784 type: 'link', 785 scanners: [] 786 }; 782 787 783 this.trigger( 'scan', attributes ); 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 }, 786 807 … … 788 809 var frame = this.frame, 789 810 state = this, 790 811 url = this.props.get('url'), 791 image = new Image(); 812 image = new Image(), 813 deferred = $.Deferred(); 792 814 815 attributes.scanners.push( deferred.promise() ); 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 802 831 }); 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 813 838 refresh: function() { … … 4147 4172 this.views.set([ this.url ]); 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 4152 4178 settings: function( view ) { … … 4172 4198 model: this.model.props, 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 }); 4177 4207 … … 4194 4224 value: this.model.get('url') || '' 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 ); 4201 4235 },