WordPress.org

Make WordPress Core

Changeset 18624


Ignore:
Timestamp:
08/30/2011 10:29:37 PM (9 years ago)
Author:
azaozz
Message:

Disable js moving of dashboard postboxes, add all of them in the first column on 'auto', see #18198

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/postbox.dev.js

    r18607 r18624  
    4545
    4646                if ( num == 'auto' ) {
    47                     wrap.removeClass('columns-1').removeClass('columns-2').addClass('columns-auto');
    48                     ps.addClass('has-right-sidebar')
    49 
    50                     if ( !$('#side-info-column #side-sortables').length )
    51                         $('#side-info-column').append( $('#side-sortables') );
    52 
    53                     if ( typeof(wp_auto_columns) == 'function' ) {
    54                         wpAutoColumns = true;
    55                         wp_auto_columns();
     47
     48                    if ( ps.length ) {
     49                        wrap.removeClass('columns-1').removeClass('columns-2').addClass('columns-auto');
     50                        ps.addClass('has-right-sidebar')
     51
     52                        if ( !$('#side-info-column #side-sortables').length )
     53                            $('#side-info-column').append( $('#side-sortables') );
     54
     55                        if ( typeof(wp_auto_columns) == 'function' ) {
     56                            wpAutoColumns = true;
     57                            wp_auto_columns();
     58                        }
     59                    } else {
     60                        $('#normal-sortables').append( $('#side-sortables, #column3-sortables, #column4-sortables').children('.postbox') );
     61                        $('#postbox-container-2, #postbox-container-3, #postbox-container-4').hide();
     62                        $('#postbox-container-1').css('width', '100%');
    5663                    }
     64
    5765                } else {
    5866                    wrap.removeClass('columns-auto');
    5967
    6068                    if ( ps.length ) { // write pages
     69
    6170                        if ( num == 2 ) {
    6271                            wrap.removeClass('columns-1').addClass('columns-2');
     
    7079                            $('#normal-sortables').before( $('#side-sortables') );
    7180                        }
     81
    7282                    } else { // dashboard
     83
    7384                        for ( i = 4; ( i > num && i > 1 ); i-- ) {
    7485                            el = $('#' + colname(i) + '-sortables');
     
    7687                            el.parent().hide();
    7788                        }
     89
    7890                        for ( i = 1; i <= num; i++ ) {
    7991                            el = $('#' + colname(i) + '-sortables');
     
    8193                                el.addClass('temp-border').parent().show();
    8294                        }
     95
    8396                        $('.postbox-container:visible').css('width', 100/num + '%');
    8497                    }
     
    206219                }
    207220
    208             } else if ( adminpage == 'index-php' ) {
     221            }
     222/*
     223            else if ( adminpage == 'index-php' ) {
    209224                dw = $('#dashboard-widgets').width();
    210225
     
    236251                $('.postbox-container:visible').css('width', 100/num + '%');
    237252            }
     253*/
    238254        }
    239255
  • trunk/wp-admin/js/postbox.js

    r18607 r18624  
    1 var postboxes,wp_auto_columns,wpAutoColumns=false;(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"),f=e.attr("id");if("dashboard_browser_nag"==f){return}e.toggleClass("closed");postboxes.save_state(c);if(f){if(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(f)}else{if(e.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(f)}}}});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".postbox a.dismiss").click(function(g){var f=a(this).parents(".postbox").attr("id")+"-hide";a("#"+f).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).prop("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,h,j=a("#poststuff"),g=a(".wrap");if(e=="auto"){g.removeClass("columns-1").removeClass("columns-2").addClass("columns-auto");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}if(typeof(wp_auto_columns)=="function"){wpAutoColumns=true;wp_auto_columns()}}else{g.removeClass("columns-auto");if(j.length){if(e==2){g.removeClass("columns-1").addClass("columns-2");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}}else{if(e==1){g.removeClass("columns-2").addClass("columns-1");j.removeClass("has-right-sidebar");a("#normal-sortables").before(a("#side-sortables"))}}}else{for(f=4;(f>e&&f>1);f--){h=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(h.children(".postbox"));h.parent().hide()}for(f=1;f<=e;f++){h=a("#"+d(f)+"-sortables");if(h.parent().is(":hidden")){h.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",100/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,stop:function(f,d){if(a(this).find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id){a(this).sortable("cancel");return}postboxes.save_order(c);d.item.parent().removeClass("temp-border")},receive:function(f,d){if("dashboard_browser_nag"==d.item[0].id){a(d.sender).sortable("cancel")}}})},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(ajaxurl,{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(ajaxurl,b)},pbshow:false,pbhide:false};a(document).ready(function(){wpAutoColumns=a("#wp_auto_columns").prop("checked");wp_auto_columns=function(){var b=a(window).width(),e,d,c=1;if(!wpAutoColumns){return}if(b<=680){a(document.body).addClass("folded")}if(b>680&&getUserSetting("mfold")!="f"){a(document.body).removeClass("folded")}if(adminpage=="post-php"){e=a("#post-body").width();if(e<800){a("#poststuff").removeClass("has-right-sidebar");a("#normal-sortables").before(a("#side-sortables"))}if(e>=800&&e<1150){a("#poststuff").addClass("has-right-sidebar");a("#side-info-column").append(a("#side-sortables"));a(document.body).removeClass("wide-window")}if(e>=1150){a(document.body).addClass("wide-window")}}else{if(adminpage=="index-php"){d=a("#dashboard-widgets").width();if(d<800){a("#postbox-container-2").hide();a("#normal-sortables").after(a("#side-sortables"));c=1}if(d>=800&&d<1200){a("#postbox-container-2").show().append(a("#side-sortables"));a("#postbox-container-3").hide();a("#side-sortables").after(a("#column3-sortables"));c=2}if(d>=1200&&d<1600){a("#postbox-container-3").show().append(a("#column3-sortables"));a("#postbox-container-4").hide();a("#column3-sortables").after(a("#column4-sortables"));c=3}if(d>=1600){a("#postbox-container-4").show().append(a("#column4-sortables"));c=4}a(".postbox-container:visible").css("width",100/c+"%")}}};a(window).resize(function(){wp_auto_columns()});wp_auto_columns()})}(jQuery));
     1var postboxes,wp_auto_columns,wpAutoColumns=false;(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"),f=e.attr("id");if("dashboard_browser_nag"==f){return}e.toggleClass("closed");postboxes.save_state(c);if(f){if(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(f)}else{if(e.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(f)}}}});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".postbox a.dismiss").click(function(g){var f=a(this).parents(".postbox").attr("id")+"-hide";a("#"+f).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).prop("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,h,j=a("#poststuff"),g=a(".wrap");if(e=="auto"){if(j.length){g.removeClass("columns-1").removeClass("columns-2").addClass("columns-auto");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}if(typeof(wp_auto_columns)=="function"){wpAutoColumns=true;wp_auto_columns()}}else{a("#normal-sortables").append(a("#side-sortables, #column3-sortables, #column4-sortables").children(".postbox"));a("#postbox-container-2, #postbox-container-3, #postbox-container-4").hide();a("#postbox-container-1").css("width","100%")}}else{g.removeClass("columns-auto");if(j.length){if(e==2){g.removeClass("columns-1").addClass("columns-2");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}}else{if(e==1){g.removeClass("columns-2").addClass("columns-1");j.removeClass("has-right-sidebar");a("#normal-sortables").before(a("#side-sortables"))}}}else{for(f=4;(f>e&&f>1);f--){h=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(h.children(".postbox"));h.parent().hide()}for(f=1;f<=e;f++){h=a("#"+d(f)+"-sortables");if(h.parent().is(":hidden")){h.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",100/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,stop:function(f,d){if(a(this).find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id){a(this).sortable("cancel");return}postboxes.save_order(c);d.item.parent().removeClass("temp-border")},receive:function(f,d){if("dashboard_browser_nag"==d.item[0].id){a(d.sender).sortable("cancel")}}})},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(ajaxurl,{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(ajaxurl,b)},pbshow:false,pbhide:false};a(document).ready(function(){wpAutoColumns=a("#wp_auto_columns").prop("checked");wp_auto_columns=function(){var b=a(window).width(),e,d,c=1;if(!wpAutoColumns){return}if(b<=680){a(document.body).addClass("folded")}if(b>680&&getUserSetting("mfold")!="f"){a(document.body).removeClass("folded")}if(adminpage=="post-php"){e=a("#post-body").width();if(e<800){a("#poststuff").removeClass("has-right-sidebar");a("#normal-sortables").before(a("#side-sortables"))}if(e>=800&&e<1150){a("#poststuff").addClass("has-right-sidebar");a("#side-info-column").append(a("#side-sortables"));a(document.body).removeClass("wide-window")}if(e>=1150){a(document.body).addClass("wide-window")}}};a(window).resize(function(){wp_auto_columns()});wp_auto_columns()})}(jQuery));
  • trunk/wp-includes/script-loader.php

    r18621 r18624  
    280280        $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20110524', 1 );
    281281
    282         $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110825', 1 );
     282        $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110830', 1 );
    283283
    284284        $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110524', 1 );
Note: See TracChangeset for help on using the changeset viewer.