| 1 | Index: src/wp-includes/js/customize-views.js |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- src/wp-includes/js/customize-views.js (revision 39003) |
|---|
| 4 | +++ src/wp-includes/js/customize-views.js (working copy) |
|---|
| 5 | @@ -24,48 +24,10 @@ |
|---|
| 6 | |
|---|
| 7 | render: function() { |
|---|
| 8 | this.$el.html(this.template(this.model.toJSON())); |
|---|
| 9 | - this.setPlaceholder(); |
|---|
| 10 | this.setButtons(); |
|---|
| 11 | return this; |
|---|
| 12 | }, |
|---|
| 13 | |
|---|
| 14 | - getHeight: function() { |
|---|
| 15 | - var image = this.$el.find('img'), |
|---|
| 16 | - saved, height, headerImageData; |
|---|
| 17 | - |
|---|
| 18 | - if (image.length) { |
|---|
| 19 | - this.$el.find('.inner').hide(); |
|---|
| 20 | - } else { |
|---|
| 21 | - this.$el.find('.inner').show(); |
|---|
| 22 | - return 40; |
|---|
| 23 | - } |
|---|
| 24 | - |
|---|
| 25 | - saved = this.model.get('savedHeight'); |
|---|
| 26 | - height = image.height() || saved; |
|---|
| 27 | - |
|---|
| 28 | - // happens at ready |
|---|
| 29 | - if (!height) { |
|---|
| 30 | - headerImageData = api.get().header_image_data; |
|---|
| 31 | - |
|---|
| 32 | - if (headerImageData && headerImageData.width && headerImageData.height) { |
|---|
| 33 | - // hardcoded container width |
|---|
| 34 | - height = 260 / headerImageData.width * headerImageData.height; |
|---|
| 35 | - } |
|---|
| 36 | - else { |
|---|
| 37 | - // fallback for when no image is set |
|---|
| 38 | - height = 40; |
|---|
| 39 | - } |
|---|
| 40 | - } |
|---|
| 41 | - |
|---|
| 42 | - return height; |
|---|
| 43 | - }, |
|---|
| 44 | - |
|---|
| 45 | - setPlaceholder: function(_height) { |
|---|
| 46 | - var height = _height || this.getHeight(); |
|---|
| 47 | - this.model.set('savedHeight', height); |
|---|
| 48 | - this.$el.height(height); |
|---|
| 49 | - }, |
|---|
| 50 | - |
|---|
| 51 | setButtons: function() { |
|---|
| 52 | var elements = $('#customize-control-header_image .actions .remove'); |
|---|
| 53 | if (this.model.get('choice')) { |
|---|
| 54 | @@ -132,10 +94,6 @@ |
|---|
| 55 | }); |
|---|
| 56 | }, |
|---|
| 57 | |
|---|
| 58 | - getHeight: api.HeaderTool.CurrentView.prototype.getHeight, |
|---|
| 59 | - |
|---|
| 60 | - setPlaceholder: api.HeaderTool.CurrentView.prototype.setPlaceholder, |
|---|
| 61 | - |
|---|
| 62 | select: function() { |
|---|
| 63 | this.preventJump(); |
|---|
| 64 | this.model.save(); |
|---|