-(function($) {
- postboxes = {
- add_postbox_toggles : function(page,args) {
- $('.postbox h3, .postbox .handlediv').click( function() {
- $($(this).parent().get(0)).toggleClass('closed');
- postboxes.save_state(page);
- } );
- $('.postbox h3 a').click( function(e) {
- e.stopPropagation();
- } );
-
- $('.hide-postbox-tog').click( function() {
- var box = jQuery(this).val();
- if ( jQuery(this).attr('checked') ) {
- jQuery('#' + box).show();
- if ( $.isFunction( postboxes.pbshow ) )
- postboxes.pbshow( box );
-
- } else {
- jQuery('#' + box).hide();
- if ( $.isFunction( postboxes.pbhide ) )
- postboxes.pbhide( box );
-
- }
- postboxes.save_state(page);
- } );
-
- this.expandSidebar();
- this.init(page,args);
- },
-
- expandSidebar : function(doIt) {
- if ( doIt || $('#side-sortables > .postbox:visible').length ) {
- if ( ! $('#post-body').hasClass('has-sidebar') ) {
- $('#post-body').addClass('has-sidebar');
- var h = Math.min( $('#post-body').height(), 300 );
- $('#side-sortables').css({'minHeight':h+'px','height':'auto'});
- }
- } else {
- $('#post-body').removeClass('has-sidebar');
- $('#side-sortables').css({'minHeight':'0'});
- if ( $.browser.msie && $.browser.version.charAt(0) == 7 )
- $('#side-sortables').css({'height':'0'});
- }
- },
-
- init : function(page, args) {
- $.extend( this, args || {} );
- $('#wpbody-content').css('overflow','hidden');
- $('.meta-box-sortables').sortable( {
- placeholder: 'sortable-placeholder',
- connectWith: [ '.meta-box-sortables' ],
- items: '> .postbox',
- handle: '.hndle',
- distance: 2,
- tolerance: 'pointer',
- toleranceMove: 'tolerance',
- sort: function(e,ui) {
- if ( $(document).width() - e.clientX < 300 ) {
- if ( ! $('#post-body').hasClass('has-sidebar') ) {
- var pos = $('#side-sortables').offset();
-
- $('#side-sortables').append(ui.item)
- $(ui.placeholder).css({'top':pos.top,'left':pos.left}).width($(ui.item).width())
- postboxes.expandSidebar(1);
- }
- }
- },
- stop: function() {
- var postVars = {
- action: 'meta-box-order',
- _ajax_nonce: $('#meta-box-order-nonce').val(),
- page: page
- }
- $('.meta-box-sortables').each( function() {
- postVars["order[" + this.id.split('-')[0] + "]"] = $(this).sortable( 'toArray' ).join(',');
- } );
- $.post( postboxL10n.requestFile, postVars, function() {
- postboxes.expandSidebar();
- } );
- }
- } );
- },
-
- save_state : function(page) {
- var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
- var hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
- $.post(postboxL10n.requestFile, {
- action: 'closed-postboxes',
- closed: closed,
- hidden: hidden,
- closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
- page: page
- });
- postboxes.expandSidebar();
- },
-
- /* Callbacks */
- pbshow : false,
-
- pbhide : false
- };
-
-}(jQuery));
+var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var e=a(this).parent(".postbox");e.toggleClass("closed");postboxes.save_state(c)});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).attr("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,h=a("#poststuff");if(h.length){if(e==2){h.addClass("has-right-sidebar");a("#side-sortables").addClass("temp-border")}else{if(e==1){h.removeClass("has-right-sidebar");a("#normal-sortables").append(a("#side-sortables").children(".postbox"))}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=1;f<=e;f++){g=a("#"+d(f)+"-sortables");if(g.parent().is(":hidden")){g.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",98/e+"%")}postboxes.save_order(c)});function d(e){switch(e){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,start:function(f,d){a("body").css({WebkitUserSelect:"none",KhtmlUserSelect:"none"})},stop:function(f,d){postboxes.save_order(c);d.item.parent().removeClass("temp-border");a("body").css({WebkitUserSelect:"",KhtmlUserSelect:""})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,b)},pbshow:false,pbhide:false}}(jQuery));
\ No newline at end of file