Changeset 21281
- Timestamp:
- 07/18/2012 10:41:43 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/widgets.dev.js
r21214 r21281 32 32 }); 33 33 34 $( 'a.widget-action').live('click', function(){35 var css = {}, widget = $(this).closest('div.widget'), inside = widget.children('.widget-inside'), w = parseInt( widget.find('input.widget-width').val(), 10 );36 37 if ( inside.is(':hidden')) {38 if ( w > 250 && inside.closest('div.widgets-sortables').length ) {39 css['width'] = w + 30 + 'px';40 if ( inside.closest('div.widget-liquid-right').length )41 css[margin] = 235 - w + 'px'; 42 widget.css(css);43 }44 wpWidgets.fixLabels(widget);45 inside.slideDown('fast');46 } else {47 inside.slideUp('fast', function() {48 widget.css({'width':'', margin:''});49 });50 }51 return false;52 });53 54 $('input.widget-control-save').live('click', function(){55 wpWidgets.save( $(this).closest('div.widget'), 0, 1, 0 );56 return false;57 });58 59 $('a.widget-control-remove').live('click', function(){60 wpWidgets.save( $(this).closest('div.widget'), 1, 1, 0 );61 return false;62 });63 64 $('a.widget-control-close').live('click', function(){65 wpWidgets.close( $(this).closest('div.widget'));66 return false;34 $(document.body).bind('click.widgets-toggle', function(e){ 35 var target = $(e.target), css = {}, widget, inside, w; 36 37 if ( target.parents('.widget-top').length && ! target.parents('#available-widgets').length ) { 38 widget = target.closest('div.widget'); 39 inside = widget.children('.widget-inside'); 40 w = parseInt( widget.find('input.widget-width').val(), 10 ); 41 42 if ( inside.is(':hidden') ) { 43 if ( w > 250 && inside.closest('div.widgets-sortables').length ) { 44 css['width'] = w + 30 + 'px'; 45 if ( inside.closest('div.widget-liquid-right').length ) 46 css[margin] = 235 - w + 'px'; 47 widget.css(css); 48 } 49 wpWidgets.fixLabels(widget); 50 inside.slideDown('fast'); 51 } else { 52 inside.slideUp('fast', function() { 53 widget.css({'width':'', margin:''}); 54 }); 55 } 56 e.preventDefault(); 57 } else if ( target.hasClass('widget-control-save') ) { 58 wpWidgets.save( target.closest('div.widget'), 0, 1, 0 ); 59 e.preventDefault(); 60 } else if ( target.hasClass('widget-control-remove') ) { 61 wpWidgets.save( target.closest('div.widget'), 1, 1, 0 ); 62 e.preventDefault(); 63 } else if ( target.hasClass('widget-control-close') ) { 64 wpWidgets.close( target.closest('div.widget') ); 65 e.preventDefault(); 66 } 67 67 }); 68 68
Note: See TracChangeset
for help on using the changeset viewer.