]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/widgets.js
WordPress 4.0-scripts
[autoinstalls/wordpress.git] / wp-admin / js / widgets.js
index 046907b40405bae9d678d9f9884d43c1ad3af2c5..81d2248cc4141b7cba8642ffa3efc76368b36c79 100644 (file)
@@ -50,10 +50,12 @@ wpWidgets = {
                                                css[ margin ] = widgetWidth - ( targetWidth + 30 ) + 'px';
                                                widget.css( css );
                                        }
+                                       widget.addClass( 'open' );
                                        inside.slideDown('fast');
                                } else {
                                        inside.slideUp('fast', function() {
                                                widget.attr( 'style', '' );
+                                               widget.removeClass( 'open' );
                                        });
                                }
                                e.preventDefault();
@@ -170,6 +172,7 @@ wpWidgets = {
 
                                        wpWidgets.save( $widget, 0, 0, 1 );
                                        $widget.find('input.add_new').val('');
+                                       $( document ).trigger( 'widget-added', [ $widget ] );
                                }
 
                                $sidebar = $widget.parent();
@@ -374,8 +377,9 @@ wpWidgets = {
                        } else {
                                $('.spinner').hide();
                                if ( r && r.length > 2 ) {
-                                       $( 'div.widget-content', widget ).html(r);
+                                       $( 'div.widget-content', widget ).html( r );
                                        wpWidgets.appendTitle( widget );
+                                       $( document ).trigger( 'widget-updated', [ widget ] );
                                }
                        }
                        if ( order ) {
@@ -440,6 +444,8 @@ wpWidgets = {
                // No longer "new" widget
                widget.find( 'input.add_new' ).val('');
 
+               $( document ).trigger( 'widget-added', [ widget ] );
+
                /*
                 * Check if any part of the sidebar is visible in the viewport. If it is, don't scroll.
                 * Otherwise, scroll up to so the sidebar is in view.