- Fix support for expanding (wide) widgets in the Inactive Widgets area.
- Remove resizing of the sidebars height.
- Stop removing unneeded "for" attributes from labels inside the widgets. Was a fix for IE6 odd behaviour.  

See #26117.

git-svn-id: https://develop.svn.wordpress.org/trunk@26277 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2013-11-20 01:34:41 +00:00
parent 3fd189d063
commit 8da914b9ec
2 changed files with 28 additions and 47 deletions

View File

@ -10304,34 +10304,39 @@ div#widgets-right .closed .sidebar-description {
div#widgets-right .sidebar-name h3 {
padding: 15px 15px;
}
div#widgets-right .sidebar-name .sidebar-name-arrow:before {
right: 0;
top: 4px;
}
div#widgets-right .widget-top {
padding: 0;
background: #f7f7f7;
}
div#widgets-right .widget-title-action {
float: right;
position: relative;
top: 14px;
right: 10px;
}
div#widgets-right a.widget-action:after {
content: '\f111';
color: #888;
}
div#widgets-right .widget-inside {
border-top: 1px solid #dedede;
}
div#widgets-right .widgets-sortables {
min-height: 42px !important; /* Inline styles */
padding: 0 8px;
margin-bottom: 8px;
position: relative;
}
div#widgets-right .widgets-sortables:before {
display: block;
content: "";
@ -10348,6 +10353,11 @@ div#widgets-right .widgets-sortables:before {
color: #aaa;
}
.sidebar-name .spinner {
margin: -5px 5px;
float: none;
}
/* Accessibility Mode */
#available-widgets .widget-control-edit .edit {
display :none;

View File

@ -10,8 +10,7 @@ wpWidgets = {
chooser = $('#widgets-chooser'),
selectSidebar = chooser.find('.widgets-chooser-sidebars'),
sidebars = $('div.widgets-sortables'),
isRTL = !! ( 'undefined' !== typeof isRtl && isRtl ),
margin = ( isRTL ? 'marginRight' : 'marginLeft' );
isRTL = !! ( 'undefined' !== typeof isRtl && isRtl );
$('#widgets-right').children('.widgets-holder-wrap').children('.sidebar-name').click( function() {
var $this = $(this), parent = $this.parent();
@ -27,34 +26,30 @@ wpWidgets = {
$(this).parent().toggleClass('closed');
});
sidebars.each(function(){
if ( $(this).parent().hasClass('inactive') )
return true;
var h = 50, H = $(this).children('.widget').length;
h = h + parseInt(H * 48, 10);
$(this).css( 'minHeight', h + 'px' );
});
$(document.body).bind('click.widgets-toggle', function(e){
var target = $(e.target), css = {}, widget, inside, w;
var target = $(e.target), css = { 'z-index': 100 }, widget, inside, w;
if ( target.parents('.widget-top').length && ! target.parents('#available-widgets').length ) {
widget = target.closest('div.widget');
inside = widget.children('.widget-inside');
w = parseInt( widget.find('input.widget-width').val(), 10 );
targetWidth = parseInt( widget.find('input.widget-width').val(), 10 ),
widgetWidth = widget.width();
if ( inside.is(':hidden') ) {
if ( w > 250 && inside.closest('div.widgets-sortables').length ) {
if ( inside.closest('div.widget-liquid-right').length )
css[margin] = 235 - w + 'px';
widget.css(css);
if ( targetWidth > 250 && ( targetWidth + 30 > widgetWidth ) && widget.closest('div.widgets-sortables').length ) {
if ( widget.closest('div.widget-liquid-right').length ) {
margin = isRTL ? 'margin-right' : 'margin-left';
} else {
margin = isRTL ? 'margin-left' : 'margin-right';
}
css[ margin ] = widgetWidth - ( targetWidth + 30 ) + 'px';
widget.css( css );
}
wpWidgets.fixLabels(widget);
inside.slideDown('fast');
} else {
inside.slideUp('fast', function() {
widget.css({'width':'', margin:''});
widget.attr( 'style', '' );
});
}
e.preventDefault();
@ -104,7 +99,6 @@ wpWidgets = {
containment: 'document',
start: function(e,ui) {
ui.item.children('.widget-inside').hide();
ui.item.css({margin:'', 'width':''});
},
stop: function(e,ui) {
if ( ui.item.hasClass('ui-draggable') && ui.item.data('draggable') )
@ -121,7 +115,7 @@ wpWidgets = {
id = the_id,
sb = $(this).attr('id');
ui.item.css({margin:'', 'width':''});
ui.item.attr( 'style', '' );
the_id = '';
if ( add ) {
@ -258,8 +252,6 @@ wpWidgets = {
$.post( ajaxurl, a, function() {
$('.spinner').hide();
});
this.resize();
},
save : function(widget, del, animate, order) {
@ -298,14 +290,12 @@ wpWidgets = {
});
} else {
widget.remove();
wpWidgets.resize();
}
} else {
$('.spinner').hide();
if ( r && r.length > 2 ) {
$('div.widget-content', widget).html(r);
wpWidgets.appendTitle(widget);
wpWidgets.fixLabels(widget);
}
}
if ( order )
@ -324,28 +314,9 @@ wpWidgets = {
},
resize : function() {
$('div.widgets-sortables').each(function(){
if ( $(this).parent().hasClass('inactive') )
return true;
var h = 50, H = $(this).children('.widget').length;
h = h + parseInt(H * 48, 10);
$(this).css( 'minHeight', h + 'px' );
});
},
fixLabels : function(widget) {
widget.children('.widget-inside').find('label').each(function(){
var f = $(this).attr('for');
if ( f && f === $('input', this).attr('id') )
$(this).removeAttr('for');
});
},
close : function(widget) {
widget.children('.widget-inside').slideUp('fast', function(){
widget.css({'width':'', margin:''});
widget.children('.widget-inside').slideUp('fast', function() {
widget.attr( 'style', '' );
});
},