Changeset 40082
- Timestamp:
- 02/20/2017 12:09:37 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/customize-views.js
r36639 r40082 25 25 render: function() { 26 26 this.$el.html(this.template(this.model.toJSON())); 27 this.setPlaceholder();28 27 this.setButtons(); 29 28 return this; 30 },31 32 getHeight: function() {33 var image = this.$el.find('img'),34 saved, height, headerImageData;35 36 if (image.length) {37 this.$el.find('.inner').hide();38 } else {39 this.$el.find('.inner').show();40 return 40;41 }42 43 saved = this.model.get('savedHeight');44 height = image.height() || saved;45 46 // happens at ready47 if (!height) {48 headerImageData = api.get().header_image_data;49 50 if (headerImageData && headerImageData.width && headerImageData.height) {51 // hardcoded container width52 height = 260 / headerImageData.width * headerImageData.height;53 }54 else {55 // fallback for when no image is set56 height = 40;57 }58 }59 60 return height;61 },62 63 setPlaceholder: function(_height) {64 var height = _height || this.getHeight();65 this.model.set('savedHeight', height);66 this.$el.height(height);67 29 }, 68 30 … … 132 94 }); 133 95 }, 134 135 getHeight: api.HeaderTool.CurrentView.prototype.getHeight,136 137 setPlaceholder: api.HeaderTool.CurrentView.prototype.setPlaceholder,138 96 139 97 select: function() {
Note: See TracChangeset
for help on using the changeset viewer.