<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27947] trunk/src: Header images: Accessibility and style improvements.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27947">27947</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2014-04-04 15:48:34 +0000 (Fri, 04 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Header images: Accessibility and style improvements. Headers no longer jump around when chosen.
props mcsf, ehg.
see <a href="http://core.trac.wordpress.org/ticket/21785">#21785</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsscustomizecontrolscss">trunk/src/wp-admin/css/customize-controls.css</a></li>
<li><a href="#trunksrcwpadmincustomheaderphp">trunk/src/wp-admin/custom-header.php</a></li>
<li><a href="#trunksrcwpincludesclasswpcustomizecontrolphp">trunk/src/wp-includes/class-wp-customize-control.php</a></li>
<li><a href="#trunksrcwpincludesjscustomizemodelsjs">trunk/src/wp-includes/js/customize-models.js</a></li>
<li><a href="#trunksrcwpincludesjscustomizeviewsjs">trunk/src/wp-includes/js/customize-views.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsscustomizecontrolscss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/customize-controls.css (27946 => 27947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/customize-controls.css 2014-04-04 15:47:43 UTC (rev 27946)
+++ trunk/src/wp-admin/css/customize-controls.css 2014-04-04 15:48:34 UTC (rev 27947)
</span><span class="lines">@@ -465,18 +465,34 @@
</span><span class="cx"> margin-bottom: 18px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#customize-control-header_image .uploaded button,
+#customize-control-header_image .default button {
+ width: 100%;
+ padding: 0;
+ margin: 0;
+ background: none;
+ border: none;
+ color: inherit;
+ cursor: pointer;
+ outline: none;
+}
+
+#customize-control-header_image button img {
+ display: block;
+}
+
</ins><span class="cx"> /* Header control: current image container */
</span><span class="cx">
</span><span class="cx"> #customize-control-header_image .current .container {
</span><span class="cx"> overflow: hidden;
</span><span class="cx"> -webkit-border-radius: 2px;
</span><ins>+ border: 1px solid #eee;
</ins><span class="cx"> border-radius: 2px;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #customize-control-header_image .placeholder {
</span><span class="cx"> width: 100%;
</span><span class="cx"> position: relative;
</span><del>- background: #262626;
</del><span class="cx"> text-align: center;
</span><span class="cx"> cursor: default;
</span><span class="cx"> }
</span><span class="lines">@@ -485,18 +501,49 @@
</span><span class="cx"> display: none;
</span><span class="cx"> position: absolute;
</span><span class="cx"> width: 100%;
</span><del>- height: 18px;
- margin-top: -9px;
- top: 50%;
- color: #eee;
</del><ins>+ color: #555;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ overflow: hidden;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-/* Header control: overlay "close" button */
</del><ins>+#customize-control-header_image .inner,
+#customize-control-header_image .inner .dashicons {
+ line-height: 20px;
+ top: 10px;
+}
+#customize-control-header_image .list .inner,
+#customize-control-header_image .list .inner .dashicons {
+ top: 9px;
+}
</ins><span class="cx">
</span><span class="cx"> #customize-control-header_image .header-view {
</span><span class="cx"> position: relative;
</span><ins>+ width: 100%;
+ margin-bottom: 5px;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+#customize-control-header_image .header-view:last-child {
+ margin-bottom: 0px;
+}
+
+/* Convoluted, but 'outline' support isn't good enough yet */
+#customize-control-header_image .header-view:after {
+ border: 0;
+}
+#customize-control-header_image .header-view.selected:after {
+ content: '';
+ position: absolute;
+ top: 0; left: 0; bottom: 0; right: 0;
+ border: 4px solid #2ea2cc;
+ border-radius: 2px;
+}
+#customize-control-header_image .header-view.button.selected {
+ border: 0;
+}
+
+/* Header control: overlay "close" button */
+
</ins><span class="cx"> #customize-control-header_image .uploaded .header-view .close {
</span><span class="cx"> font-size: 2em;
</span><span class="cx"> color: grey;
</span><span class="lines">@@ -575,21 +622,10 @@
</span><span class="cx"> margin-bottom: 9px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#customize-control-header_image .choice.random:before {
- position: absolute;
- content: attr(data-label);
- left: 0;
- top: 0;
-}
-
</del><span class="cx"> #customize-control-header_image .uploaded div:last-child > .choice {
</span><span class="cx"> margin-bottom: 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#customize-control-header_image .choices hr {
- visibility: hidden;
-}
-
</del><span class="cx"> #customize-control-header_image img {
</span><span class="cx"> width: 100%;
</span><span class="cx"> -webkit-border-radius: 2px;
</span></span></pre></div>
<a id="trunksrcwpadmincustomheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/custom-header.php (27946 => 27947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/custom-header.php 2014-04-04 15:47:43 UTC (rev 27946)
+++ trunk/src/wp-admin/custom-header.php 2014-04-04 15:48:34 UTC (rev 27947)
</span><span class="lines">@@ -1272,9 +1272,12 @@
</span><span class="cx"> public function get_uploaded_header_images() {
</span><span class="cx"> $header_images = get_uploaded_header_images();
</span><span class="cx"> $timestamp_key = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
</span><ins>+ $alt_text_key = '_wp_attachment_image_alt';
</ins><span class="cx">
</span><span class="cx"> foreach ( $header_images as &$header_image ) {
</span><del>- $header_image['timestamp'] = get_post_meta( $header_image['attachment_id'], $timestamp_key, true );
</del><ins>+ $header_meta = get_post_meta( $header_image['attachment_id'] );
+ $header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : '';
+ $header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : '';
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return $header_images;
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpcustomizecontrolphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/class-wp-customize-control.php (27946 => 27947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/class-wp-customize-control.php 2014-04-04 15:47:43 UTC (rev 27946)
+++ trunk/src/wp-includes/class-wp-customize-control.php 2014-04-04 15:48:34 UTC (rev 27947)
</span><span class="lines">@@ -774,27 +774,28 @@
</span><span class="cx">
</span><span class="cx"> <div class="placeholder random">
</span><span class="cx"> <div class="inner">
</span><del>- <span><span class="dashicons dashicons-randomize dice"></span>
</del><ins>+ <button type="button"><span class="dashicons dashicons-randomize dice"></span>
</ins><span class="cx"> <# if ( data.type === 'uploaded' ) { #>
</span><span class="cx"> <?php _e( 'Randomize uploaded headers' ); ?>
</span><span class="cx"> <# } else if ( data.type === 'default' ) { #>
</span><span class="cx"> <?php _e( 'Randomize suggested headers' ); ?>
</span><span class="cx"> <# } #>
</span><del>- </span>
</del><ins>+ </button>
</ins><span class="cx"> </div>
</span><span class="cx"> </div>
</span><span class="cx">
</span><span class="cx"> <# } else { #>
</span><span class="cx">
</span><span class="cx"> <# if (data.type === 'uploaded') { #>
</span><del>- <div class="dashicons dashicons-no close"></div>
</del><ins>+ <div class="dashicons dashicons-no close"></div>
</ins><span class="cx"> <# } #>
</span><span class="cx">
</span><del>- <a href="#" class="choice thumbnail #>"
</del><ins>+ <button type="button" class="choice thumbnail"
</ins><span class="cx"> data-customize-image-value="{{{data.header.url}}}"
</span><span class="cx"> data-customize-header-image-data="{{JSON.stringify(data.header)}}">
</span><del>- <img src="{{{data.header.thumbnail_url}}}">
- </a>
</del><ins>+ <span class="screen-reader-text"><?php _e( 'Set image' ); ?></span>
+ <img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}">
+ </button>
</ins><span class="cx">
</span><span class="cx"> <# } #>
</span><span class="cx"> </script>
</span><span class="lines">@@ -803,7 +804,7 @@
</span><span class="cx"> <# if (data.choice) { #>
</span><span class="cx"> <# if (data.random) { #>
</span><span class="cx">
</span><del>- <div class="placeholder">
</del><ins>+ <div class="placeholder" tabindex="0">
</ins><span class="cx"> <div class="inner">
</span><span class="cx"> <span><span class="dashicons dashicons-randomize dice"></span>
</span><span class="cx"> <# if ( data.type === 'uploaded' ) { #>
</span><span class="lines">@@ -817,12 +818,12 @@
</span><span class="cx">
</span><span class="cx"> <# } else { #>
</span><span class="cx">
</span><del>- <img src="{{{data.header.thumbnail_url}}}" />
</del><ins>+ <img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" tabindex="0"/>
</ins><span class="cx">
</span><span class="cx"> <# } #>
</span><span class="cx"> <# } else { #>
</span><span class="cx">
</span><del>- <div class="placeholder">
</del><ins>+ <div class="placeholder" tabindex="0">
</ins><span class="cx"> <div class="inner">
</span><span class="cx"> <span>
</span><span class="cx"> <?php _e( 'No image set' ); ?>
</span><span class="lines">@@ -853,7 +854,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> <div class="customize-control-content">
</span><del>- <p class="customizer-section-intro">
</del><ins>+ <p class="customizer-section-intro" tabindex="0">
</ins><span class="cx"> <?php
</span><span class="cx"> // @todo translate (and look to custom-header.php for inspiration)
</span><span class="cx"> echo ( 'Personalize your site with your own header image.' ) . ' ';
</span><span class="lines">@@ -867,7 +868,7 @@
</span><span class="cx"> ?>
</span><span class="cx"> </p>
</span><span class="cx"> <div class="current">
</span><del>- <span class="customize-control-title">
</del><ins>+ <span class="customize-control-title" tabindex="0">
</ins><span class="cx"> <?php _e( 'Current header' ); ?>
</span><span class="cx"> </span>
</span><span class="cx"> <div class="container">
</span><span class="lines">@@ -875,20 +876,20 @@
</span><span class="cx"> </div>
</span><span class="cx"> <div class="actions">
</span><span class="cx"> <?php /* translators: Hide as in hide header image via the Customizer */ ?>
</span><del>- <a href="#" <?php echo $visibility ?> class="button remove"><?php _ex( 'Hide', 'custom header' ); ?></a>
</del><ins>+ <button type="button"<?php echo $visibility ?> class="button remove"><?php _ex( 'Hide image', 'custom header' ); ?></button>
</ins><span class="cx"> <?php /* translators: New as in add new header image via the Customizer */ ?>
</span><del>- <a href="#" class="button new"><?php _ex( 'Add new', 'header image' ); ?></a>
</del><ins>+ <button type="button" class="button new"><?php _ex( 'Add new image', 'header image' ); ?></button>
</ins><span class="cx"> <div style="clear:both"></div>
</span><span class="cx"> </div>
</span><span class="cx"> <div class="choices">
</span><del>- <span class="customize-control-title header-previously-uploaded">
</del><ins>+ <span class="customize-control-title header-previously-uploaded" tabindex="0">
</ins><span class="cx"> <?php _ex( 'Previously uploaded', 'custom headers' ); ?>
</span><span class="cx"> </span>
</span><span class="cx"> <div class="uploaded">
</span><span class="cx"> <div class="list">
</span><span class="cx"> </div>
</span><span class="cx"> </div>
</span><del>- <span class="customize-control-title header-default">
</del><ins>+ <span class="customize-control-title header-default" tabindex="0">
</ins><span class="cx"> <?php _ex( 'Suggested', 'custom headers' ); ?>
</span><span class="cx"> </span>
</span><span class="cx"> <div class="default">
</span></span></pre></div>
<a id="trunksrcwpincludesjscustomizemodelsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/customize-models.js (27946 => 27947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/customize-models.js 2014-04-04 15:47:43 UTC (rev 27946)
+++ trunk/src/wp-includes/js/customize-models.js 2014-04-04 15:48:34 UTC (rev 27947)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> thumbnail_url: ''
</span><span class="cx"> },
</span><span class="cx"> choice: '',
</span><del>- hidden: false,
</del><ins>+ selected: false,
</ins><span class="cx"> random: false
</span><span class="cx"> };
</span><span class="cx"> },
</span><span class="lines">@@ -160,10 +160,14 @@
</span><span class="cx"> elt.defaultName = index;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (typeof elt.timestamp === 'undefined') {
+ elt.timestamp = 0;
+ }
+
</ins><span class="cx"> this.add({
</span><span class="cx"> header: elt,
</span><span class="cx"> choice: elt.url.split('/').pop(),
</span><del>- hidden: current === elt.url.replace(/^https?:\/\//, '')
</del><ins>+ selected: current === elt.url.replace(/^https?:\/\//, '')
</ins><span class="cx"> }, { silent: true });
</span><span class="cx"> }, this);
</span><span class="cx">
</span><span class="lines">@@ -191,7 +195,7 @@
</span><span class="cx"> },
</span><span class="cx"> choice: randomChoice,
</span><span class="cx"> random: true,
</span><del>- hidden: isRandomSameType
</del><ins>+ selected: isRandomSameType
</ins><span class="cx"> });
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -200,33 +204,23 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> shouldHideTitle: function() {
</span><del>- return _.every(this.pluck('hidden'));
</del><ins>+ return this.size() < 2;
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> setImage: function(model) {
</span><span class="cx"> this.each(function(m) {
</span><del>- m.set('hidden', false);
</del><ins>+ m.set('selected', false);
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> if (model) {
</span><del>- model.set('hidden', true);
- // Bump images to top except for special "Randomize" images
- if (!model.get('random')) {
- model.get('header').timestamp = _.now();
- this.sort();
- }
</del><ins>+ model.set('selected', true);
</ins><span class="cx"> }
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> removeImage: function() {
</span><span class="cx"> this.each(function(m) {
</span><del>- m.set('hidden', false);
</del><ins>+ m.set('selected', false);
</ins><span class="cx"> });
</span><del>- },
-
- shown: function() {
- var filtered = this.where({ hidden: false });
- return new api.HeaderTool.ChoiceList( filtered );
</del><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span></span></pre></div>
<a id="trunksrcwpincludesjscustomizeviewsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/customize-views.js (27946 => 27947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/customize-views.js 2014-04-04 15:47:43 UTC (rev 27946)
+++ trunk/src/wp-includes/js/customize-views.js 2014-04-04 15:48:34 UTC (rev 27947)
</span><span class="lines">@@ -32,16 +32,18 @@
</span><span class="cx">
</span><span class="cx"> getHeight: function() {
</span><span class="cx"> var image = this.$el.find('img'),
</span><del>- saved = this.model.get('savedHeight'),
- height = image.height() || saved,
- headerImageData;
</del><ins>+ saved, height, headerImageData;
</ins><span class="cx">
</span><span class="cx"> if (image.length) {
</span><span class="cx"> this.$el.find('.inner').hide();
</span><span class="cx"> } else {
</span><span class="cx"> this.$el.find('.inner').show();
</span><ins>+ return 40;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ saved = this.model.get('savedHeight');
+ height = image.height() || saved;
+
</ins><span class="cx"> // happens at ready
</span><span class="cx"> if (!height) {
</span><span class="cx"> headerImageData = api.get().header_image_data;
</span><span class="lines">@@ -92,8 +94,6 @@
</span><span class="cx"> * @constructor
</span><span class="cx"> * @augments wp.Backbone.View
</span><span class="cx"> */
</span><del>- (function () { // closures FTW
- var lastHeight = 0;
</del><span class="cx"> api.HeaderTool.ChoiceView = wp.Backbone.View.extend({
</span><span class="cx"> template: wp.template('header-choice'),
</span><span class="cx">
</span><span class="lines">@@ -110,7 +110,7 @@
</span><span class="cx"> this.model.get('choice')
</span><span class="cx"> ];
</span><span class="cx">
</span><del>- this.listenTo(this.model, 'change', this.render);
</del><ins>+ this.listenTo(this.model, 'change:selected', this.toggleSelected);
</ins><span class="cx">
</span><span class="cx"> if (_.contains(properties, api.get().header_image)) {
</span><span class="cx"> api.HeaderTool.currentHeader.set(this.extendedModel());
</span><span class="lines">@@ -118,21 +118,21 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> render: function() {
</span><del>- var model = this.model;
-
</del><span class="cx"> this.$el.html(this.template(this.extendedModel()));
</span><span class="cx">
</span><del>- if (model.get('random')) {
</del><ins>+ if (this.model.get('random')) {
+ this.$el.addClass('button display-options');
</ins><span class="cx"> this.setPlaceholder(40);
</span><span class="cx"> }
</span><del>- else {
- lastHeight = this.getHeight();
- }
</del><span class="cx">
</span><del>- this.$el.toggleClass('hidden', model.get('hidden'));
</del><ins>+ this.toggleSelected();
</ins><span class="cx"> return this;
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ toggleSelected: function() {
+ this.$el.toggleClass('selected', this.model.get('selected'));
+ },
+
</ins><span class="cx"> extendedModel: function() {
</span><span class="cx"> var c = this.model.get('collection');
</span><span class="cx"> return _.extend(this.model.toJSON(), {
</span><span class="lines">@@ -145,17 +145,26 @@
</span><span class="cx"> setPlaceholder: api.HeaderTool.CurrentView.prototype.setPlaceholder,
</span><span class="cx">
</span><span class="cx"> select: function() {
</span><ins>+ this.preventJump();
</ins><span class="cx"> this.model.save();
</span><span class="cx"> api.HeaderTool.currentHeader.set(this.extendedModel());
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ preventJump: function() {
+ var container = $('.wp-full-overlay-sidebar-content'),
+ scroll = container.scrollTop();
+
+ _.defer(function() {
+ container.scrollTop(scroll);
+ });
+ },
+
</ins><span class="cx"> removeImage: function(e) {
</span><span class="cx"> e.stopPropagation();
</span><span class="cx"> this.model.destroy();
</span><span class="cx"> this.remove();
</span><span class="cx"> }
</span><span class="cx"> });
</span><del>- })();
</del><span class="cx">
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -174,15 +183,14 @@
</span><span class="cx"> this.listenTo(this.collection, 'add', this.addOne);
</span><span class="cx"> this.listenTo(this.collection, 'remove', this.render);
</span><span class="cx"> this.listenTo(this.collection, 'sort', this.render);
</span><del>- this.listenTo(this.collection, 'change:hidden', this.toggleTitle);
- this.listenTo(this.collection, 'change:hidden', this.setMaxListHeight);
</del><ins>+ this.listenTo(this.collection, 'change', this.toggleList);
</ins><span class="cx"> this.render();
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> render: function() {
</span><span class="cx"> this.$el.empty();
</span><span class="cx"> this.collection.each(this.addOne, this);
</span><del>- this.toggleTitle();
</del><ins>+ this.toggleList();
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> addOne: function(choice) {
</span><span class="lines">@@ -192,12 +200,13 @@
</span><span class="cx"> this.$el.append(view.render().el);
</span><span class="cx"> },
</span><span class="cx">
</span><del>- toggleTitle: function() {
- var title = this.$el.parents().prev('.customize-control-title');
</del><ins>+ toggleList: function() {
+ var title = this.$el.parents().prev('.customize-control-title'),
+ randomButton = this.$el.find('.random').parent();
</ins><span class="cx"> if (this.collection.shouldHideTitle()) {
</span><del>- title.hide();
</del><ins>+ title.add(randomButton).hide();
</ins><span class="cx"> } else {
</span><del>- title.show();
</del><ins>+ title.add(randomButton).show();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> });
</span></span></pre>
</div>
</div>
</body>
</html>