Header images: Improve accessibility of Randomize buttons.
props ehg. see #27598, #21785. Built from https://develop.svn.wordpress.org/trunk@27970 git-svn-id: http://core.svn.wordpress.org/trunk@27800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0c5d4db466
commit
5f1c818477
|
@ -469,8 +469,8 @@ body {
|
|||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
#customize-control-header_image .uploaded button,
|
||||
#customize-control-header_image .default button {
|
||||
#customize-control-header_image .uploaded button:not(.random),
|
||||
#customize-control-header_image .default button:not(.random) {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
@ -478,7 +478,6 @@ body {
|
|||
border: none;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#customize-control-header_image button img {
|
||||
|
@ -584,11 +583,17 @@ body {
|
|||
height: 40px;
|
||||
}
|
||||
|
||||
#customize-control-header_image .random .inner {
|
||||
display: block;
|
||||
#customize-control-header_image button.random {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#customize-control-header_image .placeholder:hover .dice {
|
||||
#customize-control-header_image button.random .dice {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
#customize-control-header_image .placeholder:hover .dice,
|
||||
#customize-control-header_image .header-view:hover > button.random .dice {
|
||||
-webkit-animation: dice-color-change 3s infinite;
|
||||
-ms-animation: dice-color-change 3s infinite;
|
||||
animation: dice-color-change 3s infinite;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -469,8 +469,8 @@ body {
|
|||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
#customize-control-header_image .uploaded button,
|
||||
#customize-control-header_image .default button {
|
||||
#customize-control-header_image .uploaded button:not(.random),
|
||||
#customize-control-header_image .default button:not(.random) {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
@ -478,7 +478,6 @@ body {
|
|||
border: none;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#customize-control-header_image button img {
|
||||
|
@ -584,11 +583,17 @@ body {
|
|||
height: 40px;
|
||||
}
|
||||
|
||||
#customize-control-header_image .random .inner {
|
||||
display: block;
|
||||
#customize-control-header_image button.random {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#customize-control-header_image .placeholder:hover .dice {
|
||||
#customize-control-header_image button.random .dice {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
#customize-control-header_image .placeholder:hover .dice,
|
||||
#customize-control-header_image .header-view:hover > button.random .dice {
|
||||
-webkit-animation: dice-color-change 3s infinite;
|
||||
-ms-animation: dice-color-change 3s infinite;
|
||||
animation: dice-color-change 3s infinite;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -771,18 +771,14 @@ final class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control
|
|||
?>
|
||||
<script type="text/template" id="tmpl-header-choice">
|
||||
<# if (data.random) { #>
|
||||
|
||||
<div class="placeholder random">
|
||||
<div class="inner">
|
||||
<button type="button"><span class="dashicons dashicons-randomize dice"></span>
|
||||
<# if ( data.type === 'uploaded' ) { #>
|
||||
<?php _e( 'Randomize uploaded headers' ); ?>
|
||||
<# } else if ( data.type === 'default' ) { #>
|
||||
<?php _e( 'Randomize suggested headers' ); ?>
|
||||
<# } #>
|
||||
<button type="button" class="button display-options random">
|
||||
<span class="dashicons dashicons-randomize dice"></span>
|
||||
<# if ( data.type === 'uploaded' ) { #>
|
||||
<?php _e( 'Randomize uploaded headers' ); ?>
|
||||
<# } else if ( data.type === 'default' ) { #>
|
||||
<?php _e( 'Randomize suggested headers' ); ?>
|
||||
<# } #>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<# } else { #>
|
||||
|
||||
|
|
|
@ -121,7 +121,6 @@
|
|||
this.$el.html(this.template(this.extendedModel()));
|
||||
|
||||
if (this.model.get('random')) {
|
||||
this.$el.addClass('button display-options');
|
||||
this.setPlaceholder(40);
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(a,b,c){if(b&&b.customize){var d=b.customize;d.HeaderTool.CurrentView=b.Backbone.View.extend({template:b.template("header-current"),initialize:function(){this.listenTo(this.model,"change",this.render),this.render()},render:function(){return this.$el.html(this.template(this.model.toJSON())),this.setPlaceholder(),this.setButtons(),this},getHeight:function(){var a,b,c,e=this.$el.find("img");return e.length?(this.$el.find(".inner").hide(),a=this.model.get("savedHeight"),b=e.height()||a,b||(c=d.get().header_image_data,b=c&&c.width&&c.height?260/c.width*c.height:40),b):(this.$el.find(".inner").show(),40)},setPlaceholder:function(a){var b=a||this.getHeight();this.model.set("savedHeight",b),this.$el.add(this.$el.find(".placeholder")).height(b)},setButtons:function(){var b=a(".actions .remove");this.model.get("choice")?b.show():b.hide()}}),d.HeaderTool.ChoiceView=b.Backbone.View.extend({template:b.template("header-choice"),className:"header-view",events:{"click .choice,.random":"select","click .close":"removeImage"},initialize:function(){var a=[this.model.get("header").url,this.model.get("choice")];this.listenTo(this.model,"change:selected",this.toggleSelected),c.contains(a,d.get().header_image)&&d.HeaderTool.currentHeader.set(this.extendedModel())},render:function(){return this.$el.html(this.template(this.extendedModel())),this.model.get("random")&&(this.$el.addClass("button display-options"),this.setPlaceholder(40)),this.toggleSelected(),this},toggleSelected:function(){this.$el.toggleClass("selected",this.model.get("selected"))},extendedModel:function(){var a=this.model.get("collection");return c.extend(this.model.toJSON(),{type:a.type})},getHeight:d.HeaderTool.CurrentView.prototype.getHeight,setPlaceholder:d.HeaderTool.CurrentView.prototype.setPlaceholder,select:function(){this.preventJump(),this.model.save(),d.HeaderTool.currentHeader.set(this.extendedModel())},preventJump:function(){var b=a(".wp-full-overlay-sidebar-content"),d=b.scrollTop();c.defer(function(){b.scrollTop(d)})},removeImage:function(a){a.stopPropagation(),this.model.destroy(),this.remove()}}),d.HeaderTool.ChoiceListView=b.Backbone.View.extend({initialize:function(){this.listenTo(this.collection,"add",this.addOne),this.listenTo(this.collection,"remove",this.render),this.listenTo(this.collection,"sort",this.render),this.listenTo(this.collection,"change",this.toggleList),this.render()},render:function(){this.$el.empty(),this.collection.each(this.addOne,this),this.toggleList()},addOne:function(a){var b;a.set({collection:this.collection}),b=new d.HeaderTool.ChoiceView({model:a}),this.$el.append(b.render().el)},toggleList:function(){var a=this.$el.parents().prev(".customize-control-title"),b=this.$el.find(".random").parent();this.collection.shouldHideTitle()?a.add(b).hide():a.add(b).show()}}),d.HeaderTool.CombinedList=b.Backbone.View.extend({initialize:function(a){this.collections=a,this.on("all",this.propagate,this)},propagate:function(a,b){c.each(this.collections,function(c){c.trigger(a,b)})}})}}(jQuery,window.wp,_);
|
||||
!function(a,b,c){if(b&&b.customize){var d=b.customize;d.HeaderTool.CurrentView=b.Backbone.View.extend({template:b.template("header-current"),initialize:function(){this.listenTo(this.model,"change",this.render),this.render()},render:function(){return this.$el.html(this.template(this.model.toJSON())),this.setPlaceholder(),this.setButtons(),this},getHeight:function(){var a,b,c,e=this.$el.find("img");return e.length?(this.$el.find(".inner").hide(),a=this.model.get("savedHeight"),b=e.height()||a,b||(c=d.get().header_image_data,b=c&&c.width&&c.height?260/c.width*c.height:40),b):(this.$el.find(".inner").show(),40)},setPlaceholder:function(a){var b=a||this.getHeight();this.model.set("savedHeight",b),this.$el.add(this.$el.find(".placeholder")).height(b)},setButtons:function(){var b=a(".actions .remove");this.model.get("choice")?b.show():b.hide()}}),d.HeaderTool.ChoiceView=b.Backbone.View.extend({template:b.template("header-choice"),className:"header-view",events:{"click .choice,.random":"select","click .close":"removeImage"},initialize:function(){var a=[this.model.get("header").url,this.model.get("choice")];this.listenTo(this.model,"change:selected",this.toggleSelected),c.contains(a,d.get().header_image)&&d.HeaderTool.currentHeader.set(this.extendedModel())},render:function(){return this.$el.html(this.template(this.extendedModel())),this.model.get("random")&&this.setPlaceholder(40),this.toggleSelected(),this},toggleSelected:function(){this.$el.toggleClass("selected",this.model.get("selected"))},extendedModel:function(){var a=this.model.get("collection");return c.extend(this.model.toJSON(),{type:a.type})},getHeight:d.HeaderTool.CurrentView.prototype.getHeight,setPlaceholder:d.HeaderTool.CurrentView.prototype.setPlaceholder,select:function(){this.preventJump(),this.model.save(),d.HeaderTool.currentHeader.set(this.extendedModel())},preventJump:function(){var b=a(".wp-full-overlay-sidebar-content"),d=b.scrollTop();c.defer(function(){b.scrollTop(d)})},removeImage:function(a){a.stopPropagation(),this.model.destroy(),this.remove()}}),d.HeaderTool.ChoiceListView=b.Backbone.View.extend({initialize:function(){this.listenTo(this.collection,"add",this.addOne),this.listenTo(this.collection,"remove",this.render),this.listenTo(this.collection,"sort",this.render),this.listenTo(this.collection,"change",this.toggleList),this.render()},render:function(){this.$el.empty(),this.collection.each(this.addOne,this),this.toggleList()},addOne:function(a){var b;a.set({collection:this.collection}),b=new d.HeaderTool.ChoiceView({model:a}),this.$el.append(b.render().el)},toggleList:function(){var a=this.$el.parents().prev(".customize-control-title"),b=this.$el.find(".random").parent();this.collection.shouldHideTitle()?a.add(b).hide():a.add(b).show()}}),d.HeaderTool.CombinedList=b.Backbone.View.extend({initialize:function(a){this.collections=a,this.on("all",this.propagate,this)},propagate:function(a,b){c.each(this.collections,function(c){c.trigger(a,b)})}})}}(jQuery,window.wp,_);
|
Loading…
Reference in New Issue