diff --git a/wp-admin/css/colors-classic.css b/wp-admin/css/colors-classic.css index 0de034db98..375a31fbd2 100644 --- a/wp-admin/css/colors-classic.css +++ b/wp-admin/css/colors-classic.css @@ -1632,10 +1632,15 @@ div.widgets-sortables, color: #fff; } -.sidebar-name:hover { +.sidebar-name:hover, +#removing-widget { color: #d54e21; } +#removing-widget span { + color: black; +} + #widgets-left .sidebar-name-arrow { background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -109px; } @@ -1644,6 +1649,10 @@ div.widgets-sortables, background: transparent url(../images/fav-arrow-vs.gif) no-repeat scroll 0 -1px; } -h4 .in-widget-title { - color: #636363; +.in-widget-title { + color: #606060; +} + +.deleting .widget-title * { + color: #aaa; } diff --git a/wp-admin/css/colors-fresh.css b/wp-admin/css/colors-fresh.css index 36745f7662..8f38a82b55 100644 --- a/wp-admin/css/colors-fresh.css +++ b/wp-admin/css/colors-fresh.css @@ -1621,10 +1621,15 @@ div.widgets-sortables, color: #fff; } -.sidebar-name:hover { +.sidebar-name:hover, +#removing-widget { color: #d54e21; } +#removing-widget span { + color: black; +} + #widgets-left .sidebar-name-arrow { background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px; } @@ -1633,6 +1638,10 @@ div.widgets-sortables, background: transparent url(../images/fav-arrow.gif) no-repeat scroll 0 -1px; } -h4 .in-widget-title { - color: #636363; +.in-widget-title { + color: #606060; +} + +.deleting .widget-title * { + color: #aaa; } diff --git a/wp-admin/css/ie.css b/wp-admin/css/ie.css index 034ebc2263..6b06fdbab5 100644 --- a/wp-admin/css/ie.css +++ b/wp-admin/css/ie.css @@ -376,6 +376,10 @@ table.ie-fixed { width: 210px; } +* html #removing-widget .in-widget-title { + display: none; +} + #available-widgets .widget-holder { padding-bottom: 65px; } diff --git a/wp-admin/css/widgets.css b/wp-admin/css/widgets.css index c2e170b9c4..8a47158005 100644 --- a/wp-admin/css/widgets.css +++ b/wp-admin/css/widgets.css @@ -44,6 +44,8 @@ div.sidebar-name h3 { padding: 5px 12px; font-size: 13px; height: 19px; + overflow: hidden; + white-space: nowrap; } div.sidebar-name { @@ -296,7 +298,15 @@ a.widget-control-edit { width: 26px; } -h4 .in-widget-title { +.widget-title .in-widget-title { font-size: 11px; white-space: nowrap; } + +#removing-widget { + display: none; + font-weight: normal; + padding-left: 15px; + font-size: 12px; +} + diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 4aae8b09a4..0d35a8f104 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -3582,7 +3582,7 @@ function plugins_search_help() { function widgets_help() { return '
' . __('Widgets are added and arranged by simple drag ’n’ drop. If you hover your mouse over the titlebar of a widget, you’ll see a 4-arrow cursor which indicates that the widget is movable. Click on the titlebar, hold down the mouse button and drag the widget to a sidebar. As you drag, you’ll see a dotted box that also moves. This box shows where the widget will go once you drop it.') . '
-' . __('To remove a widget from a sidebar, click on the arrow on its titlebar to reveal its settings, and then click Remove.') . '
+' . __('To remove a widget from a sidebar, drag it back to Available Widgets or click on the arrow on its titlebar to reveal its settings, and then click Remove.') . '
' . __('To remove a widget from a sidebar and keep its configuration, drag it to Inactive Widgets.') . '
' . __('The Inactive Widgets area stores widgets that are configured but not curently used. If you change themes and the new theme has fewer sidebars than the old, all extra widgets will be stored to Inactive Widgets automatically.') . '
'; diff --git a/wp-admin/includes/widgets.php b/wp-admin/includes/widgets.php index 1b44bc2888..84ca9e1480 100644 --- a/wp-admin/includes/widgets.php +++ b/wp-admin/includes/widgets.php @@ -21,12 +21,8 @@ function wp_list_widgets() { $sort = $wp_registered_widgets; usort( $sort, create_function( '$a, $b', 'return strnatcasecmp( $a["name"], $b["name"] );' ) ); - $done = array(); ?> + $done = array(); - -]+>/g, function(m){ return m.replace(/__i__|%i%/g, n); }) ); @@ -79,13 +112,12 @@ wpWidgets = { rem = 'div#' + id; } wpWidgets.addEvents(ui.item); - wpWidgets.save( ui.item.find('form').serialize(), sb, 0, 0 ); + wpWidgets.save( ui.item, 0, 0, 0, 1 ); ui.item.find('input.add_new').val(''); ui.item.find('a.widget-action').click(); + return; } wpWidgets.saveOrder(sb); - wpWidgets.resize(); - wpWidgets.fixWebkit(); }, receive: function(e,ui) { if ( !$(this).is(':visible') ) @@ -102,7 +134,8 @@ wpWidgets = { }, saveOrder : function(sb) { - $('#' + sb).parents('.widgets-holder-wrap').find('.ajax-feedback').css('visibility', 'visible'); + if ( sb ) + $('#' + sb).parents('.widgets-holder-wrap').find('.ajax-feedback').css('visibility', 'visible'); var a = { action: 'widgets-order', @@ -117,12 +150,15 @@ wpWidgets = { $.post( ajaxurl, a, function() { $('.ajax-feedback').css('visibility', 'hidden'); }); + this.resize(); }, - save : function(data, sb, del, t) { + save : function(widget, del, close, animate, order) { + var sb = widget.parents('.widgets-sortables').attr('id'), data = widget.find('form').serialize(), a; + widget = $(widget); $('#' + sb).parents('.widgets-holder-wrap').find('.ajax-feedback').css('visibility', 'visible'); - var a = { + a = { action: 'save-widget', savewidgets: $('#_wpnonce_widgets').val(), sidebar: sb @@ -134,18 +170,9 @@ wpWidgets = { data += '&' + $.param(a); $.post( ajaxurl, data, function(r){ - var id, widget; - $('.ajax-feedback').css('visibility', 'hidden'); - if ( !t ) - return; - - widget = $(t).parents('.widget'); + var id; if ( del ) { - widget.slideUp('normal', function(){ - $(this).remove(); - wpWidgets.resize(); - }); if ( !$('.widget_number', widget).val() ) { id = $('.widget-id', widget).val(); $('#available-widgets .widget-id').each(function(){ @@ -153,12 +180,26 @@ wpWidgets = { $(this).parents('.widget').show(); }); } - } else { - $(t).parents('.widget-inside').slideUp('normal', function(){ + + if ( animate ) { + order = 0; + widget.slideUp('fast', function(){ + $(this).remove(); + wpWidgets.saveOrder(); + }); + } else { + widget.remove(); + wpWidgets.resize(); + } + } else if ( close ) { + widget.find('.widget-inside').slideUp('fast', function(){ widget.css({'width':'','marginLeft':''}); wpWidgets.appendTitle(widget); + $('.ajax-feedback').css('visibility', 'hidden'); }); } + if ( order ) + wpWidgets.saveOrder(); }); }, @@ -167,7 +208,8 @@ wpWidgets = { var title; if ( this.id.indexOf('title') != -1 ) { title = $(this).val().replace(/<[^<>]+>/g, '').replace(//g, '>'); - $('.widget-title .in-widget-title', widget).html(': ' + title); + if ( title ) + $('.widget-title .in-widget-title', widget).html(': ' + title); return false; } }); @@ -200,22 +242,21 @@ wpWidgets = { css['marginLeft'] = 235 - w + 'px'; inside.parents('.widget').css(css); } - inside.slideDown('normal'); + inside.slideDown('fast'); } else { - inside.slideUp('normal', function(){ inside.parents('.widget').css({'width':'','marginLeft':''}); }); + inside.slideUp('fast', function(){ inside.parents('.widget').css({'width':'','marginLeft':''}); }); } return false; }); $('.widget-control-save', sc).click(function(){ - wpWidgets.save( $(this).parents('form').serialize(), $(this).parents('.widgets-sortables').attr('id'), 0, this ); + wpWidgets.save( $(this).parents('.widget'), 0, 1, 1, 0 ); return false; }); $('.widget-control-remove', sc).click(function(){ - wpWidgets.save( $(this).parents('form').serialize(), $(this).parents('.widgets-sortables').attr('id'), 1, this ); + wpWidgets.save( $(this).parents('.widget'), 1, 1, 1, 0 ); return false; }); } - }; $(document).ready(function(){wpWidgets.init();}); diff --git a/wp-admin/js/widgets.js b/wp-admin/js/widgets.js index ae2ad91c98..3e032d483c 100644 --- a/wp-admin/js/widgets.js +++ b/wp-admin/js/widgets.js @@ -1 +1 @@ -var wpWidgets;(function(a){wpWidgets={init:function(){var b;a("#widgets-right div.sidebar-name").click(function(){var d=a(this).siblings(".widgets-sortables");if(d.is(":visible")){d.sortable("disable");a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed");d.sortable("enable").sortable("refresh")}});a("#widgets-left div.sidebar-name").click(function(){if(a(this).siblings(".widget-holder").is(":visible")){a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed")}});a("#widgets-right .widget, #wp_inactive_widgets .widget").each(function(){wpWidgets.appendTitle(this)});this.addEvents();a(".widget-error").parents(".widget").find("a.widget-action").click();a("#widget-list .widget").draggable({connectToSortable:".widgets-sortables",handle:".widget-title",distance:2,helper:"clone",zIndex:5,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.helper.find(".widget-description").hide()},stop:function(d,c){if(b){a(b).hide()}b="";wpWidgets.fixWebkit()}});a(".widgets-sortables").sortable({placeholder:"widget-placeholder",connectWith:".widgets-sortables",items:".widget",handle:".widget-title",cursor:"move",distance:2,opacity:0.65,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.item.find(".widget-inside").hide();c.item.css({marginLeft:"",width:""})},stop:function(f,c){var d=c.item.find("input.add_new").val(),i=c.item.find("input.multi_number").val(),h=c.item.attr("id"),g=a(this).attr("id");c.item.css({marginLeft:"",width:""});if(d){if("multi"==d){c.item.html(c.item.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__|%i%/g,i)}));c.item.attr("id",h.replace(/__i__|%i%/g,i));i++;a("div#"+h).find("input.multi_number").val(i)}else{if("single"==d){c.item.attr("id","new-"+h);b="div#"+h}}wpWidgets.addEvents(c.item);wpWidgets.save(c.item.find("form").serialize(),g,0,0);c.item.find("input.add_new").val("");c.item.find("a.widget-action").click()}wpWidgets.saveOrder(g);wpWidgets.resize();wpWidgets.fixWebkit()},receive:function(d,c){if(!a(this).is(":visible")){a(this).sortable("cancel")}}}).not(":visible").sortable("disable");wpWidgets.resize();a(".widget-inside label").each(function(){var c=a(this).attr("for");if(c&&c==a("input",this).attr("id")){a(this).removeAttr("for")}})},saveOrder:function(c){a("#"+c).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"widgets-order",savewidgets:a("#_wpnonce_widgets").val(),sidebars:[]};a(".widgets-sortables").each(function(){b["sidebars["+a(this).attr("id")+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b,function(){a(".ajax-feedback").css("visibility","hidden")})},save:function(e,f,c,d){a("#"+f).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"save-widget",savewidgets:a("#_wpnonce_widgets").val(),sidebar:f};if(c){b.delete_widget=1}e+="&"+a.param(b);a.post(ajaxurl,e,function(g){var i,h;a(".ajax-feedback").css("visibility","hidden");if(!d){return}h=a(d).parents(".widget");if(c){h.slideUp("normal",function(){a(this).remove();wpWidgets.resize()});if(!a(".widget_number",h).val()){i=a(".widget-id",h).val();a("#available-widgets .widget-id").each(function(){if(a(this).val()==i){a(this).parents(".widget").show()}})}}else{a(d).parents(".widget-inside").slideUp("normal",function(){h.css({width:"",marginLeft:""});wpWidgets.appendTitle(h)})}})},appendTitle:function(b){a('input[type="text"]',b).each(function(){var c;if(this.id.indexOf("title")!=-1){c=a(this).val().replace(/<[^<>]+>/g,"").replace(//g,">");a(".widget-title .in-widget-title",b).html(": "+c);return false}})},resize:function(){a(".widgets-sortables").not("#wp_inactive_widgets").each(function(){var c=50,b=a(".widget",this).length;c=c+parseInt(b*48,10);a(this).css("minHeight",c+"px")})},fixWebkit:function(b){b=b?"none":"";a("body").css({WebkitUserSelect:b,KhtmlUserSelect:b})},addEvents:function(b){b=b||document;a("a.widget-action",b).click(function(){var d=parseInt(a(this).parents(".widget").find(".widget-width").val(),10),e={},c=a(this).parents(".widget-top").siblings(".widget-inside");if(c.is(":hidden")){if(d>250&&c.parents(".widgets-sortables").length){e.width=d+30+"px";if(c.parents(".widget-liquid-right").length){e.marginLeft=235-d+"px"}c.parents(".widget").css(e)}c.slideDown("normal")}else{c.slideUp("normal",function(){c.parents(".widget").css({width:"",marginLeft:""})})}return false});a(".widget-control-save",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),0,this);return false});a(".widget-control-remove",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),1,this);return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery); \ No newline at end of file +var wpWidgets;(function(a){wpWidgets={init:function(){var b;a("#widgets-right div.sidebar-name").click(function(){var d=a(this).siblings(".widgets-sortables");if(d.is(":visible")){d.sortable("disable");a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed");d.sortable("enable").sortable("refresh")}});a("#widgets-left div.sidebar-name").click(function(){if(a(this).siblings(".widget-holder").is(":visible")){a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed")}});a("#widgets-right .widget, #wp_inactive_widgets .widget").each(function(){wpWidgets.appendTitle(this)});this.addEvents();a(".widget-error").parents(".widget").find("a.widget-action").click();a("#available-widgets").droppable({tolerance:"pointer",accept:function(c){return a(c).parent().attr("id")!="widget-list"},drop:function(d,c){c.draggable.addClass("deleting");a("#removing-widget").hide().children("span").html("")},over:function(d,c){c.draggable.addClass("deleting");a(".widget-placeholder").hide();if(c.draggable.hasClass("ui-sortable-helper")){a("#removing-widget").show().children("span").html(c.draggable.find(".widget-title h4").html())}},out:function(d,c){c.draggable.removeClass("deleting");a(".widget-placeholder").show();a("#removing-widget").hide().children("span").html("")}});a("#widget-list .widget").draggable({connectToSortable:".widgets-sortables",handle:".widget-title",distance:2,helper:"clone",zIndex:5,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.helper.find(".widget-description").hide()},stop:function(d,c){if(b){a(b).hide()}b="";wpWidgets.fixWebkit()}});a(".widgets-sortables").sortable({placeholder:"widget-placeholder",connectWith:".widgets-sortables",items:".widget",handle:".widget-title",cursor:"move",distance:2,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.item.find(".widget-inside").hide();c.item.css({marginLeft:"",width:""})},stop:function(f,c){if(c.item.hasClass("ui-draggable")){c.item.draggable("destroy")}if(c.item.hasClass("deleting")){wpWidgets.save(c.item,1,0,0,1);c.item.remove();return}var d=c.item.find("input.add_new").val(),i=c.item.find("input.multi_number").val(),h=c.item.attr("id"),g=a(this).attr("id");c.item.css({marginLeft:"",width:""});wpWidgets.fixWebkit();if(d){if("multi"==d){c.item.html(c.item.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__|%i%/g,i)}));c.item.attr("id",h.replace(/__i__|%i%/g,i));i++;a("div#"+h).find("input.multi_number").val(i)}else{if("single"==d){c.item.attr("id","new-"+h);b="div#"+h}}wpWidgets.addEvents(c.item);wpWidgets.save(c.item,0,0,0,1);c.item.find("input.add_new").val("");c.item.find("a.widget-action").click();return}wpWidgets.saveOrder(g)},receive:function(d,c){if(!a(this).is(":visible")){a(this).sortable("cancel")}}}).not(":visible").sortable("disable");wpWidgets.resize();a(".widget-inside label").each(function(){var c=a(this).attr("for");if(c&&c==a("input",this).attr("id")){a(this).removeAttr("for")}})},saveOrder:function(c){if(c){a("#"+c).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible")}var b={action:"widgets-order",savewidgets:a("#_wpnonce_widgets").val(),sidebars:[]};a(".widgets-sortables").each(function(){b["sidebars["+a(this).attr("id")+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b,function(){a(".ajax-feedback").css("visibility","hidden")});this.resize()},save:function(g,d,h,e,b){var i=g.parents(".widgets-sortables").attr("id"),f=g.find("form").serialize(),c;g=a(g);a("#"+i).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");c={action:"save-widget",savewidgets:a("#_wpnonce_widgets").val(),sidebar:i};if(d){c.delete_widget=1}f+="&"+a.param(c);a.post(ajaxurl,f,function(j){var k;if(d){if(!a(".widget_number",g).val()){k=a(".widget-id",g).val();a("#available-widgets .widget-id").each(function(){if(a(this).val()==k){a(this).parents(".widget").show()}})}if(e){b=0;g.slideUp("fast",function(){a(this).remove();wpWidgets.saveOrder()})}else{g.remove();wpWidgets.resize()}}else{if(h){g.find(".widget-inside").slideUp("fast",function(){g.css({width:"",marginLeft:""});wpWidgets.appendTitle(g);a(".ajax-feedback").css("visibility","hidden")})}}if(b){wpWidgets.saveOrder()}})},appendTitle:function(b){a('input[type="text"]',b).each(function(){var c;if(this.id.indexOf("title")!=-1){c=a(this).val().replace(/<[^<>]+>/g,"").replace(//g,">");if(c){a(".widget-title .in-widget-title",b).html(": "+c)}return false}})},resize:function(){a(".widgets-sortables").not("#wp_inactive_widgets").each(function(){var c=50,b=a(".widget",this).length;c=c+parseInt(b*48,10);a(this).css("minHeight",c+"px")})},fixWebkit:function(b){b=b?"none":"";a("body").css({WebkitUserSelect:b,KhtmlUserSelect:b})},addEvents:function(b){b=b||document;a("a.widget-action",b).click(function(){var d=parseInt(a(this).parents(".widget").find(".widget-width").val(),10),e={},c=a(this).parents(".widget-top").siblings(".widget-inside");if(c.is(":hidden")){if(d>250&&c.parents(".widgets-sortables").length){e.width=d+30+"px";if(c.parents(".widget-liquid-right").length){e.marginLeft=235-d+"px"}c.parents(".widget").css(e)}c.slideDown("fast")}else{c.slideUp("fast",function(){c.parents(".widget").css({width:"",marginLeft:""})})}return false});a(".widget-control-save",b).click(function(){wpWidgets.save(a(this).parents(".widget"),0,1,1,0);return false});a(".widget-control-remove",b).click(function(){wpWidgets.save(a(this).parents(".widget"),1,1,1,0);return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery); \ No newline at end of file diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 0d2f653a42..213c11f666 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -44,9 +44,13 @@ require_once('admin-header.php');Visit site'), get_bloginfo('url') . '/'); ?>
widgets settings page to configure them.'), admin_url('widgets.php') ); ?>
Visit site'), get_bloginfo('url') . '/'); ?>
k))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(e