-
+ 064BB7FD1C28253FC57AE536E92CC17DEECE38DF706A64DB15E05F126E9AB3C8733DECD26A3C1A2B7CE26623FB28D26046AD004DC6CC85238FEE636AD1CD171D
mp-wp/wp-admin/js/postbox.js
(0 . 0)(1 . 104)
51294 (function($) {
51295 postboxes = {
51296 add_postbox_toggles : function(page,args) {
51297 $('.postbox h3, .postbox .handlediv').click( function() {
51298 $($(this).parent().get(0)).toggleClass('closed');
51299 postboxes.save_state(page);
51300 } );
51301 $('.postbox h3 a').click( function(e) {
51302 e.stopPropagation();
51303 } );
51304
51305 $('.hide-postbox-tog').click( function() {
51306 var box = jQuery(this).val();
51307 if ( jQuery(this).attr('checked') ) {
51308 jQuery('#' + box).show();
51309 if ( $.isFunction( postboxes.pbshow ) )
51310 postboxes.pbshow( box );
51311
51312 } else {
51313 jQuery('#' + box).hide();
51314 if ( $.isFunction( postboxes.pbhide ) )
51315 postboxes.pbhide( box );
51316
51317 }
51318 postboxes.save_state(page);
51319 } );
51320
51321 this.expandSidebar();
51322 this.init(page,args);
51323 },
51324
51325 expandSidebar : function(doIt) {
51326 if ( doIt || $('#side-sortables > .postbox:visible').length ) {
51327 if ( ! $('#post-body').hasClass('has-sidebar') ) {
51328 $('#post-body').addClass('has-sidebar');
51329 var h = Math.min( $('#post-body').height(), 300 );
51330 $('#side-sortables').css({'minHeight':h+'px','height':'auto'});
51331 }
51332 } else {
51333 $('#post-body').removeClass('has-sidebar');
51334 $('#side-sortables').css({'minHeight':'0'});
51335 if ( $.browser.msie && $.browser.version.charAt(0) == 7 )
51336 $('#side-sortables').css({'height':'0'});
51337 }
51338 },
51339
51340 init : function(page, args) {
51341 $.extend( this, args || {} );
51342 $('#wpbody-content').css('overflow','hidden');
51343 $('.meta-box-sortables').sortable( {
51344 placeholder: 'sortable-placeholder',
51345 connectWith: [ '.meta-box-sortables' ],
51346 items: '> .postbox',
51347 handle: '.hndle',
51348 distance: 2,
51349 tolerance: 'pointer',
51350 toleranceMove: 'tolerance',
51351 sort: function(e,ui) {
51352 if ( $(document).width() - e.clientX < 300 ) {
51353 if ( ! $('#post-body').hasClass('has-sidebar') ) {
51354 var pos = $('#side-sortables').offset();
51355
51356 $('#side-sortables').append(ui.item)
51357 $(ui.placeholder).css({'top':pos.top,'left':pos.left}).width($(ui.item).width())
51358 postboxes.expandSidebar(1);
51359 }
51360 }
51361 },
51362 stop: function() {
51363 var postVars = {
51364 action: 'meta-box-order',
51365 _ajax_nonce: $('#meta-box-order-nonce').val(),
51366 page: page
51367 }
51368 $('.meta-box-sortables').each( function() {
51369 postVars["order[" + this.id.split('-')[0] + "]"] = $(this).sortable( 'toArray' ).join(',');
51370 } );
51371 $.post( postboxL10n.requestFile, postVars, function() {
51372 postboxes.expandSidebar();
51373 } );
51374 }
51375 } );
51376 },
51377
51378 save_state : function(page) {
51379 var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
51380 var hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
51381 $.post(postboxL10n.requestFile, {
51382 action: 'closed-postboxes',
51383 closed: closed,
51384 hidden: hidden,
51385 closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
51386 page: page
51387 });
51388 postboxes.expandSidebar();
51389 },
51390
51391 /* Callbacks */
51392 pbshow : false,
51393
51394 pbhide : false
51395 };
51396
51397 }(jQuery));