
$(function(){$('.remove-if-drag').remove();$('.hidden-if-drag').hide();$('.widgets, .sortable-delete').addClass('if-drag');$(".connected, .sortable-delete").sortable({tolerance:"move",cursor:"move",axis:"y",dropOnEmpty:true,handle:".widget-name",placeholder:"ui-sortable-placeholder",items:"li:not(.sortable-delete-placeholder,.empty-widgets)",connectWith:".connected, .sortable-delete",start:function(event,ui){ui.item.css('left',ui.item.position().left+20);},update:function(event,ui){ul=$(this);widget=ui.item;field=ul.parents('.widgets');ui.item.css('left','auto');if(ul.find('li:not(.empty-widgets)').length==0){ul.find('li.empty-widgets').show();field.find('ul.sortable-delete').hide();}else{ul.find('li.empty-widgets').hide();field.find('ul.sortable-delete').show();}
if(widget.parents('ul').is('.sortable-delete')){widget.hide('slow',function(){$(this).remove();});}
reorder(ul);if(widget.find('img.expand').length==0){dotclear.postExpander(widget);dotclear.viewPostContent(widget,'close');}}});$("#widgets-ref > li").draggable({tolerance:"move",cursor:"move",connectToSortable:".connected",helper:"clone",revert:"invalid",start:function(event,ui){ui.helper.css({'width':$('#widgets-ref > li').css('width')});}});$("li.ui-draggable, ul.ui-sortable li").not('ul.sortable-delete li, li.empty-widgets').css({'cursor':'move'});});