<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[11837] trunk: Speed up jQuery based scripts, props Denis-de-Bernardy,
  see #10021</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/11837">11837</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-08-18 09:53:37 +0000 (Tue, 18 Aug 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Speed up jQuery based scripts, props Denis-de-Bernardy, see <a href="http://trac.wordpress.org/ticket/10021">#10021</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjscommondevjs">trunk/wp-admin/js/common.dev.js</a></li>
<li><a href="#trunkwpadminjscommonjs">trunk/wp-admin/js/common.js</a></li>
<li><a href="#trunkwpadminjswidgetsdevjs">trunk/wp-admin/js/widgets.dev.js</a></li>
<li><a href="#trunkwpadminjswidgetsjs">trunk/wp-admin/js/widgets.js</a></li>
<li><a href="#trunkwpadminwidgetsphp">trunk/wp-admin/widgets.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjscommondevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/common.dev.js (11836 => 11837)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/common.dev.js        2009-08-17 01:38:01 UTC (rev 11836)
+++ trunk/wp-admin/js/common.dev.js        2009-08-18 09:53:37 UTC (rev 11837)
</span><span class="lines">@@ -2,18 +2,20 @@
</span><span class="cx"> (function($){
</span><span class="cx"> // sidebar admin menu
</span><span class="cx"> adminMenu = {
</span><ins>+        init : function() {
+                var menu = $('#adminmenu');
</ins><span class="cx"> 
</span><del>-        init : function() {
-                $('#adminmenu div.wp-menu-toggle').each( function() {
-                        if ( $(this).siblings('.wp-submenu').length )
-                                $(this).click(function(){ adminMenu.toggle( $(this).siblings('.wp-submenu') ); });
</del><ins>+                $('.wp-menu-toggle', menu).each( function() {
+                        var t = $(this), sub = t.siblings('.wp-submenu');
+                        if ( sub.length )
+                                t.click(function(){ adminMenu.toggle( sub ); });
</ins><span class="cx">                         else
</span><del>-                                $(this).hide();
</del><ins>+                                t.hide();
</ins><span class="cx">                 });
</span><del>-
</del><ins>+                
</ins><span class="cx">                 this.favorites();
</span><del>-
-                $('a.separator').click(function(){
</del><ins>+                
+                $('.separator', menu).click(function(){
</ins><span class="cx">                         if ( $('body').hasClass('folded') ) {
</span><span class="cx">                                 adminMenu.fold(1);
</span><span class="cx">                                 deleteUserSetting( 'mfold' );
</span><span class="lines">@@ -24,27 +26,31 @@
</span><span class="cx">                         return false;
</span><span class="cx">                 });
</span><span class="cx"> 
</span><del>-                if ( $('body').hasClass('folded') ) {
</del><ins>+                if ( $('body').hasClass('folded') )
</ins><span class="cx">                         this.fold();
</span><del>-                }
</del><ins>+                
</ins><span class="cx">                 this.restoreMenuState();
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         restoreMenuState : function() {
</span><del>-                $('#adminmenu li.wp-has-submenu').each(function(i, e) {
</del><ins>+                $('li.wp-has-submenu', '#adminmenu').each(function(i, e) {
</ins><span class="cx">                         var v = getUserSetting( 'm'+i );
</span><del>-                        if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
</del><ins>+                        if ( $(e).hasClass('wp-has-current-submenu') )
+                                return true; // leave the current parent open
</ins><span class="cx"> 
</span><del>-                        if ( 'o' == v ) $(e).addClass('wp-menu-open');
-                        else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
</del><ins>+                        if ( 'o' == v )
+                                $(e).addClass('wp-menu-open');
+                        else if ( 'c' == v )
+                                $(e).removeClass('wp-menu-open');
</ins><span class="cx">                 });
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         toggle : function(el) {
</span><ins>+                el['slideToggle'](150, function() {
+                        el.css('display','');
+                }).parent().toggleClass( 'wp-menu-open' );
</ins><span class="cx"> 
</span><del>-                el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'wp-menu-open' );
-
-                $('#adminmenu li.wp-has-submenu').each(function(i, e) {
</del><ins>+                $('.wp-has-submenu', '#adminmenu').each(function(i, e) {
</ins><span class="cx">                         var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
</span><span class="cx">                         setUserSetting( 'm'+i, v );
</span><span class="cx">                 });
</span><span class="lines">@@ -62,14 +68,14 @@
</span><span class="cx">                                 over: function(e){
</span><span class="cx">                                         var m, b, h, o, f;
</span><span class="cx">                                         m = $(this).find('.wp-submenu');
</span><del>-                                        b = m.parent().offset().top + m.height() + 1; // Bottom offset of the menu
</del><ins>+                                        b = $(this).offset().top + m.height() + 1; // Bottom offset of the menu
</ins><span class="cx">                                         h = $('#wpwrap').height(); // Height of the entire page
</span><span class="cx">                                         o = 60 + b - h;
</span><del>-                                        f = $(window).height() + $('body').scrollTop() - 15; // The fold
-                                        if (f &lt; (b - o)) {
</del><ins>+                                        f = $(window).height() + $(window).scrollTop() - 15; // The fold
+                                        if ( f &lt; (b - o) ) {
</ins><span class="cx">                                                 o = b - f;
</span><span class="cx">                                         }
</span><del>-                                        if (o &gt; 1) {
</del><ins>+                                        if ( o &gt; 1 ) {
</ins><span class="cx">                                                 m.css({'marginTop':'-'+o+'px'});
</span><span class="cx">                                         } else if ( m.css('marginTop') ) {
</span><span class="cx">                                                 m.css({'marginTop':''});
</span><span class="lines">@@ -86,27 +92,42 @@
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         favorites : function() {
</span><del>-                $('#favorite-inside').width($('#favorite-actions').width()-4);
-                $('#favorite-toggle, #favorite-inside').bind( 'mouseenter', function(){$('#favorite-inside').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideDown') ) { $('#favorite-inside').slideDown(100); $('#favorite-first').addClass('slide-down'); }}, 200) } );
-
-                $('#favorite-toggle, #favorite-inside').bind( 'mouseleave', function(){$('#favorite-inside').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideUp') ) { $('#favorite-inside').slideUp(100, function(){ $('#favorite-first').removeClass('slide-down'); } ); }}, 300) } );
</del><ins>+                $('#favorite-inside').width( $('#favorite-actions').width() - 4 );
+                $('#favorite-toggle, #favorite-inside').bind('mouseenter', function() {
+                        $('#favorite-inside').removeClass('slideUp').addClass('slideDown');
+                        setTimeout(function() {
+                                if ( $('#favorite-inside').hasClass('slideDown') ) {
+                                        $('#favorite-inside').slideDown(100);
+                                        $('#favorite-first').addClass('slide-down');
+                                }
+                        }, 200);
+                }).bind('mouseleave', function() {
+                        $('#favorite-inside').removeClass('slideDown').addClass('slideUp');
+                        setTimeout(function() {
+                                if ( $('#favorite-inside').hasClass('slideUp') ) {
+                                        $('#favorite-inside').slideUp(100, function() {
+                                                $('#favorite-first').removeClass('slide-down');
+                                        });
+                                }
+                        }, 300);
+                });
</ins><span class="cx">         }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-$(document).ready(function(){adminMenu.init();});
</del><ins>+$(document).ready(function(){ adminMenu.init(); });
</ins><span class="cx"> 
</span><span class="cx"> // show/hide/save table columns
</span><span class="cx"> columns = {
</span><span class="cx">         init : function() {
</span><del>-                $('.hide-column-tog').click( function() {
-                        var column = $(this).val(), show = $(this).attr('checked');
-                        if ( show ) {
</del><ins>+                $('.hide-column-tog', '#adv-settings').click( function() {
+                        var column = $(this).val();
+                        if ( $(this).attr('checked') )
</ins><span class="cx">                                 $('.column-' + column).show();
</span><del>-                        } else {
</del><ins>+                        else
</ins><span class="cx">                                 $('.column-' + column).hide();
</span><del>-                        }
</del><ins>+
</ins><span class="cx">                         columns.save_manage_columns_state();
</span><del>-                } );
</del><ins>+                });
</ins><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         save_manage_columns_state : function() {
</span><span class="lines">@@ -148,17 +169,20 @@
</span><span class="cx">         var lastClicked = false, checks, first, last, checked;
</span><span class="cx"> 
</span><span class="cx">         // pulse
</span><del>-        $('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
</del><ins>+        $('div.fade').animate( { opacity: .5 }, 400)
+        .animate( { opacity: 1 }, 400)
+        .animate( { opacity: .5 }, 400)
+        .animate( { opacity: 1 }, 400);
</ins><span class="cx"> 
</span><span class="cx">         // Move .updated and .error alert boxes
</span><del>-        $('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');
-        $('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');
</del><ins>+        $('div.wrap').children('h2:first').nextAll('div.updated, div.error').addClass('below-h2');
+        $('div.updated, div.error').not('.below-h2').insertAfter( $('div.wrap').children('h2:first') );
</ins><span class="cx"> 
</span><span class="cx">         // screen settings tab
</span><span class="cx">         $('#show-settings-link').click(function () {
</span><del>-                if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
</del><ins>+                if ( ! $('#screen-options-wrap').hasClass('screen-options-open') )
</ins><span class="cx">                         $('#contextual-help-link-wrap').css('visibility', 'hidden');
</span><del>-                }
</del><ins>+
</ins><span class="cx">                 $('#screen-options-wrap').slideToggle('fast', function(){
</span><span class="cx">                         if ( $(this).hasClass('screen-options-open') ) {
</span><span class="cx">                                 $('#show-settings-link').css({'backgroundImage':'url(&quot;images/screen-options-right.gif&quot;)'});
</span><span class="lines">@@ -174,10 +198,10 @@
</span><span class="cx"> 
</span><span class="cx">         // help tab
</span><span class="cx">         $('#contextual-help-link').click(function () {
</span><del>-                if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) {
</del><ins>+                if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') )
</ins><span class="cx">                         $('#screen-options-link-wrap').css('visibility', 'hidden');
</span><del>-                }
-                $('#contextual-help-wrap').slideToggle('fast', function(){
</del><ins>+
+                $('#contextual-help-wrap').slideToggle('fast', function() {
</ins><span class="cx">                         if ( $(this).hasClass('contextual-help-open') ) {
</span><span class="cx">                                 $('#contextual-help-link').css({'backgroundImage':'url(&quot;images/screen-options-right.gif&quot;)'});
</span><span class="cx">                                 $('#screen-options-link-wrap').css('visibility', '');
</span><span class="lines">@@ -189,20 +213,19 @@
</span><span class="cx">                 });
</span><span class="cx">                 return false;
</span><span class="cx">         });
</span><del>-        $('#contextual-help-link-wrap, #screen-options-link-wrap').show();
</del><span class="cx"> 
</span><span class="cx">         // check all checkboxes
</span><del>-        $( 'table:visible tbody .check-column :checkbox' ).click( function(e) {
</del><ins>+        $('tbody').children().children('.check-column').find(':checkbox').click( function(e) {
</ins><span class="cx">                 if ( 'undefined' == e.shiftKey ) { return true; }
</span><span class="cx">                 if ( e.shiftKey ) {
</span><span class="cx">                         if ( !lastClicked ) { return true; }
</span><del>-                        checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
</del><ins>+                        checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' );
</ins><span class="cx">                         first = checks.index( lastClicked );
</span><span class="cx">                         last = checks.index( this );
</span><span class="cx">                         checked = $(this).attr('checked');
</span><span class="cx">                         if ( 0 &lt; first &amp;&amp; 0 &lt; last &amp;&amp; first != last ) {
</span><span class="cx">                                 checks.slice( first, last ).attr( 'checked', function(){
</span><del>-                                        if ( $(this).parents('tr').is(':visible') )
</del><ins>+                                        if ( $(this).closest('tr').is(':visible') )
</ins><span class="cx">                                                 return checked ? 'checked' : '';
</span><span class="cx"> 
</span><span class="cx">                                         return '';
</span><span class="lines">@@ -211,13 +234,17 @@
</span><span class="cx">                 }
</span><span class="cx">                 lastClicked = this;
</span><span class="cx">                 return true;
</span><del>-        } );
-        $( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
-                var c = $(this).attr('checked'), kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, toggle = e.shiftKey || kbtoggle;
</del><ins>+        });
</ins><span class="cx"> 
</span><del>-
-                $(this).parents( 'form:first' ).find( 'table tbody:visible' ).find( '.check-column :checkbox' ).attr( 'checked', function() {
-                        if ( $(this).parents('tr').is(':hidden') )
</del><ins>+        $('thead, tfoot').find(':checkbox').click( function(e) {
+                var c = $(this).attr('checked'),
+                        kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard,
+                        toggle = e.shiftKey || kbtoggle;
+                
+                $(this).closest( 'table' ).children( 'tbody' ).filter(':visible')
+                .children().children('.check-column').find(':checkbox')
+                .attr('checked', function() {
+                        if ( $(this).closest('tr').is(':hidden') )
</ins><span class="cx">                                 return '';
</span><span class="cx">                         if ( toggle )
</span><span class="cx">                                 return $(this).attr( 'checked' ) ? '' : 'checked';
</span><span class="lines">@@ -225,7 +252,10 @@
</span><span class="cx">                                 return 'checked';
</span><span class="cx">                         return '';
</span><span class="cx">                 });
</span><del>-                $(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
</del><ins>+
+                $(this).closest('table').children('thead,  tfoot').filter(':visible')
+                .children().children('.check-column').find(':checkbox')
+                .attr('checked', function() {
</ins><span class="cx">                         if ( toggle )
</span><span class="cx">                                 return '';
</span><span class="cx">                         else if (c)
</span><span class="lines">@@ -233,17 +263,16 @@
</span><span class="cx">                         return '';
</span><span class="cx">                 });
</span><span class="cx">         });
</span><ins>+
</ins><span class="cx">         $('#default-password-nag-no').click( function() {
</span><span class="cx">                 setUserSetting('default_password_nag', 'hide');
</span><span class="cx">                 $('div.default-password-nag').hide();
</span><span class="cx">                 return false;
</span><span class="cx">         });
</span><del>-        
-        
</del><span class="cx"> });
</span><span class="cx"> 
</span><span class="cx"> jQuery(document).ready( function($){
</span><del>-        var turboNag = $('.turbo-nag');
</del><ins>+        var turboNag = $('span.turbo-nag', '#user_info');
</ins><span class="cx"> 
</span><span class="cx">         if ( !turboNag.length || ('undefined' != typeof(google) &amp;&amp; google.gears) )
</span><span class="cx">                 return;
</span><span class="lines">@@ -260,5 +289,4 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         turboNag.show();
</span><del>-
</del><span class="cx"> });
</span></span></pre></div>
<a id="trunkwpadminjscommonjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/common.js (11836 => 11837)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/common.js        2009-08-17 01:38:01 UTC (rev 11836)
+++ trunk/wp-admin/js/common.js        2009-08-18 09:53:37 UTC (rev 11837)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){a(&quot;#adminmenu div.wp-menu-toggle&quot;).each(function(){if(a(this).siblings(&quot;.wp-submenu&quot;).length){a(this).click(function(){adminMenu.toggle(a(this).siblings(&quot;.wp-submenu&quot;))})}else{a(this).hide()}});this.favorites();a(&quot;a.separator&quot;).click(function(){if(a(&quot;body&quot;).hasClass(&quot;folded&quot;)){adminMenu.fold(1);deleteUserSetting(&quot;mfold&quot;)}else{adminMenu.fold();setUserSetting(&quot;mfold&quot;,&quot;f&quot;)}return false});if(a(&quot;body&quot;).hasClass(&quot;folded&quot;)){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a(&quot;#adminmenu li.wp-has-submenu&quot;).each(function(c,d){var b=getUserSetting(&quot;m&quot;+c);if(a(d).hasClass(&quot;wp-has-current-submenu&quot;)){return true}if(&quot;o&quot;==b){a(d).addClass(&quot;wp-menu-open&quot;)}else{if(&quot;c&quot;==b){a(d).removeClass(&quot;wp-menu-open&quot;)}}})},toggle:function(b){b.slideToggle(150,function(){b.css(&quot;display&quot;,&quot;&quot;)}).parent().toggleClass(&quot;wp-menu-open&quot;);a(&quot;#adminmenu li.wp-has-submenu&quot;).each(function(d,f){var c=a(f).hasClass(&quot;wp-menu-open&quot;)?&quot;o&quot;:&quot;c&quot;;setUserSetting(&quot;m&quot;+d,c)});return false},fold:function(b){if(b){a(&quot;body&quot;).removeClass(&quot;folded&quot;);a(&quot;#adminmenu li.wp-has-submenu&quot;).unbind()}else{a(&quot;body&quot;).addClass(&quot;folded&quot;);a(&quot;#adminmenu li.wp-has-submenu&quot;).hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(&quot;.wp-submenu&quot;);c=d.parent().offset().top+d.height()+1;g=a(&quot;#wpwrap&quot;).height();k=60+c-g;i=a(window).height()+a(&quot;body&quot;).scrollTop()-15;if(i&lt;(c-k)){k=c-i}if(k&gt;1){d.css({marginTop:&quot;-&quot;+k+&quot;px&quot;})}else{if(d.css(&quot;marginTop&quot;)){d.css({marginTop:&quot;&quot;})}}d.addClass(&quot;sub-open&quot;)},out:function(){a(this).find(&quot;.wp-submenu&quot;).removeClass(&quot;sub-open&quot;).css({marginTop:&quot;&quot;})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a(&quot;#favorite-inside&quot;).width(a(&quot;#favorite-actions&quot;).width()-4);a(&quot;#favorite-toggle, #favorite-inside&quot;).bind(&quot;mouseenter&quot;,function(){a(&quot;#favorite-inside&quot;).removeClass(&quot;slideUp&quot;).addClass(&quot;slideDown&quot;);setTimeout(function(){if(a(&quot;#favorite-inside&quot;).hasClass(&quot;slideDown&quot;)){a(&quot;#favorite-inside&quot;).slideDown(100);a(&quot;#favorite-first&quot;).addClass(&quot;slide-down&quot;)}},200)});a(&quot;#favorite-toggle, #favorite-inside&quot;).bind(&quot;mouseleave&quot;,function(){a(&quot;#favorite-inside&quot;).removeClass(&quot;slideDown&quot;).addClass(&quot;slideUp&quot;);setTimeout(function(){if(a(&quot;#favorite-inside&quot;).hasClass(&quot;slideUp&quot;)){a(&quot;#favorite-inside&quot;).slideUp(100,function(){a(&quot;#favorite-first&quot;).removeClass(&quot;slide-down&quot;)})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(&quot;.hide-column-tog&quot;).click(function(){var c=a(this).val(),b=a(this).attr(&quot;checked&quot;);if(b){a(&quot;.column-&quot;+c).show()}else{a(&quot;.column-&quot;+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(&quot;.manage-column&quot;).filter(&quot;:hidden&quot;).map(function(){return this.id}).get().join(&quot;,&quot;);a.post(ajaxurl,{action:&quot;hidden-columns&quot;,hidden:b,screenoptionnonce:a(&quot;#screenoptionnonce&quot;).val(),page:pagenow})}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(&quot;.form-required&quot;).filter(function(){return a(&quot;input:visible&quot;,this).val()==&quot;&quot;}).addClass(&quot;form-invalid&quot;).change(function(){a(this).removeClass(&quot;form-invalid&quot;)}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||&quot;&quot;;if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(&quot;.fade&quot;).animate({backgroundColor:&quot;#ffffe0&quot;},300).animate({backgroundColor:&quot;#fffbcc&quot;},300).animate({backgroundColor:&quot;#ffffe0&quot;},300).animate({backgroundColor:&quot;#fffbcc&quot;},300);d(&quot;div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error&quot;).addClass(&quot;below-h2&quot;);d(&quot;div.updated, div.error&quot;).not(&quot;.below-h2&quot;).insertAfter(&quot;div.wrap h2:first&quot;);d(&quot;#show-settings-link&quot;).click(function(){if(!d(&quot;#screen-options-wrap&quot;).hasClass(&quot;screen-options-open&quot;)){d(&quot;#contextual-help-link-wrap&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;)}d(&quot;#screen-options-wrap&quot;).slideToggle(&quot;fast&quot;,function(){if(d(this).hasClass(&quot;screen-options-open&quot;)){d(&quot;#show-settings-link&quot;).css({backgroundImage:'url(&quot;images/screen-options-right.gif&quot;)'});d(&quot;#contextual-help-link-wrap&quot;).css(&quot;visibility&quot;,&quot;&quot;);d(this).removeClass(&quot;screen-options-open&quot;)}else{d(&quot;#show-settings-link&quot;).css({backgroundImage:'url(&quot;images/screen-options-right-up.gif&quot;)'});d(this).addClass(&quot;screen-options-open&quot;)}});return false});d(&quot;#contextual-help-link&quot;).click(function(){if(!d(&quot;#contextual-help-wrap&quot;).hasClass(&quot;contextual-help-open&quot;)){d(&quot;#screen-options-link-wrap&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;)}d(&quot;#contextual-help-wrap&quot;).slideToggle(&quot;fast&quot;,function(){if(d(this).hasClass(&quot;contextual-help-open&quot;)){d(&quot;#contextual-help-link&quot;).css({backgroundImage:'url(&quot;images/screen-options-right.gif&quot;)'});d(&quot;#screen-options-link-wrap&quot;).css(&quot;visibility&quot;,&quot;&quot;);d(this).removeClass(&quot;contextual-help-open&quot;)}else{d(&quot;#contextual-help-link&quot;).css({backgroundImage:'url(&quot;images/screen-options-right-up.gif&quot;)'});d(this).addClass(&quot;contextual-help-open&quot;)}});return false});d(&quot;#contextual-help-link-wrap, #screen-options-link-wrap&quot;).show();d(&quot;table:visible tbody .check-column :checkbox&quot;).click(function(g){if(&quot;undefined&quot;==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents(&quot;form:first&quot;).find(&quot;:checkbox&quot;);e=a.index(f);c=a.index(this);b=d(this).attr(&quot;checked&quot;);if(0&lt;e&amp;&amp;0&lt;c&amp;&amp;e!=c){a.slice(e,c).attr(&quot;checked&quot;,function(){if(d(this).parents(&quot;tr&quot;).is(&quot;:visible&quot;)){return b?&quot;checked&quot;:&quot;&quot;}return&quot;&quot;})}}f=this;return true});d(&quot;thead :checkbox, tfoot :checkbox&quot;).click(function(i){var j=d(this).attr(&quot;checked&quot;),h=&quot;undefined&quot;==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents(&quot;form:first&quot;).find(&quot;table tbody:visible&quot;).find(&quot;.check-column :checkbox&quot;).attr(&quot;checked&quot;,function(){if(d(this).parents(&quot;tr&quot;).is(&quot;:hidden&quot;)){return&quot;&quot;}if(g){return d(this).attr(&quot;checked&quot;)?&quot;&quot;:&quot;checked&quot;}else{if(j){return&quot;checked&quot;}}return&quot;&quot;});d(this).parents(&quot;form:first&quot;).find(&quot;table thead:visible, table tfoot:visible&quot;).find(&quot;.check-column :checkbox&quot;).attr(&quot;checked&quot;,function(){if(g){return&quot;&quot;}else{if(j){return&quot;checked&quot;}}return&quot;&quot;})});d(&quot;#default-password-nag-no&quot;).click(function(){setUserSetting(&quot;default_password_nag&quot;,&quot;hide&quot;);d(&quot;div.default-password-nag&quot;).hide();return false})});jQuery(document).ready(function(b){var a=b(&quot;.turbo-nag&quot;);if(!a.length||(&quot;undefined&quot;!=typeof(google)&amp;&amp;google.gears)){return}if(&quot;undefined&quot;!=typeof GearsFactory){return}else{try{if((&quot;undefined&quot;!=typeof window.ActiveXObject&amp;&amp;ActiveXObject(&quot;Gears.Factory&quot;))||(&quot;undefined&quot;!=typeof navigator.mimeTypes&amp;&amp;navigator.mimeTypes[&quot;application/x-googlegears&quot;])){return}}catch(c){}}a.show()});
</del><span class="cx">\ No newline at end of file
</span><ins>+var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){var b=a(&quot;#adminmenu&quot;);a(&quot;.wp-menu-toggle&quot;,b).each(function(){var c=a(this),d=c.siblings(&quot;.wp-submenu&quot;);if(d.length){c.click(function(){adminMenu.toggle(d)})}else{c.hide()}});this.favorites();a(&quot;.separator&quot;,b).click(function(){if(a(&quot;body&quot;).hasClass(&quot;folded&quot;)){adminMenu.fold(1);deleteUserSetting(&quot;mfold&quot;)}else{adminMenu.fold();setUserSetting(&quot;mfold&quot;,&quot;f&quot;)}return false});if(a(&quot;body&quot;).hasClass(&quot;folded&quot;)){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a(&quot;.wp-has-submenu&quot;,&quot;#adminmenu&quot;).each(function(c,d){var b=getUserSetting(&quot;m&quot;+c);if(a(d).hasClass(&quot;wp-has-current-submenu&quot;)){return true}if(&quot;o&quot;==b){a(d).addClass(&quot;wp-menu-open&quot;)}else{if(&quot;c&quot;==b){a(d).removeClass(&quot;wp-menu-open&quot;)}}})},toggle:function(b){b.slideToggle(150,function(){b.css(&quot;display&quot;,&quot;&quot;)}).parent().toggleClass(&quot;wp-menu-open&quot;);a(&quot;.wp-has-submenu&quot;,&quot;#adminmenu&quot;).each(function(d,f){var c=a(f).hasClass(&quot;wp-menu-open&quot;)?&quot;o&quot;:&quot;c&quot;;setUserSetting(&quot;m&quot;+d,c)});return false},fold:function(b){if(b){a(&quot;body&quot;).removeClass(&quot;folded&quot;);a(&quot;#adminmenu li.wp-has-submenu&quot;).unbind()}else{a(&quot;body&quot;).addClass(&quot;folded&quot;);a(&quot;#adminmenu li.wp-has-submenu&quot;).hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(&quot;.wp-submenu&quot;);c=a(this).offset().top+d.height()+1;g=a(&quot;#wpwrap&quot;).height();k=60+c-g;i=a(window).height()+a(window).scrollTop()-15;if(i&lt;(c-k)){k=c-i}if(k&gt;1){d.css({marginTop:&quot;-&quot;+k+&quot;px&quot;})}else{if(d.css(&quot;marginTop&quot;)){d.css({marginTop:&quot;&quot;})}}d.addClass(&quot;sub-open&quot;)},out:function(){a(this).find(&quot;.wp-submenu&quot;).removeClass(&quot;sub-open&quot;).css({marginTop:&quot;&quot;})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a(&quot;#favorite-inside&quot;).width(a(&quot;#favorite-actions&quot;).width()-4);a(&quot;#favorite-toggle, #favorite-inside&quot;).bind(&quot;mouseenter&quot;,function(){a(&quot;#favorite-inside&quot;).removeClass(&quot;slideUp&quot;).addClass(&quot;slideDown&quot;);setTimeout(function(){if(a(&quot;#favorite-inside&quot;).hasClass(&quot;slideDown&quot;)){a(&quot;#favorite-inside&quot;).slideDown(100);a(&quot;#favorite-first&quot;).addClass(&quot;slide-down&quot;)}},200)}).bind(&quot;mouseleave&quot;,function(){a(&quot;#favorite-inside&quot;).removeClass(&quot;slideDown&quot;).addClass(&quot;slideUp&quot;);setTimeout(function(){if(a(&quot;#favorite-inside&quot;).hasClass(&quot;slideUp&quot;)){a(&quot;#favorite-inside&quot;).slideUp(100,function(){a(&quot;#favorite-first&quot;).removeClass(&quot;slide-down&quot;)})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(&quot;.hide-column-tog&quot;,&quot;#adv-settings&quot;).click(function(){var b=a(this).val();if(a(this).attr(&quot;checked&quot;)){a(&quot;.column-&quot;+b).show()}else{a(&quot;.column-&quot;+b).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(&quot;.manage-column&quot;).filter(&quot;:hidden&quot;).map(function(){return this.id}).get().join(&quot;,&quot;);a.post(ajaxurl,{action:&quot;hidden-columns&quot;,hidden:b,screenoptionnonce:a(&quot;#screenoptionnonce&quot;).val(),page:pagenow})}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(&quot;.form-required&quot;).filter(function(){return a(&quot;input:visible&quot;,this).val()==&quot;&quot;}).addClass(&quot;form-invalid&quot;).change(function(){a(this).removeClass(&quot;form-invalid&quot;)}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||&quot;&quot;;if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(&quot;div.fade&quot;).animate({opacity:0.5},400).animate({opacity:1},400).animate({opacity:0.5},400).animate({opacity:1},400);d(&quot;div.wrap&quot;).children(&quot;h2:first&quot;).nextAll(&quot;div.updated, div.error&quot;).addClass(&quot;below-h2&quot;);d(&quot;div.updated, div.error&quot;).not(&quot;.below-h2&quot;).insertAfter(d(&quot;div.wrap&quot;).children(&quot;h2:first&quot;));d(&quot;#show-settings-link&quot;).click(function(){if(!d(&quot;#screen-options-wrap&quot;).hasClass(&quot;screen-options-open&quot;)){d(&quot;#contextual-help-link-wrap&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;)}d(&quot;#screen-options-wrap&quot;).slideToggle(&quot;fast&quot;,function(){if(d(this).hasClass(&quot;screen-options-open&quot;)){d(&quot;#show-settings-link&quot;).css({backgroundImage:'url(&quot;images/screen-options-right.gif&quot;)'});d(&quot;#contextual-help-link-wrap&quot;).css(&quot;visibility&quot;,&quot;&quot;);d(this).removeClass(&quot;screen-options-open&quot;)}else{d(&quot;#show-settings-link&quot;).css({backgroundImage:'url(&quot;images/screen-options-right-up.gif&quot;)'});d(this).addClass(&quot;screen-options-open&quot;)}});return false});d(&quot;#contextual-help-link&quot;).click(function(){if(!d(&quot;#contextual-help-wrap&quot;).hasClass(&quot;contextual-help-open&quot;)){d(&quot;#screen-options-link-wrap&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;)}d(&quot;#contextual-help-wrap&quot;).slideToggle(&quot;fast&quot;,function(){if(d(this).hasClass(&quot;contextual-help-open&quot;)){d(&quot;#contextual-help-link&quot;).css({backgroundImage:'url(&quot;images/screen-options-right.gif&quot;)'});d(&quot;#screen-options-link-wrap&quot;).css(&quot;visibility&quot;,&quot;&quot;);d(this).removeClass(&quot;contextual-help-open&quot;)}else{d(&quot;#contextual-help-link&quot;).css({backgroundImage:'url(&quot;images/screen-options-right-up.gif&quot;)'});d(this).addClass(&quot;contextual-help-open&quot;)}});return false});d(&quot;tbody&quot;).children().children(&quot;.check-column&quot;).find(&quot;:checkbox&quot;).click(function(g){if(&quot;undefined&quot;==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).closest(&quot;form&quot;).find(&quot;:checkbox&quot;);e=a.index(f);c=a.index(this);b=d(this).attr(&quot;checked&quot;);if(0&lt;e&amp;&amp;0&lt;c&amp;&amp;e!=c){a.slice(e,c).attr(&quot;checked&quot;,function(){if(d(this).closest(&quot;tr&quot;).is(&quot;:visible&quot;)){return b?&quot;checked&quot;:&quot;&quot;}return&quot;&quot;})}}f=this;return true});d(&quot;thead, tfoot&quot;).find(&quot;:checkbox&quot;).click(function(i){var j=d(this).attr(&quot;checked&quot;),h=&quot;undefined&quot;==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).closest(&quot;table&quot;).children(&quot;tbody&quot;).filter(&quot;:visible&quot;).children().children(&quot;.check-column&quot;).find(&quot;:checkbox&quot;).attr(&quot;checked&quot;,function(){if(d(this).closest(&quot;tr&quot;).is(&quot;:hidden&quot;)){return&quot;&quot;}if(g){return d(this).attr(&quot;checked&quot;)?&quot;&quot;:&quot;checked&quot;}else{if(j){return&quot;checked&quot;}}return&quot;&quot;});d(this).closest(&quot;table&quot;).children(&quot;thead,  tfoot&quot;).filter(&quot;:visible&quot;).children().children(&quot;.check-column&quot;).find(&quot;:checkbox&quot;).attr(&quot;checked&quot;,function(){if(g){return&quot;&quot;}else{if(j){return&quot;checked&quot;}}return&quot;&quot;})});d(&quot;#default-password-nag-no&quot;).click(function(){setUserSetting(&quot;default_password_nag&quot;,&quot;hide&quot;);d(&quot;div.default-password-nag&quot;).hide();return false})});jQuery(document).ready(function(b){var a=b(&quot;span.turbo-nag&quot;,&quot;#user_info&quot;);if(!a.length||(&quot;undefined&quot;!=typeof(google)&amp;&amp;google.gears)){return}if(&quot;undefined&quot;!=typeof GearsFactory){return}else{try{if((&quot;undefined&quot;!=typeof window.ActiveXObject&amp;&amp;ActiveXObject(&quot;Gears.Factory&quot;))||(&quot;undefined&quot;!=typeof navigator.mimeTypes&amp;&amp;navigator.mimeTypes[&quot;application/x-googlegears&quot;])){return}}catch(c){}}a.show()});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjswidgetsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/widgets.dev.js (11836 => 11837)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/widgets.dev.js        2009-08-17 01:38:01 UTC (rev 11836)
+++ trunk/wp-admin/js/widgets.dev.js        2009-08-18 09:53:37 UTC (rev 11837)
</span><span class="lines">@@ -1,74 +1,83 @@
</span><del>-
</del><span class="cx"> var wpWidgets;
</span><span class="cx"> (function($) {
</span><span class="cx"> 
</span><span class="cx"> wpWidgets = {
</span><ins>+
</ins><span class="cx">         init : function() {
</span><del>-        var rem;
</del><ins>+                var rem, sidebars = $('div.widgets-sortables');
</ins><span class="cx"> 
</span><del>-                if ( $('body').hasClass('widgets_access') ) {
-                        return;
-                }
-
-                $('#widgets-right div.sidebar-name').click(function(){
-            var c = $(this).siblings('.widgets-sortables');
-                        if ( c.is(':visible') ) {
</del><ins>+                $('#widgets-right').children('.widgets-holder-wrap').children('.sidebar-name').click(function(){
+                        var c = $(this).siblings('.widgets-sortables'), p = $(this).parent();
+                        if ( !p.hasClass('closed') ) {
</ins><span class="cx">                                 c.sortable('disable');
</span><del>-                                $(this).parent().addClass('closed');
</del><ins>+                                p.addClass('closed');
</ins><span class="cx">                         } else {
</span><del>-                                $(this).parent().removeClass('closed');
</del><ins>+                                p.removeClass('closed');
</ins><span class="cx">                                 c.sortable('enable').sortable('refresh');
</span><span class="cx">                         }
</span><del>-        });
</del><ins>+                });
</ins><span class="cx"> 
</span><del>-        $('#widgets-left div.sidebar-name').click(function(){
-                        if ( $(this).siblings('.widget-holder').is(':visible') ) {
-                                $(this).parent().addClass('closed');
</del><ins>+                $('#widgets-left').children('.widgets-holder-wrap').children('.sidebar-name').click(function() {
+                        $(this).siblings('.widget-holder').parent().toggleClass('closed');
+                });
+
+                sidebars.not('#wp_inactive_widgets').each(function(){
+                        var h = 50, H = $(this).children('.widget').length;
+                        h = h + parseInt(H * 48, 10);
+                        $(this).css( 'minHeight', h + 'px' );
+                });
+
+                $('a.widget-action').live('click', function(){
+                        var css = {}, widget = $(this).closest('div.widget'), inside = widget.children('.widget-inside'), w = parseInt( widget.find('input.widget-width').val(), 10 );
+                        
+                        if ( inside.is(':hidden') ) {
+                                if ( w &gt; 250 &amp;&amp; inside.closest('div.widgets-sortables').length ) {
+                                        css['width'] = w + 30 + 'px';
+                                        if ( inside.closest('div.widget-liquid-right').length )
+                                                css['marginLeft'] = 235 - w + 'px';
+                                        widget.css(css);
+                                }
+                                wpWidgets.fixLabels(widget);
+                                inside.slideDown('fast');
</ins><span class="cx">                         } else {
</span><del>-                                $(this).parent().removeClass('closed');
</del><ins>+                                inside.slideUp('fast', function() {
+                                        widget.css({'width':'','marginLeft':''});
+                                });
</ins><span class="cx">                         }
</span><del>-        });
</del><ins>+                        return false;
+                });
</ins><span class="cx"> 
</span><del>-                $('#widgets-right .widget, #wp_inactive_widgets .widget').each(function(){
-                        wpWidgets.appendTitle(this);
</del><ins>+                $('input.widget-control-save').live('click', function(){
+                        wpWidgets.save( $(this).closest('div.widget'), 0, 1, 0 );
+                        return false;
</ins><span class="cx">                 });
</span><span class="cx"> 
</span><del>-                this.addEvents();
-        $('.widget-error').parents('.widget').find('a.widget-action').click();
</del><ins>+                $('a.widget-control-remove').live('click', function(){
+                        wpWidgets.save( $(this).closest('div.widget'), 1, 1, 0 );
+                        return false;
+                });
</ins><span class="cx"> 
</span><del>-                $('#available-widgets').droppable({
-                        tolerance: 'pointer',
-                        accept: function(o){
-                                return $(o).parent().attr('id') != 'widget-list';
-                        },
-                        drop: function(e,ui) {
-                                ui.draggable.addClass('deleting');
-                                $('#removing-widget').hide().children('span').html('');
-                        },
-                        over: function(e,ui) {
-                                ui.draggable.addClass('deleting');
-                                $('.widget-placeholder').hide();
</del><ins>+                $('a.widget-control-close').live('click', function(){
+                        wpWidgets.close( $(this).closest('div.widget') );
+                        return false;
+                });
</ins><span class="cx"> 
</span><del>-                                if ( ui.draggable.hasClass('ui-sortable-helper') )
-                                        $('#removing-widget').show().children('span').html( ui.draggable.find('.widget-title h4').html() );
-                        },
-                        out: function(e,ui) {
-                                ui.draggable.removeClass('deleting');
-                                $('.widget-placeholder').show();
-                                $('#removing-widget').hide().children('span').html('');
-                        }
</del><ins>+                sidebars.children('.widget').each(function() {
+                        wpWidgets.appendTitle(this);
+                        if ( $('p.widget-error', this).length )
+                                $('a.widget-action', this).click();
</ins><span class="cx">                 });
</span><span class="cx"> 
</span><del>-                $('#widget-list .widget').draggable({
-                        connectToSortable: '.widgets-sortables',
-                        handle: '.widget-title',
</del><ins>+                $('#widget-list').children('.widget').draggable({
+                        connectToSortable: 'div.widgets-sortables',
+                        handle: '&gt; .widget-top &gt; .widget-title',
</ins><span class="cx">                         distance: 2,
</span><span class="cx">                         helper: 'clone',
</span><span class="cx">                         zIndex: 5,
</span><span class="cx">                         containment: 'document',
</span><span class="cx">                         start: function(e,ui) {
</span><span class="cx">                                 wpWidgets.fixWebkit(1);
</span><del>-                                ui.helper.find('.widget-description').hide();
</del><ins>+                                ui.helper.find('div.widget-description').hide();
</ins><span class="cx">                         },
</span><span class="cx">                         stop: function(e,ui) {
</span><span class="cx">                                 if ( rem )
</span><span class="lines">@@ -78,17 +87,17 @@
</span><span class="cx">                         }
</span><span class="cx">                 });
</span><span class="cx"> 
</span><del>-        $('.widgets-sortables').sortable({
</del><ins>+                sidebars.sortable({
</ins><span class="cx">                         placeholder: 'widget-placeholder',
</span><del>-                        connectWith: '.widgets-sortables',
-                        items: '.widget',
-                        handle: '.widget-title',
</del><ins>+                        items: '&gt; .widget',
+                        handle: '&gt; .widget-top &gt; .widget-title',
+                        connectWith: 'div.widgets-sortables',
</ins><span class="cx">                         cursor: 'move',
</span><span class="cx">                         distance: 2,
</span><span class="cx">                         containment: 'document',
</span><span class="cx">                         start: function(e,ui) {
</span><span class="cx">                                 wpWidgets.fixWebkit(1);
</span><del>-                                ui.item.find('.widget-inside').hide();
</del><ins>+                                ui.item.children('.widget-inside').hide();
</ins><span class="cx">                                 ui.item.css({'marginLeft':'','width':''});
</span><span class="cx">                         },
</span><span class="cx">                         stop: function(e,ui) {
</span><span class="lines">@@ -101,7 +110,10 @@
</span><span class="cx">                                         return;
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><del>-                                var add = ui.item.find('input.add_new').val(), n = ui.item.find('input.multi_number').val(), id = ui.item.attr('id'), sb = $(this).attr('id');
</del><ins>+                                var add = ui.item.find('input.add_new').val(),
+                                        n = ui.item.find('input.multi_number').val(),
+                                        id = ui.item.attr('id'),
+                                        sb = $(this).attr('id');
</ins><span class="cx"> 
</span><span class="cx">                                 ui.item.css({'marginLeft':'','width':''});
</span><span class="cx">                                 wpWidgets.fixWebkit();
</span><span class="lines">@@ -115,7 +127,6 @@
</span><span class="cx">                                                 ui.item.attr( 'id', 'new-' + id );
</span><span class="cx">                                                 rem = 'div#' + id;
</span><span class="cx">                                         }
</span><del>-                                        wpWidgets.addEvents(ui.item);
</del><span class="cx">                                         wpWidgets.save( ui.item, 0, 0, 1 );
</span><span class="cx">                                         ui.item.find('input.add_new').val('');
</span><span class="cx">                                         ui.item.find('a.widget-action').click();
</span><span class="lines">@@ -127,14 +138,36 @@
</span><span class="cx">                                 if ( !$(this).is(':visible') )
</span><span class="cx">                                         $(this).sortable('cancel');
</span><span class="cx">                         }
</span><del>-                }).not(':visible').sortable('disable');
-                wpWidgets.resize();
-                wpWidgets.fixLabels();
</del><ins>+                }).parent().filter('.closed').children('.widgets-sortables').sortable('disable');
+
+                $('#available-widgets').droppable({
+                        tolerance: 'pointer',
+                        accept: function(o){
+                                return $(o).parent().attr('id') != 'widget-list';
+                        },
+                        drop: function(e,ui) {
+                                ui.draggable.addClass('deleting');
+                                $('#removing-widget').hide().children('span').html('');
+                        },
+                        over: function(e,ui) {
+                                ui.draggable.addClass('deleting');
+                                $('div.widget-placeholder').hide();
+
+                                if ( ui.draggable.hasClass('ui-sortable-helper') )
+                                        $('#removing-widget').show().children('span')
+                                        .html( ui.draggable.find('div.widget-title').children('h4').html() );
+                        },
+                        out: function(e,ui) {
+                                ui.draggable.removeClass('deleting');
+                                $('div.widget-placeholder').show();
+                                $('#removing-widget').hide().children('span').html('');
+                        }
+                });
</ins><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         saveOrder : function(sb) {
</span><span class="cx">                 if ( sb )
</span><del>-                        $('#' + sb).parents('.widgets-holder-wrap').find('.ajax-feedback').css('visibility', 'visible');
</del><ins>+                        $('#' + sb).closest('div.widgets-holder-wrap').find('img.ajax-feedback').css('visibility', 'visible');
</ins><span class="cx"> 
</span><span class="cx">                 var a = {
</span><span class="cx">                         action: 'widgets-order',
</span><span class="lines">@@ -142,20 +175,21 @@
</span><span class="cx">                         sidebars: []
</span><span class="cx">                 };
</span><span class="cx"> 
</span><del>-                $('.widgets-sortables').each( function() {
</del><ins>+                $('div.widgets-sortables').each( function() {
</ins><span class="cx">                         a['sidebars[' + $(this).attr('id') + ']'] = $(this).sortable('toArray').join(',');
</span><span class="cx">                 });
</span><span class="cx"> 
</span><span class="cx">                 $.post( ajaxurl, a, function() {
</span><del>-                        $('.ajax-feedback').css('visibility', 'hidden');
</del><ins>+                        $('img.ajax-feedback').css('visibility', 'hidden');
</ins><span class="cx">                 });
</span><ins>+
</ins><span class="cx">                 this.resize();
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         save : function(widget, del, animate, order) {
</span><del>-                var sb = widget.parents('.widgets-sortables').attr('id'), data = widget.find('form').serialize(), a;
</del><ins>+                var sb = widget.closest('div.widgets-sortables').attr('id'), data = widget.find('form').serialize(), a;
</ins><span class="cx">                 widget = $(widget);
</span><del>-                widget.find('.ajax-feedback').css('visibility', 'visible');
</del><ins>+                $('.ajax-feedback', widget).css('visibility', 'visible');
</ins><span class="cx"> 
</span><span class="cx">                 a = {
</span><span class="cx">                         action: 'save-widget',
</span><span class="lines">@@ -172,11 +206,11 @@
</span><span class="cx">                         var id;
</span><span class="cx"> 
</span><span class="cx">                         if ( del ) {
</span><del>-                                if ( !$('.widget_number', widget).val() ) {
-                                        id = $('.widget-id', widget).val();
-                                        $('#available-widgets .widget-id').each(function(){
</del><ins>+                                if ( !$('input.widget_number', widget).val() ) {
+                                        id = $('input.widget-id', widget).val();
+                                        $('#available-widgets').find('input.widget-id').each(function(){
</ins><span class="cx">                                                 if ( $(this).val() == id )
</span><del>-                                                        $(this).parents('.widget').show();
</del><ins>+                                                        $(this).closest('div.widget').show();
</ins><span class="cx">                                         });
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><span class="lines">@@ -193,7 +227,7 @@
</span><span class="cx">                         } else {
</span><span class="cx">                                 $('.ajax-feedback').css('visibility', 'hidden');
</span><span class="cx">                                 if ( r &amp;&amp; r.length &gt; 2 ) {
</span><del>-                                        $('.widget-content', widget).html(r);
</del><ins>+                                        $('div.widget-content', widget).html(r);
</ins><span class="cx">                                         wpWidgets.appendTitle(widget);
</span><span class="cx">                                         wpWidgets.fixLabels(widget);
</span><span class="cx">                                 }
</span><span class="lines">@@ -204,20 +238,17 @@
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         appendTitle : function(widget) {
</span><del>-                $('input[type=&quot;text&quot;]', widget).each(function(){
-                        var title;
-                        if ( this.id.indexOf('title') != -1 ) {
-                                title = $(this).val().replace(/&lt;[^&lt;&gt;]+&gt;/g, '').replace(/&lt;/g, '&amp;lt;').replace(/&gt;/g, '&amp;gt;');
-                                if ( title )
-                                        $('.widget-title .in-widget-title', widget).html(': ' + title);
-                                return false;
-                        }
-                });
</del><ins>+                var title = $('input[id*=&quot;-title&quot;]', widget);
+                if ( title = title.val() ) {
+                        title = title.replace(/&lt;[^&lt;&gt;]+&gt;/g, '').replace(/&lt;/g, '&amp;lt;').replace(/&gt;/g, '&amp;gt;');
+                        $(widget).children('.widget-top').children('.widget-title').children()
+                                .children('.in-widget-title').html(': ' + title);
+                }
</ins><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         resize : function() {
</span><del>-                $('.widgets-sortables').not('#wp_inactive_widgets').each(function(){
-                        var h = 50, H = $('.widget', this).length;
</del><ins>+                $('div.widgets-sortables').not('#wp_inactive_widgets').each(function(){
+                        var h = 50, H = $(this).children('.widget').length;
</ins><span class="cx">                         h = h + parseInt(H * 48, 10);
</span><span class="cx">                         $(this).css( 'minHeight', h + 'px' );
</span><span class="cx">                 });
</span><span class="lines">@@ -230,55 +261,22 @@
</span><span class="cx">                         KhtmlUserSelect: n
</span><span class="cx">                 });
</span><span class="cx">     },
</span><del>-    
-    fixLabels : function(sc) {
-                sc = sc || document;
</del><span class="cx"> 
</span><del>-                $('.widget-inside label', sc).each(function(){
</del><ins>+    fixLabels : function(widget) {
+                widget.children('.widget-inside').find('label').each(function(){
</ins><span class="cx">                         var f = $(this).attr('for');
</span><del>-
</del><span class="cx">                         if ( f &amp;&amp; f == $('input', this).attr('id') )
</span><span class="cx">                                 $(this).removeAttr('for');
</span><span class="cx">                 });
</span><span class="cx">         },
</span><del>-    
</del><ins>+
</ins><span class="cx">     close : function(widget) {
</span><del>-                widget.find('.widget-inside').slideUp('fast', function(){
</del><ins>+                widget.children('.widget-inside').slideUp('fast', function(){
</ins><span class="cx">                         widget.css({'width':'','marginLeft':''});
</span><span class="cx">                 });
</span><del>-        },
-
-    addEvents : function(sc) {
-                sc = sc || document;
-                $('a.widget-action', sc).click(function(){
-            var w = parseInt( $(this).parents('.widget').find('.widget-width').val(), 10 ), css = {}, inside = $(this).parents('.widget-top').siblings('.widget-inside');
-                        if ( inside.is(':hidden') ) {
-                                if ( w &gt; 250 &amp;&amp; inside.parents('.widgets-sortables').length ) {
-                                        css['width'] = w + 30 + 'px';
-                                        if ( inside.parents('.widget-liquid-right').length )
-                                                css['marginLeft'] = 235 - w + 'px';
-                                        inside.parents('.widget').css(css);
-                                }
-                                inside.slideDown('fast');
-                        } else {
-                                inside.slideUp('fast', function(){ inside.parents('.widget').css({'width':'','marginLeft':''}); });
-                        }
-            return false;
-        });
-        $('.widget-control-save', sc).click(function(){
-                        wpWidgets.save( $(this).parents('.widget'), 0, 1, 0 );
-                        return false;
-                });
-                $('.widget-control-remove', sc).click(function(){
-                        wpWidgets.save( $(this).parents('.widget'), 1, 1, 0 );
-                        return false;
-                });
-                $('.widget-control-close', sc).click(function(){
-                        wpWidgets.close( $(this).parents('.widget') );
-                        return false;
-                });
</del><span class="cx">         }
</span><span class="cx"> };
</span><del>-$(document).ready(function(){wpWidgets.init();});
</del><span class="cx"> 
</span><ins>+$(document).ready(function($){ wpWidgets.init(); });
+
</ins><span class="cx"> })(jQuery);
</span></span></pre></div>
<a id="trunkwpadminjswidgetsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/widgets.js (11836 => 11837)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/widgets.js        2009-08-17 01:38:01 UTC (rev 11836)
+++ trunk/wp-admin/js/widgets.js        2009-08-18 09:53:37 UTC (rev 11837)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var wpWidgets;(function(a){wpWidgets={init:function(){var b;if(a(&quot;body&quot;).hasClass(&quot;widgets_access&quot;)){return}a(&quot;#widgets-right div.sidebar-name&quot;).click(function(){var d=a(this).siblings(&quot;.widgets-sortables&quot;);if(d.is(&quot;:visible&quot;)){d.sortable(&quot;disable&quot;);a(this).parent().addClass(&quot;closed&quot;)}else{a(this).parent().removeClass(&quot;closed&quot;);d.sortable(&quot;enable&quot;).sortable(&quot;refresh&quot;)}});a(&quot;#widgets-left div.sidebar-name&quot;).click(function(){if(a(this).siblings(&quot;.widget-holder&quot;).is(&quot;:visible&quot;)){a(this).parent().addClass(&quot;closed&quot;)}else{a(this).parent().removeClass(&quot;closed&quot;)}});a(&quot;#widgets-right .widget, #wp_inactive_widgets .widget&quot;).each(function(){wpWidgets.appendTitle(this)});this.addEvents();a(&quot;.widget-error&quot;).parents(&quot;.widget&quot;).find(&quot;a.widget-action&quot;).click();a(&quot;#available-widgets&quot;).droppable({tolerance:&quot;pointer&quot;,accept:function(c){return a(c).parent().attr(&quot;id&quot;)!=&quot;widget-list&quot;},drop:function(d,c){c.draggable.addClass(&quot;deleting&quot;);a(&quot;#removing-widget&quot;).hide().children(&quot;span&quot;).html(&quot;&quot;)},over:function(d,c){c.draggable.addClass(&quot;deleting&quot;);a(&quot;.widget-placeholder&quot;).hide();if(c.draggable.hasClass(&quot;ui-sortable-helper&quot;)){a(&quot;#removing-widget&quot;).show().children(&quot;span&quot;).html(c.draggable.find(&quot;.widget-title h4&quot;).html())}},out:function(d,c){c.draggable.removeClass(&quot;deleting&quot;);a(&quot;.widget-placeholder&quot;).show();a(&quot;#removing-widget&quot;).hide().children(&quot;span&quot;).html(&quot;&quot;)}});a(&quot;#widget-list .widget&quot;).draggable({connectToSortable:&quot;.widgets-sortables&quot;,handle:&quot;.widget-title&quot;,distance:2,helper:&quot;clone&quot;,zIndex:5,containment:&quot;document&quot;,start:function(d,c){wpWidgets.fixWebkit(1);c.helper.find(&quot;.widget-description&quot;).hide()},stop:function(d,c){if(b){a(b).hide()}b=&quot;&quot;;wpWidgets.fixWebkit()}});a(&quot;.widgets-sortables&quot;).sortable({placeholder:&quot;widget-placeholder&quot;,connectWith:&quot;.widgets-sortables&quot;,items:&quot;.widget&quot;,handle:&quot;.widget-title&quot;,cursor:&quot;move&quot;,distance:2,containment:&quot;document&quot;,start:function(d,c){wpWidgets.fixWebkit(1);c.item.find(&quot;.widget-inside&quot;).hide();c.item.css({marginLeft:&quot;&quot;,width:&quot;&quot;})},stop:function(f,c){if(c.item.hasClass(&quot;ui-draggable&quot;)){c.item.draggable(&quot;destroy&quot;)}if(c.item.hasClass(&quot;deleting&quot;)){wpWidgets.save(c.item,1,0,1);c.item.remove();return}var d=c.item.find(&quot;input.add_new&quot;).val(),i=c.item.find(&quot;input.multi_number&quot;).val(),h=c.item.attr(&quot;id&quot;),g=a(this).attr(&quot;id&quot;);c.item.css({marginLeft:&quot;&quot;,width:&quot;&quot;});wpWidgets.fixWebkit();if(d){if(&quot;multi&quot;==d){c.item.html(c.item.html().replace(/&lt;[^&lt;&gt;]+&gt;/g,function(e){return e.replace(/__i__|%i%/g,i)}));c.item.attr(&quot;id&quot;,h.replace(/__i__|%i%/g,i));i++;a(&quot;div#&quot;+h).find(&quot;input.multi_number&quot;).val(i)}else{if(&quot;single&quot;==d){c.item.attr(&quot;id&quot;,&quot;new-&quot;+h);b=&quot;div#&quot;+h}}wpWidgets.addEvents(c.item);wpWidgets.save(c.item,0,0,1);c.item.find(&quot;input.add_new&quot;).val(&quot;&quot;);c.item.find(&quot;a.widget-action&quot;).click();return}wpWidgets.saveOrder(g)},receive:function(d,c){if(!a(this).is(&quot;:visible&quot;)){a(this).sortable(&quot;cancel&quot;)}}}).not(&quot;:visible&quot;).sortable(&quot;disable&quot;);wpWidgets.resize();wpWidgets.fixLabels()},saveOrder:function(c){if(c){a(&quot;#&quot;+c).parents(&quot;.widgets-holder-wrap&quot;).find(&quot;.ajax-feedback&quot;).css(&quot;visibility&quot;,&quot;visible&quot;)}var b={action:&quot;widgets-order&quot;,savewidgets:a(&quot;#_wpnonce_widgets&quot;).val(),sidebars:[]};a(&quot;.widgets-sortables&quot;).each(function(){b[&quot;sidebars[&quot;+a(this).attr(&quot;id&quot;)+&quot;]&quot;]=a(this).sortable(&quot;toArray&quot;).join(&quot;,&quot;)});a.post(ajaxurl,b,function(){a(&quot;.ajax-feedback&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;)});this.resize()},save:function(g,d,e,b){var h=g.parents(&quot;.widgets-sortables&quot;).attr(&quot;id&quot;),f=g.find(&quot;form&quot;).serialize(),c;g=a(g);g.find(&quot;.ajax-feedback&quot;).css(&quot;visibility&quot;,&quot;visible&quot;);c={action:&quot;save-widget&quot;,savewidgets:a(&quot;#_wpnonce_widgets&quot;).val(),sidebar:h};if(d){c.delete_widget=1}f+=&quot;&amp;&quot;+a.param(c);a.post(ajaxurl,f,function(i){var j;if(d){if(!a(&quot;.widget_number&quot;,g).val()){j=a(&quot;.widget-id&quot;,g).val();a(&quot;#available-widgets .widget-id&quot;).each(function(){if(a(this).val()==j){a(this).parents(&quot;.widget&quot;).show()}})}if(e){b=0;g.slideUp(&quot;fast&quot;,function(){a(this).remove();wpWidgets.saveOrder()})}else{g.remove();wpWidgets.resize()}}else{a(&quot;.ajax-feedback&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;);if(i&amp;&amp;i.length&gt;2){a(&quot;.widget-content&quot;,g).html(i);wpWidgets.appendTitle(g);wpWidgets.fixLabels(g)}}if(b){wpWidgets.saveOrder()}})},appendTitle:function(b){a('input[type=&quot;text&quot;]',b).each(function(){var c;if(this.id.indexOf(&quot;title&quot;)!=-1){c=a(this).val().replace(/&lt;[^&lt;&gt;]+&gt;/g,&quot;&quot;).replace(/&lt;/g,&quot;&amp;lt;&quot;).replace(/&gt;/g,&quot;&amp;gt;&quot;);if(c){a(&quot;.widget-title .in-widget-title&quot;,b).html(&quot;: &quot;+c)}return false}})},resize:function(){a(&quot;.widgets-sortables&quot;).not(&quot;#wp_inactive_widgets&quot;).each(function(){var c=50,b=a(&quot;.widget&quot;,this).length;c=c+parseInt(b*48,10);a(this).css(&quot;minHeight&quot;,c+&quot;px&quot;)})},fixWebkit:function(b){b=b?&quot;none&quot;:&quot;&quot;;a(&quot;body&quot;).css({WebkitUserSelect:b,KhtmlUserSelect:b})},fixLabels:function(b){b=b||document;a(&quot;.widget-inside label&quot;,b).each(function(){var c=a(this).attr(&quot;for&quot;);if(c&amp;&amp;c==a(&quot;input&quot;,this).attr(&quot;id&quot;)){a(this).removeAttr(&quot;for&quot;)}})},close:function(b){b.find(&quot;.widget-inside&quot;).slideUp(&quot;fast&quot;,function(){b.css({width:&quot;&quot;,marginLeft:&quot;&quot;})})},addEvents:function(b){b=b||document;a(&quot;a.widget-action&quot;,b).click(function(){var d=parseInt(a(this).parents(&quot;.widget&quot;).find(&quot;.widget-width&quot;).val(),10),e={},c=a(this).parents(&quot;.widget-top&quot;).siblings(&quot;.widget-inside&quot;);if(c.is(&quot;:hidden&quot;)){if(d&gt;250&amp;&amp;c.parents(&quot;.widgets-sortables&quot;).length){e.width=d+30+&quot;px&quot;;if(c.parents(&quot;.widget-liquid-right&quot;).length){e.marginLeft=235-d+&quot;px&quot;}c.parents(&quot;.widget&quot;).css(e)}c.slideDown(&quot;fast&quot;)}else{c.slideUp(&quot;fast&quot;,function(){c.parents(&quot;.widget&quot;).css({width:&quot;&quot;,marginLeft:&quot;&quot;})})}return false});a(&quot;.widget-control-save&quot;,b).click(function(){wpWidgets.save(a(this).parents(&quot;.widget&quot;),0,1,0);return false});a(&quot;.widget-control-remove&quot;,b).click(function(){wpWidgets.save(a(this).parents(&quot;.widget&quot;),1,1,0);return false});a(&quot;.widget-control-close&quot;,b).click(function(){wpWidgets.close(a(this).parents(&quot;.widget&quot;));return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+var wpWidgets;(function(a){wpWidgets={init:function(){var c,b=a(&quot;div.widgets-sortables&quot;);a(&quot;#widgets-right&quot;).children(&quot;.widgets-holder-wrap&quot;).children(&quot;.sidebar-name&quot;).click(function(){var e=a(this).siblings(&quot;.widgets-sortables&quot;),d=a(this).parent();if(!d.hasClass(&quot;closed&quot;)){e.sortable(&quot;disable&quot;);d.addClass(&quot;closed&quot;)}else{d.removeClass(&quot;closed&quot;);e.sortable(&quot;enable&quot;).sortable(&quot;refresh&quot;)}});a(&quot;#widgets-left&quot;).children(&quot;.widgets-holder-wrap&quot;).children(&quot;.sidebar-name&quot;).click(function(){a(this).siblings(&quot;.widget-holder&quot;).parent().toggleClass(&quot;closed&quot;)});b.not(&quot;#wp_inactive_widgets&quot;).each(function(){var e=50,d=a(this).children(&quot;.widget&quot;).length;e=e+parseInt(d*48,10);a(this).css(&quot;minHeight&quot;,e+&quot;px&quot;)});a(&quot;a.widget-action&quot;).live(&quot;click&quot;,function(){var f={},g=a(this).closest(&quot;div.widget&quot;),d=g.children(&quot;.widget-inside&quot;),e=parseInt(g.find(&quot;input.widget-width&quot;).val(),10);if(d.is(&quot;:hidden&quot;)){if(e&gt;250&amp;&amp;d.closest(&quot;div.widgets-sortables&quot;).length){f.width=e+30+&quot;px&quot;;if(d.closest(&quot;div.widget-liquid-right&quot;).length){f.marginLeft=235-e+&quot;px&quot;}g.css(f)}wpWidgets.fixLabels(g);d.slideDown(&quot;fast&quot;)}else{d.slideUp(&quot;fast&quot;,function(){g.css({width:&quot;&quot;,marginLeft:&quot;&quot;})})}return false});a(&quot;input.widget-control-save&quot;).live(&quot;click&quot;,function(){wpWidgets.save(a(this).closest(&quot;div.widget&quot;),0,1,0);return false});a(&quot;a.widget-control-remove&quot;).live(&quot;click&quot;,function(){wpWidgets.save(a(this).closest(&quot;div.widget&quot;),1,1,0);return false});a(&quot;a.widget-control-close&quot;).live(&quot;click&quot;,function(){wpWidgets.close(a(this).closest(&quot;div.widget&quot;));return false});b.children(&quot;.widget&quot;).each(function(){wpWidgets.appendTitle(this);if(a(&quot;p.widget-error&quot;,this).length){a(&quot;a.widget-action&quot;,this).click()}});a(&quot;#widget-list&quot;).children(&quot;.widget&quot;).draggable({connectToSortable:&quot;div.widgets-sortables&quot;,handle:&quot;&gt; .widget-top &gt; .widget-title&quot;,distance:2,helper:&quot;clone&quot;,zIndex:5,containment:&quot;document&quot;,start:function(f,d){wpWidgets.fixWebkit(1);d.helper.find(&quot;div.widget-description&quot;).hide()},stop:function(f,d){if(c){a(c).hide()}c=&quot;&quot;;wpWidgets.fixWebkit()}});b.sortable({placeholder:&quot;widget-placeholder&quot;,items:&quot;&gt; .widget&quot;,handle:&quot;&gt; .widget-top &gt; .widget-title&quot;,connectWith:&quot;div.widgets-sortables&quot;,cursor:&quot;move&quot;,distance:2,containment:&quot;document&quot;,start:function(f,d){wpWidgets.fixWebkit(1);d.item.children(&quot;.widget-inside&quot;).hide();d.item.css({marginLeft:&quot;&quot;,width:&quot;&quot;})},stop:function(g,d){if(d.item.hasClass(&quot;ui-draggable&quot;)){d.item.draggable(&quot;destroy&quot;)}if(d.item.hasClass(&quot;deleting&quot;)){wpWidgets.save(d.item,1,0,1);d.item.remove();return}var f=d.item.find(&quot;input.add_new&quot;).val(),j=d.item.find(&quot;input.multi_number&quot;).val(),i=d.item.attr(&quot;id&quot;),h=a(this).attr(&quot;id&quot;);d.item.css({marginLeft:&quot;&quot;,width:&quot;&quot;});wpWidgets.fixWebkit();if(f){if(&quot;multi&quot;==f){d.item.html(d.item.html().replace(/&lt;[^&lt;&gt;]+&gt;/g,function(e){return e.replace(/__i__|%i%/g,j)}));d.item.attr(&quot;id&quot;,i.replace(/__i__|%i%/g,j));j++;a(&quot;div#&quot;+i).find(&quot;input.multi_number&quot;).val(j)}else{if(&quot;single&quot;==f){d.item.attr(&quot;id&quot;,&quot;new-&quot;+i);c=&quot;div#&quot;+i}}wpWidgets.save(d.item,0,0,1);d.item.find(&quot;input.add_new&quot;).val(&quot;&quot;);d.item.find(&quot;a.widget-action&quot;).click();return}wpWidgets.saveOrder(h)},receive:function(f,d){if(!a(this).is(&quot;:visible&quot;)){a(this).sortable(&quot;cancel&quot;)}}}).parent().filter(&quot;.closed&quot;).children(&quot;.widgets-sortables&quot;).sortable(&quot;disable&quot;);a(&quot;#available-widgets&quot;).droppable({tolerance:&quot;pointer&quot;,accept:function(d){return a(d).parent().attr(&quot;id&quot;)!=&quot;widget-list&quot;},drop:function(f,d){d.draggable.addClass(&quot;deleting&quot;);a(&quot;#removing-widget&quot;).hide().children(&quot;span&quot;).html(&quot;&quot;)},over:function(f,d){d.draggable.addClass(&quot;deleting&quot;);a(&quot;div.widget-placeholder&quot;).hide();if(d.draggable.hasClass(&quot;ui-sortable-helper&quot;)){a(&quot;#removing-widget&quot;).show().children(&quot;span&quot;).html(d.draggable.find(&quot;div.widget-title&quot;).children(&quot;h4&quot;).html())}},out:function(f,d){d.draggable.removeClass(&quot;deleting&quot;);a(&quot;div.widget-placeholder&quot;).show();a(&quot;#removing-widget&quot;).hide().children(&quot;span&quot;).html(&quot;&quot;)}})},saveOrder:function(c){if(c){a(&quot;#&quot;+c).closest(&quot;div.widgets-holder-wrap&quot;).find(&quot;img.ajax-feedback&quot;).css(&quot;visibility&quot;,&quot;visible&quot;)}var b={action:&quot;widgets-order&quot;,savewidgets:a(&quot;#_wpnonce_widgets&quot;).val(),sidebars:[]};a(&quot;div.widgets-sortables&quot;).each(function(){b[&quot;sidebars[&quot;+a(this).attr(&quot;id&quot;)+&quot;]&quot;]=a(this).sortable(&quot;toArray&quot;).join(&quot;,&quot;)});a.post(ajaxurl,b,function(){a(&quot;img.ajax-feedback&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;)});this.resize()},save:function(g,d,e,b){var h=g.closest(&quot;div.widgets-sortables&quot;).attr(&quot;id&quot;),f=g.find(&quot;form&quot;).serialize(),c;g=a(g);a(&quot;.ajax-feedback&quot;,g).css(&quot;visibility&quot;,&quot;visible&quot;);c={action:&quot;save-widget&quot;,savewidgets:a(&quot;#_wpnonce_widgets&quot;).val(),sidebar:h};if(d){c.delete_widget=1}f+=&quot;&amp;&quot;+a.param(c);a.post(ajaxurl,f,function(i){var j;if(d){if(!a(&quot;input.widget_number&quot;,g).val()){j=a(&quot;input.widget-id&quot;,g).val();a(&quot;#available-widgets&quot;).find(&quot;input.widget-id&quot;).each(function(){if(a(this).val()==j){a(this).closest(&quot;div.widget&quot;).show()}})}if(e){b=0;g.slideUp(&quot;fast&quot;,function(){a(this).remove();wpWidgets.saveOrder()})}else{g.remove();wpWidgets.resize()}}else{a(&quot;.ajax-feedback&quot;).css(&quot;visibility&quot;,&quot;hidden&quot;);if(i&amp;&amp;i.length&gt;2){a(&quot;div.widget-content&quot;,g).html(i);wpWidgets.appendTitle(g);wpWidgets.fixLabels(g)}}if(b){wpWidgets.saveOrder()}})},appendTitle:function(b){var c=a('input[id*=&quot;-title&quot;]',b);if(c=c.val()){c=c.replace(/&lt;[^&lt;&gt;]+&gt;/g,&quot;&quot;).replace(/&lt;/g,&quot;&amp;lt;&quot;).replace(/&gt;/g,&quot;&amp;gt;&quot;);a(b).children(&quot;.widget-top&quot;).children(&quot;.widget-title&quot;).children().children(&quot;.in-widget-title&quot;).html(&quot;: &quot;+c)}},resize:function(){a(&quot;div.widgets-sortables&quot;).not(&quot;#wp_inactive_widgets&quot;).each(function(){var c=50,b=a(this).children(&quot;.widget&quot;).length;c=c+parseInt(b*48,10);a(this).css(&quot;minHeight&quot;,c+&quot;px&quot;)})},fixWebkit:function(b){b=b?&quot;none&quot;:&quot;&quot;;a(&quot;body&quot;).css({WebkitUserSelect:b,KhtmlUserSelect:b})},fixLabels:function(b){b.children(&quot;.widget-inside&quot;).find(&quot;label&quot;).each(function(){var c=a(this).attr(&quot;for&quot;);if(c&amp;&amp;c==a(&quot;input&quot;,this).attr(&quot;id&quot;)){a(this).removeAttr(&quot;for&quot;)}})},close:function(b){b.children(&quot;.widget-inside&quot;).slideUp(&quot;fast&quot;,function(){b.css({width:&quot;&quot;,marginLeft:&quot;&quot;})})}};a(document).ready(function(b){wpWidgets.init()})})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminwidgetsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/widgets.php (11836 => 11837)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/widgets.php        2009-08-17 01:38:01 UTC (rev 11836)
+++ trunk/wp-admin/widgets.php        2009-08-18 09:53:37 UTC (rev 11837)
</span><span class="lines">@@ -15,9 +15,19 @@
</span><span class="cx"> if ( ! current_user_can('switch_themes') )
</span><span class="cx">         wp_die( __( 'Cheatin&amp;#8217; uh?' ));
</span><span class="cx"> 
</span><del>-wp_enqueue_script('admin-widgets');
</del><span class="cx"> wp_admin_css( 'widgets' );
</span><span class="cx"> 
</span><ins>+$widgets_access = get_user_setting( 'widgets_access' );
+if ( isset($_GET['widgets-access']) ) {
+        $widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
+        set_user_setting( 'widgets_access', $widgets_access );
+}
+
+if ( 'on' == $widgets_access )
+        add_filter( 'admin_body_class', create_function('', '{return &quot; widgets_access &quot;;}') );
+else
+        wp_enqueue_script('admin-widgets');
+
</ins><span class="cx"> do_action( 'sidebar_admin_setup' );
</span><span class="cx"> 
</span><span class="cx"> $title = __( 'Widgets' );
</span><span class="lines">@@ -302,15 +312,6 @@
</span><span class="cx">         exit;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-$widgets_access = get_user_setting( 'widgets_access' );
-if ( isset($_GET['widgets-access']) ) {
-        $widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
-        set_user_setting( 'widgets_access', $widgets_access );
-}
-
-if ( 'on' == $widgets_access )
-        add_filter( 'admin_body_class', create_function('', '{return &quot; widgets_access &quot;;}') );
-
</del><span class="cx"> $messages = array(
</span><span class="cx">         __('Changes saved.')
</span><span class="cx"> );
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (11836 => 11837)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-08-17 01:38:01 UTC (rev 11836)
+++ trunk/wp-includes/script-loader.php        2009-08-18 09:53:37 UTC (rev 11837)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'utils', &quot;/wp-admin/js/utils$suffix.js&quot;, false, '20090102' );
</span><span class="cx"> 
</span><del>-        $scripts-&gt;add( 'common', &quot;/wp-admin/js/common$suffix.js&quot;, array('jquery', 'hoverIntent', 'utils'), '20090730' );
</del><ins>+        $scripts-&gt;add( 'common', &quot;/wp-admin/js/common$suffix.js&quot;, array('jquery', 'hoverIntent', 'utils'), '20090817' );
</ins><span class="cx">         $scripts-&gt;add_data( 'common', 'group', 1 );
</span><span class="cx">         $scripts-&gt;localize( 'common', 'commonL10n', array(
</span><span class="cx">                 'warnDelete' =&gt; __(&quot;You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete.&quot;),
</span><span class="lines">@@ -340,7 +340,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'media-upload', &quot;/wp-admin/js/media-upload$suffix.js&quot;, array( 'thickbox' ), '20090114' );
</span><span class="cx">                 $scripts-&gt;add_data( 'media-upload', 'group', 1 );
</span><span class="cx"> 
</span><del>-                $scripts-&gt;add( 'admin-widgets', &quot;/wp-admin/js/widgets$suffix.js&quot;, array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20090601' );
</del><ins>+                $scripts-&gt;add( 'admin-widgets', &quot;/wp-admin/js/widgets$suffix.js&quot;, array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), '20090817' );
</ins><span class="cx">                 $scripts-&gt;add_data( 'admin-widgets', 'group', 1 );
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'word-count', &quot;/wp-admin/js/word-count$suffix.js&quot;, array( 'jquery' ), '20090422' );
</span></span></pre>
</div>
</div>

</body>
</html>