Prevent the browser-out-of-date dashboard nag from being minimized and hide minimization arrow. props aaroncampbell. fixes #17441. see #17323.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2011-05-18 17:06:04 +00:00
parent bb8978972e
commit 33aba110ee
4 changed files with 7 additions and 4 deletions

View File

@ -957,6 +957,7 @@ function do_meta_boxes($page, $context, $object) {
$style = '';
$hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
if ( 'dashboard_browser_nag' != $box['id'] )
echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>';
echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
echo '<div class="inside">' . "\n";

View File

@ -5,6 +5,8 @@ var postboxes;
this.init(page,args);
$('.postbox h3, .postbox .handlediv').click( function() {
var p = $(this).parent('.postbox'), id = p.attr('id');
if ( 'dashboard_browser_nag' == id )
return;
p.toggleClass('closed');
postboxes.save_state(page);

View File

@ -1 +1 @@
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"),f=e.attr("id");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).attr("checked",false).triggerHandler("click");return false});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(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}}(jQuery));
var postboxes;(function($){postboxes={add_postbox_toggles:function(page,args){this.init(page,args);$(".postbox h3, .postbox .handlediv").click(function(){var p=$(this).parent(".postbox"),id=p.attr("id");if("dashboard_browser_nag"==id){return}p.toggleClass("closed");postboxes.save_state(page);if(id){if(!p.hasClass("closed")&&$.isFunction(postboxes.pbshow)){postboxes.pbshow(id)}else{if(p.hasClass("closed")&&$.isFunction(postboxes.pbhide)){postboxes.pbhide(id)}}}});$(".postbox h3 a").click(function(e){e.stopPropagation()});$(".postbox a.dismiss").click(function(e){var hide_id=$(this).parents(".postbox").attr("id")+"-hide";$("#"+hide_id).attr("checked",false).triggerHandler("click");return false});$(".hide-postbox-tog").click(function(){var box=$(this).val();if($(this).attr("checked")){$("#"+box).show();if($.isFunction(postboxes.pbshow)){postboxes.pbshow(box)}}else{$("#"+box).hide();if($.isFunction(postboxes.pbhide)){postboxes.pbhide(box)}}postboxes.save_state(page)});$('.columns-prefs input[type="radio"]').click(function(){var num=$(this).val(),i,el,p=$("#poststuff");if(p.length){if(num==2){p.addClass("has-right-sidebar");$("#side-sortables").addClass("temp-border")}else{if(num==1){p.removeClass("has-right-sidebar");$("#normal-sortables").append($("#side-sortables").children(".postbox"))}}}else{for(i=4;(i>num&&i>1);i--){el=$("#"+colname(i)+"-sortables");$("#"+colname(i-1)+"-sortables").append(el.children(".postbox"));el.parent().hide()}for(i=1;i<=num;i++){el=$("#"+colname(i)+"-sortables");if(el.parent().is(":hidden")){el.addClass("temp-border").parent().show()}}$(".postbox-container:visible").css("width",98/num+"%")}postboxes.save_order(page)});function colname(n){switch(n){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},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",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,start:function(e,ui){$("body").css({WebkitUserSelect:"none",KhtmlUserSelect:"none"})},stop:function(e,ui){postboxes.save_order(page);ui.item.parent().removeClass("temp-border");$("body").css({WebkitUserSelect:"",KhtmlUserSelect:""})}})},save_state:function(page){var closed=$(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),hidden=$(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");$.post(ajaxurl,{action:"closed-postboxes",closed:closed,hidden:hidden,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:page})},save_order:function(page){var postVars,page_columns=$(".columns-prefs input:checked").val()||0;postVars={action:"meta-box-order",_ajax_nonce:$("#meta-box-order-nonce").val(),page_columns:page_columns,page:page};$(".meta-box-sortables").each(function(){postVars["order["+this.id.split("-")[0]+"]"]=$(this).sortable("toArray").join(",")});$.post(ajaxurl,postVars)},pbshow:false,pbhide:false}}(jQuery));

View File

@ -324,7 +324,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20100403' );
$scripts->add_data( 'xfn', 'group', 1 );
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110511' );
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20110518' );
$scripts->add_data( 'postbox', 'group', 1 );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110515' );