diff --git a/src/wp-admin/css/customize-controls.css b/src/wp-admin/css/customize-controls.css
index f9ca1d7..e0c9974 100644
|
a
|
b
|
body { |
| 465 | 465 | margin-bottom: 18px; |
| 466 | 466 | } |
| 467 | 467 | |
| | 468 | #customize-control-header_image .uploaded button, |
| | 469 | #customize-control-header_image .default button { |
| | 470 | width: 100%; |
| | 471 | padding: 0; |
| | 472 | margin: 0; |
| | 473 | background: none; |
| | 474 | border: none; |
| | 475 | color: inherit; |
| | 476 | cursor: pointer; |
| | 477 | } |
| | 478 | |
| 468 | 479 | /* Header control: current image container */ |
| 469 | 480 | |
| 470 | 481 | #customize-control-header_image .current .container { |
| 471 | 482 | overflow: hidden; |
| 472 | 483 | -webkit-border-radius: 2px; |
| | 484 | border: 1px solid #eee; |
| 473 | 485 | border-radius: 2px; |
| 474 | 486 | } |
| 475 | 487 | |
| 476 | 488 | #customize-control-header_image .placeholder { |
| 477 | 489 | width: 100%; |
| 478 | 490 | position: relative; |
| 479 | | background: #262626; |
| 480 | 491 | text-align: center; |
| 481 | 492 | cursor: default; |
| 482 | 493 | } |
| … |
… |
body { |
| 485 | 496 | display: none; |
| 486 | 497 | position: absolute; |
| 487 | 498 | width: 100%; |
| 488 | | height: 18px; |
| 489 | | margin-top: -9px; |
| 490 | | top: 50%; |
| 491 | | color: #eee; |
| | 499 | color: #555; |
| | 500 | white-space: nowrap; |
| | 501 | text-overflow: ellipsis; |
| | 502 | overflow: hidden; |
| | 503 | } |
| | 504 | |
| | 505 | #customize-control-header_image .inner, |
| | 506 | #customize-control-header_image .inner .dashicons { |
| | 507 | line-height: 20px; |
| | 508 | top: 10px; |
| | 509 | } |
| | 510 | #customize-control-header_image .list .inner, |
| | 511 | #customize-control-header_image .list .inner .dashicons { |
| | 512 | top: 8px; |
| | 513 | } |
| | 514 | #customize-control-header_image .selected .inner, |
| | 515 | #customize-control-header_image .selected .inner .dashicons { |
| | 516 | top: 6px; |
| 492 | 517 | } |
| 493 | 518 | |
| 494 | 519 | /* Header control: overlay "close" button */ |
| 495 | 520 | |
| 496 | 521 | #customize-control-header_image .header-view { |
| 497 | 522 | position: relative; |
| | 523 | width: 100%; |
| | 524 | } |
| | 525 | |
| | 526 | #customize-control-header_image .header-view.selected img, |
| | 527 | #customize-control-header_image .header-view.button.selected { |
| | 528 | border: 4px solid #2ea2cc; |
| | 529 | box-sizing: border-box; |
| 498 | 530 | } |
| 499 | 531 | |
| 500 | 532 | #customize-control-header_image .uploaded .header-view .close { |
| … |
… |
body { |
| 575 | 607 | margin-bottom: 9px; |
| 576 | 608 | } |
| 577 | 609 | |
| 578 | | #customize-control-header_image .choice.random:before { |
| 579 | | position: absolute; |
| 580 | | content: attr(data-label); |
| 581 | | left: 0; |
| 582 | | top: 0; |
| 583 | | } |
| 584 | | |
| 585 | 610 | #customize-control-header_image .uploaded div:last-child > .choice { |
| 586 | 611 | margin-bottom: 0; |
| 587 | 612 | } |
| 588 | 613 | |
| 589 | | #customize-control-header_image .choices hr { |
| 590 | | visibility: hidden; |
| 591 | | } |
| 592 | | |
| 593 | 614 | #customize-control-header_image img { |
| 594 | 615 | width: 100%; |
| 595 | 616 | -webkit-border-radius: 2px; |
diff --git a/src/wp-admin/custom-header.php b/src/wp-admin/custom-header.php
index 4a2d44c..2a6a2f3 100644
|
a
|
b
|
wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> |
| 1272 | 1272 | public function get_uploaded_header_images() { |
| 1273 | 1273 | $header_images = get_uploaded_header_images(); |
| 1274 | 1274 | $timestamp_key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); |
| | 1275 | $alt_text_key = '_wp_attachment_image_alt'; |
| 1275 | 1276 | |
| 1276 | 1277 | foreach ( $header_images as &$header_image ) { |
| 1277 | | $header_image['timestamp'] = get_post_meta( $header_image['attachment_id'], $timestamp_key, true ); |
| | 1278 | $header_meta = get_post_meta( $header_image['attachment_id'] ); |
| | 1279 | $header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : ''; |
| | 1280 | $header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : ''; |
| 1278 | 1281 | } |
| 1279 | 1282 | |
| 1280 | 1283 | return $header_images; |
diff --git a/src/wp-includes/class-wp-customize-control.php b/src/wp-includes/class-wp-customize-control.php
index e55a759..0b732c6 100644
|
a
|
b
|
final class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control |
| 774 | 774 | |
| 775 | 775 | <div class="placeholder random"> |
| 776 | 776 | <div class="inner"> |
| 777 | | <span><span class="dashicons dashicons-randomize dice"></span> |
| | 777 | <button type="button"><span class="dashicons dashicons-randomize dice"></span> |
| 778 | 778 | <# if ( data.type === 'uploaded' ) { #> |
| 779 | 779 | <?php _e( 'Randomize uploaded headers' ); ?> |
| 780 | 780 | <# } else if ( data.type === 'default' ) { #> |
| 781 | 781 | <?php _e( 'Randomize suggested headers' ); ?> |
| 782 | 782 | <# } #> |
| 783 | | </span> |
| | 783 | </button> |
| 784 | 784 | </div> |
| 785 | 785 | </div> |
| 786 | 786 | |
| 787 | 787 | <# } else { #> |
| 788 | 788 | |
| 789 | 789 | <# if (data.type === 'uploaded') { #> |
| 790 | | <div class="dashicons dashicons-no close"></div> |
| | 790 | <div class="dashicons dashicons-no close"></div> |
| 791 | 791 | <# } #> |
| 792 | 792 | |
| 793 | | <a href="#" class="choice thumbnail #>" |
| | 793 | <button type="button" class="choice thumbnail" |
| 794 | 794 | data-customize-image-value="{{{data.header.url}}}" |
| 795 | 795 | data-customize-header-image-data="{{JSON.stringify(data.header)}}"> |
| 796 | | <img src="{{{data.header.thumbnail_url}}}"> |
| 797 | | </a> |
| | 796 | <span class="screen-reader-text"><?php _e( 'Set image' ); ?></span> |
| | 797 | <img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}"> |
| | 798 | </button> |
| 798 | 799 | |
| 799 | 800 | <# } #> |
| 800 | 801 | </script> |
| … |
… |
final class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control |
| 875 | 876 | </div> |
| 876 | 877 | <div class="actions"> |
| 877 | 878 | <?php /* translators: Hide as in hide header image via the Customizer */ ?> |
| 878 | | <a href="#" <?php echo $visibility ?> class="button remove"><?php _ex( 'Hide', 'custom header' ); ?></a> |
| | 879 | <button type="button"<?php echo $visibility ?> class="button remove"><?php _ex( 'Hide image', 'custom header' ); ?></button> |
| 879 | 880 | <?php /* translators: New as in add new header image via the Customizer */ ?> |
| 880 | | <a href="#" class="button new"><?php _ex( 'Add new', 'header image' ); ?></a> |
| | 881 | <button type="button" class="button new"><?php _ex( 'Add new image', 'header image' ); ?></button> |
| 881 | 882 | <div style="clear:both"></div> |
| 882 | 883 | </div> |
| 883 | 884 | <div class="choices"> |
diff --git a/src/wp-includes/js/customize-models.js b/src/wp-includes/js/customize-models.js
index f97750b..cc7ebd6 100644
|
a
|
b
|
|
| 26 | 26 | thumbnail_url: '' |
| 27 | 27 | }, |
| 28 | 28 | choice: '', |
| 29 | | hidden: false, |
| | 29 | selected: false, |
| 30 | 30 | random: false |
| 31 | 31 | }; |
| 32 | 32 | }, |
| … |
… |
|
| 160 | 160 | elt.defaultName = index; |
| 161 | 161 | } |
| 162 | 162 | |
| | 163 | if (typeof elt.timestamp === 'undefined') { |
| | 164 | elt.timestamp = 0; |
| | 165 | } |
| | 166 | |
| 163 | 167 | this.add({ |
| 164 | 168 | header: elt, |
| 165 | 169 | choice: elt.url.split('/').pop(), |
| 166 | | hidden: current === elt.url.replace(/^https?:\/\//, '') |
| | 170 | selected: current === elt.url.replace(/^https?:\/\//, '') |
| 167 | 171 | }, { silent: true }); |
| 168 | 172 | }, this); |
| 169 | 173 | |
| … |
… |
|
| 191 | 195 | }, |
| 192 | 196 | choice: randomChoice, |
| 193 | 197 | random: true, |
| 194 | | hidden: isRandomSameType |
| | 198 | selected: isRandomSameType |
| 195 | 199 | }); |
| 196 | 200 | }, |
| 197 | 201 | |
| … |
… |
|
| 200 | 204 | }, |
| 201 | 205 | |
| 202 | 206 | shouldHideTitle: function() { |
| 203 | | return _.every(this.pluck('hidden')); |
| | 207 | return this.size() < 2; |
| 204 | 208 | }, |
| 205 | 209 | |
| 206 | 210 | setImage: function(model) { |
| 207 | 211 | this.each(function(m) { |
| 208 | | m.set('hidden', false); |
| | 212 | m.set('selected', false); |
| 209 | 213 | }); |
| 210 | 214 | |
| 211 | 215 | if (model) { |
| 212 | | model.set('hidden', true); |
| | 216 | model.set('selected', true); |
| 213 | 217 | // Bump images to top except for special "Randomize" images |
| 214 | 218 | if (!model.get('random')) { |
| 215 | 219 | model.get('header').timestamp = _.now(); |
| … |
… |
|
| 220 | 224 | |
| 221 | 225 | removeImage: function() { |
| 222 | 226 | this.each(function(m) { |
| 223 | | m.set('hidden', false); |
| | 227 | m.set('selected', false); |
| 224 | 228 | }); |
| 225 | | }, |
| 226 | | |
| 227 | | shown: function() { |
| 228 | | var filtered = this.where({ hidden: false }); |
| 229 | | return new api.HeaderTool.ChoiceList( filtered ); |
| 230 | 229 | } |
| 231 | 230 | }); |
| 232 | 231 | |
diff --git a/src/wp-includes/js/customize-views.js b/src/wp-includes/js/customize-views.js
index eb3d4aa..39ad65b 100644
|
a
|
b
|
|
| 32 | 32 | |
| 33 | 33 | getHeight: function() { |
| 34 | 34 | var image = this.$el.find('img'), |
| 35 | | saved = this.model.get('savedHeight'), |
| 36 | | height = image.height() || saved, |
| 37 | | headerImageData; |
| | 35 | saved, height, headerImageData; |
| 38 | 36 | |
| 39 | 37 | if (image.length) { |
| 40 | 38 | this.$el.find('.inner').hide(); |
| 41 | 39 | } else { |
| 42 | 40 | this.$el.find('.inner').show(); |
| | 41 | return 40; |
| 43 | 42 | } |
| 44 | 43 | |
| | 44 | saved = this.model.get('savedHeight'); |
| | 45 | height = image.height() || saved; |
| | 46 | |
| 45 | 47 | // happens at ready |
| 46 | 48 | if (!height) { |
| 47 | 49 | headerImageData = api.get().header_image_data; |
| … |
… |
|
| 92 | 94 | * @constructor |
| 93 | 95 | * @augments wp.Backbone.View |
| 94 | 96 | */ |
| 95 | | (function () { // closures FTW |
| 96 | | var lastHeight = 0; |
| 97 | 97 | api.HeaderTool.ChoiceView = wp.Backbone.View.extend({ |
| 98 | 98 | template: wp.template('header-choice'), |
| 99 | 99 | |
| … |
… |
|
| 110 | 110 | this.model.get('choice') |
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | | this.listenTo(this.model, 'change', this.render); |
| | 113 | this.listenTo(this.model, 'change:selected', this.toggleSelected); |
| 114 | 114 | |
| 115 | 115 | if (_.contains(properties, api.get().header_image)) { |
| 116 | 116 | api.HeaderTool.currentHeader.set(this.extendedModel()); |
| … |
… |
|
| 118 | 118 | }, |
| 119 | 119 | |
| 120 | 120 | render: function() { |
| 121 | | var model = this.model; |
| 122 | | |
| 123 | 121 | this.$el.html(this.template(this.extendedModel())); |
| 124 | 122 | |
| 125 | | if (model.get('random')) { |
| | 123 | if (this.model.get('random')) { |
| | 124 | this.$el.addClass('button display-options'); |
| 126 | 125 | this.setPlaceholder(40); |
| 127 | 126 | } |
| 128 | | else { |
| 129 | | lastHeight = this.getHeight(); |
| 130 | | } |
| 131 | 127 | |
| 132 | | this.$el.toggleClass('hidden', model.get('hidden')); |
| | 128 | this.toggleSelected(); |
| 133 | 129 | return this; |
| 134 | 130 | }, |
| 135 | 131 | |
| | 132 | toggleSelected: function() { |
| | 133 | this.$el.toggleClass('selected', this.model.get('selected')); |
| | 134 | }, |
| | 135 | |
| 136 | 136 | extendedModel: function() { |
| 137 | 137 | var c = this.model.get('collection'); |
| 138 | 138 | return _.extend(this.model.toJSON(), { |
| … |
… |
|
| 145 | 145 | setPlaceholder: api.HeaderTool.CurrentView.prototype.setPlaceholder, |
| 146 | 146 | |
| 147 | 147 | select: function() { |
| | 148 | this.preventJump(); |
| 148 | 149 | this.model.save(); |
| 149 | 150 | api.HeaderTool.currentHeader.set(this.extendedModel()); |
| 150 | 151 | }, |
| 151 | 152 | |
| | 153 | preventJump: function() { |
| | 154 | var container = $('.wp-full-overlay-sidebar-content'), |
| | 155 | scroll = container.scrollTop(); |
| | 156 | |
| | 157 | _.defer(function() { |
| | 158 | container.scrollTop(scroll); |
| | 159 | }); |
| | 160 | }, |
| | 161 | |
| 152 | 162 | removeImage: function(e) { |
| 153 | 163 | e.stopPropagation(); |
| 154 | 164 | this.model.destroy(); |
| 155 | 165 | this.remove(); |
| 156 | 166 | } |
| 157 | 167 | }); |
| 158 | | })(); |
| 159 | 168 | |
| 160 | 169 | |
| 161 | 170 | /** |
| … |
… |
|
| 174 | 183 | this.listenTo(this.collection, 'add', this.addOne); |
| 175 | 184 | this.listenTo(this.collection, 'remove', this.render); |
| 176 | 185 | this.listenTo(this.collection, 'sort', this.render); |
| 177 | | this.listenTo(this.collection, 'change:hidden', this.toggleTitle); |
| 178 | | this.listenTo(this.collection, 'change:hidden', this.setMaxListHeight); |
| | 186 | this.listenTo(this.collection, 'change', this.toggleList); |
| 179 | 187 | this.render(); |
| 180 | 188 | }, |
| 181 | 189 | |
| 182 | 190 | render: function() { |
| 183 | 191 | this.$el.empty(); |
| 184 | 192 | this.collection.each(this.addOne, this); |
| 185 | | this.toggleTitle(); |
| | 193 | this.toggleList(); |
| 186 | 194 | }, |
| 187 | 195 | |
| 188 | 196 | addOne: function(choice) { |
| … |
… |
|
| 192 | 200 | this.$el.append(view.render().el); |
| 193 | 201 | }, |
| 194 | 202 | |
| 195 | | toggleTitle: function() { |
| 196 | | var title = this.$el.parents().prev('.customize-control-title'); |
| | 203 | toggleList: function() { |
| | 204 | var title = this.$el.parents().prev('.customize-control-title'), |
| | 205 | randomButton = this.$el.find('.random').parent(); |
| 197 | 206 | if (this.collection.shouldHideTitle()) { |
| 198 | | title.hide(); |
| | 207 | title.add(randomButton).hide(); |
| 199 | 208 | } else { |
| 200 | | title.show(); |
| | 209 | title.add(randomButton).show(); |
| 201 | 210 | } |
| 202 | 211 | } |
| 203 | 212 | }); |
diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index f66fd95..10bc026 100644
|
a
|
b
|
function wp_customize_support_script() { |
| 1918 | 1918 | }()); |
| 1919 | 1919 | </script> |
| 1920 | 1920 | <?php |
| 1921 | | } |
| 1922 | | No newline at end of file |
| | 1921 | } |