Dash cleanup.

* Use wp_add_dashboard_widget() rather than add_meta_box().
 * Use original functions like wp_dashboard_primary(), wp_dashboard_right_now(), wp_dashboard_quick_press() (where possible).
 * Only include plugins section of the news widget when appropriate, which necessitates the set_current_screen() via the ajax action.
 * Remove some debug cruft that was preventing caching and invalidation.
 * Simplify lots of things where possible.
see #25824.

Built from https://develop.svn.wordpress.org/trunk@26220


git-svn-id: http://core.svn.wordpress.org/trunk@26128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-11-15 20:15:10 +00:00
parent a9bab73408
commit 2cc8ed1594
9 changed files with 148 additions and 174 deletions

View File

@ -2969,19 +2969,19 @@ body #dashboard-widgets .postbox form .submit {
/* Dashboard Quick Draft */ /* Dashboard Quick Draft */
#dashboard_quick_draft div.updated { #dashboard_quick_press div.updated {
margin-bottom: 10px; margin-bottom: 10px;
border: 1px solid #eee; border: 1px solid #eee;
border-width: 1px 0 1px 1px; border-width: 1px 0 1px 1px;
} }
#dashboard_quick_draft form { #dashboard_quick_press form {
padding: 0 12px 1px 12px; padding: 0 12px 1px 12px;
overflow: hidden; overflow: hidden;
} }
#dashboard_quick_draft .drafts, #dashboard_quick_press .drafts,
#dashboard_quick_draft .easy-blogging { #dashboard_quick_press .easy-blogging {
padding: 8px 12px 0; padding: 8px 12px 0;
} }
@ -3012,15 +3012,15 @@ form.initial-form.quickpress-open input#title {
height: auto; height: auto;
} }
#dashboard_quick_draft input, #dashboard_quick_press input,
#dashboard_quick_draft textarea { #dashboard_quick_press textarea {
box-sizing: border-box; box-sizing: border-box;
-moz-box-sizing:border-box; -moz-box-sizing:border-box;
-webkit-box-sizing:border-box; -webkit-box-sizing:border-box;
margin: 0; margin: 0;
} }
#dashboard_quick_draft textarea { #dashboard_quick_press textarea {
resize: vertical; resize: vertical;
} }
@ -3070,21 +3070,21 @@ form.initial-form.quickpress-open input#title {
/* Dashboard Quick Draft - Drafts list */ /* Dashboard Quick Draft - Drafts list */
#dashboard_quick_draft .drafts { #dashboard_quick_press .drafts {
border-top: 1px solid #eee; border-top: 1px solid #eee;
margin-top: 12px; margin-top: 12px;
} }
#dashboard_quick_draft .drafts abbr { #dashboard_quick_press .drafts abbr {
border: none; border: none;
} }
#dashboard_quick_draft .drafts h4 { #dashboard_quick_press .drafts h4 {
margin: 0 0 8px 0; margin: 0 0 8px 0;
font-weight: normal; font-weight: normal;
} }
#dashboard_quick_draft .drafts .view-all { #dashboard_quick_press .drafts .view-all {
float: left; float: left;
margin-top: 0; margin-top: 0;
} }

File diff suppressed because one or more lines are too long

View File

@ -2969,19 +2969,19 @@ body #dashboard-widgets .postbox form .submit {
/* Dashboard Quick Draft */ /* Dashboard Quick Draft */
#dashboard_quick_draft div.updated { #dashboard_quick_press div.updated {
margin-bottom: 10px; margin-bottom: 10px;
border: 1px solid #eee; border: 1px solid #eee;
border-width: 1px 1px 1px 0; border-width: 1px 1px 1px 0;
} }
#dashboard_quick_draft form { #dashboard_quick_press form {
padding: 0 12px 1px 12px; padding: 0 12px 1px 12px;
overflow: hidden; overflow: hidden;
} }
#dashboard_quick_draft .drafts, #dashboard_quick_press .drafts,
#dashboard_quick_draft .easy-blogging { #dashboard_quick_press .easy-blogging {
padding: 8px 12px 0; padding: 8px 12px 0;
} }
@ -3012,15 +3012,15 @@ form.initial-form.quickpress-open input#title {
height: auto; height: auto;
} }
#dashboard_quick_draft input, #dashboard_quick_press input,
#dashboard_quick_draft textarea { #dashboard_quick_press textarea {
box-sizing: border-box; box-sizing: border-box;
-moz-box-sizing:border-box; -moz-box-sizing:border-box;
-webkit-box-sizing:border-box; -webkit-box-sizing:border-box;
margin: 0; margin: 0;
} }
#dashboard_quick_draft textarea { #dashboard_quick_press textarea {
resize: vertical; resize: vertical;
} }
@ -3070,21 +3070,21 @@ form.initial-form.quickpress-open input#title {
/* Dashboard Quick Draft - Drafts list */ /* Dashboard Quick Draft - Drafts list */
#dashboard_quick_draft .drafts { #dashboard_quick_press .drafts {
border-top: 1px solid #eee; border-top: 1px solid #eee;
margin-top: 12px; margin-top: 12px;
} }
#dashboard_quick_draft .drafts abbr { #dashboard_quick_press .drafts abbr {
border: none; border: none;
} }
#dashboard_quick_draft .drafts h4 { #dashboard_quick_press .drafts h4 {
margin: 0 0 8px 0; margin: 0 0 8px 0;
font-weight: normal; font-weight: normal;
} }
#dashboard_quick_draft .drafts .view-all { #dashboard_quick_press .drafts .view-all {
float: right; float: right;
margin-top: 0; margin-top: 0;
} }

File diff suppressed because one or more lines are too long

View File

@ -233,9 +233,14 @@ function wp_ajax_autocomplete_user() {
function wp_ajax_dashboard_widgets() { function wp_ajax_dashboard_widgets() {
require_once ABSPATH . 'wp-admin/includes/dashboard.php'; require_once ABSPATH . 'wp-admin/includes/dashboard.php';
$pagenow = $_GET['pagenow'];
if ( $pagenow === 'dashboard-user' || $pagenow === 'dashboard-network' || $pagenow === 'dashboard' ) {
set_current_screen( $pagenow );
}
switch ( $_GET['widget'] ) { switch ( $_GET['widget'] ) {
case 'dashboard_rss' : case 'dashboard_primary' :
wp_dashboard_rss(); wp_dashboard_primary();
break; break;
} }
wp_die(); wp_die();

View File

@ -37,20 +37,20 @@ function wp_dashboard_setup() {
// Right Now // Right Now
if ( is_blog_admin() && current_user_can('edit_posts') ) if ( is_blog_admin() && current_user_can('edit_posts') )
add_meta_box( 'dash-right-now', 'Site Content', 'dashboard_new_right_now', 'dashboard', 'normal', 'high' ); wp_add_dashboard_widget( 'dash-right-now', __( 'Site Content' ), 'wp_dashboard_right_now' );
if ( is_network_admin() ) if ( is_network_admin() )
wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' ); wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
// Activity Widget // Activity Widget
add_meta_box( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_activity', 'dashboard', 'normal', 'high' ); wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_activity' );
// QuickPress Widget // QuickPress Widget
if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
add_meta_box( 'dashboard_quick_draft', __( 'Quick Draft' ), 'wp_dashboard_quick_draft', 'dashboard', 'side', 'high' ); wp_add_dashboard_widget( 'dashboard_quick_press', __( 'Quick Draft' ), 'wp_dashboard_quick_press' );
// WordPress News // WordPress News
add_meta_box( 'dashboard_rss', __( 'WordPress News' ), 'wp_dashboard_rss', 'dashboard', 'side', 'low' ); wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress News' ), 'wp_dashboard_primary' );
// Hook to register new widgets // Hook to register new widgets
// Filter widget order // Filter widget order
@ -104,12 +104,7 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_
} }
} }
if ( is_blog_admin () ) $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
$side_widgets = array('dashboard_quick_draft');
else if (is_network_admin() )
$side_widgets = array();
else
$side_widgets = array();
$location = 'normal'; $location = 'normal';
if ( in_array($widget_id, $side_widgets) ) if ( in_array($widget_id, $side_widgets) )
@ -118,6 +113,8 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_
$priority = 'core'; $priority = 'core';
if ( 'dashboard_browser_nag' === $widget_id ) if ( 'dashboard_browser_nag' === $widget_id )
$priority = 'high'; $priority = 'high';
elseif ( 'dashboard_primary' === $widget_id )
$priority = 'low';
add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args ); add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args );
} }
@ -164,7 +161,14 @@ function wp_dashboard() {
/* Dashboard Widgets */ /* Dashboard Widgets */
function dashboard_new_right_now() { /**
* Dashboard widget that displays some basic stats about the site.
*
* Formerly 'Right Now'. A streamlined 'Site Content' as of 3.8.
*
* @since 2.7.0
*/
function wp_dashboard_right_now() {
$theme = wp_get_theme(); $theme = wp_get_theme();
if ( current_user_can( 'switch_themes' ) ) if ( current_user_can( 'switch_themes' ) )
$theme_name = sprintf( '<a href="themes.php">%1$s</a>', $theme->display('Name') ); $theme_name = sprintf( '<a href="themes.php">%1$s</a>', $theme->display('Name') );
@ -283,7 +287,7 @@ function wp_network_dashboard_right_now() {
* @since 3.8.0 * @since 3.8.0
* *
*/ */
function wp_dashboard_quick_draft( $error_msg=false ) { function wp_dashboard_quick_press( $error_msg=false ) {
global $post_ID; global $post_ID;
/* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */ /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */
@ -305,8 +309,6 @@ function wp_dashboard_quick_draft( $error_msg=false ) {
} }
$post_ID = (int) $post->ID; $post_ID = (int) $post->ID;
do_action( 'dashboard_quickdraft_beginning', $post );
?> ?>
<form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form"> <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form">
@ -338,8 +340,6 @@ function wp_dashboard_quick_draft( $error_msg=false ) {
<?php <?php
wp_dashboard_recent_quickdrafts(); wp_dashboard_recent_quickdrafts();
do_action( 'dashboard_quickdraft_end' );
} }
/** /**
@ -676,6 +676,20 @@ function dashboard_relative_date( $time ) {
} }
/**
* Display generic dashboard RSS widget feed.
*
* @since 2.5.0
*
* @param string $widget_id
*/
function wp_dashboard_rss_output( $widget_id ) {
$widgets = get_option( 'dashboard_widget_options' );
echo '<div class="rss-widget">';
wp_widget_rss_output( $widgets[ $widget_id ] );
echo "</div>";
}
/** /**
* Checks to see if all of the feed url in $check_urls are cached. * Checks to see if all of the feed url in $check_urls are cached.
* *
@ -745,15 +759,12 @@ function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
} }
/** /**
* Returns default WordPress News feeds * WordPress News dashboard widget.
*
*
*
* @since 3.8.0
* *
* @since 2.7.0
*/ */
function wp_dashboard_default_feeds() { function wp_dashboard_primary() {
return array( $feeds = array(
'news' => array( 'news' => array(
'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ), 'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ), 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
@ -771,161 +782,120 @@ function wp_dashboard_default_feeds() {
'show_summary' => 0, 'show_summary' => 0,
'show_author' => 0, 'show_author' => 0,
'show_date' => 0, 'show_date' => 0,
), )
'plugins' => array( );
if ( ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) {
$feeds['plugins'] = array(
'link' => '', 'link' => '',
'url' => array( 'url' => array(
'popular' => 'http://wordpress.org/plugins/rss/browse/popular/' 'popular' => 'http://wordpress.org/plugins/rss/browse/popular/',
), ),
'title' => '', 'title' => '',
'items' => 1, 'items' => 1,
'show_summary' => 0, 'show_summary' => 0,
'show_author' => 0, 'show_author' => 0,
'show_date' => 0, 'show_date' => 0,
) );
);
}
/**
* Check for cached feeds
*
*
*
* @since 3.8.0
*
*/
function wp_dashboard_rss() {
$default_feeds = wp_dashboard_default_feeds();
$widget_options = get_option( 'dashboard_widget_options' );
if ( !$widget_options || !is_array($widget_options) )
$widget_options = array();
//if ( ! isset( $widget_options['dashboard_rss'] ) ) {
$widget_options['dashboard_rss'] = $default_feeds;
update_option( 'dashboard_widget_options', $widget_options );
//}
foreach( $default_feeds as $key => $value ) {
$default_urls[] = $value['url'];
} }
$cache_key = 'dash_' . md5( 'dashboard_rss' ); wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds );
delete_transient( $cache_key );
do_action( 'dashboard_news_beginning' );
wp_dashboard_cached_rss_widget( 'dashboard_rss', 'wp_dashboard_news_output', $default_urls );
do_action( 'dashboard_news_end' );
} }
/** /**
* Display news feeds * Display the WordPress news feeds.
*
*
* *
* @since 3.8.0 * @since 3.8.0
*
*/ */
function wp_dashboard_news_output() { function wp_dashboard_primary_output( $widget_id, $feeds ) {
$widgets = get_option( 'dashboard_widget_options' ); foreach( $feeds as $type => $args ) {
foreach( $widgets['dashboard_rss'] as $type => $args ) {
$args['type'] = $type; $args['type'] = $type;
echo '<div class="rss-widget">'; echo '<div class="rss-widget">';
wp_widget_news_output( $args['url'], $args ); if ( $type === 'plugins' ) {
wp_dashboard_plugins_output( $args['url'], $args );
} else {
wp_widget_rss_output( $args['url'], $args );
}
echo "</div>"; echo "</div>";
} }
} }
/** /**
* Generate code for each news feed * Display plugins text for the WordPress news widget.
*
*
*
* @since 3.8.0
* *
* @since 2.5.0
*/ */
function wp_widget_news_output( $rss, $args = array() ) { function wp_dashboard_plugins_output( $rss, $args = array() ) {
// Regular RSS feeds
if ( isset( $args['type'] ) && 'plugins' != $args['type'] )
return wp_widget_rss_output( $rss, $args );
// Plugin feeds plus link to install them // Plugin feeds plus link to install them
if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { $popular = fetch_feed( $args['url']['popular'] );
$popular = fetch_feed( $args['url']['popular'] );
if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
$plugin_slugs = array_keys( get_plugins() ); $plugin_slugs = array_keys( get_plugins() );
set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
} }
echo '<ul>'; echo '<ul>';
foreach ( array( foreach ( array(
'popular' => __( 'Popular Plugin' ) 'popular' => __( 'Popular Plugin' )
) as $feed => $label ) { ) as $feed => $label ) {
if ( is_wp_error($$feed) || !$$feed->get_item_quantity() ) if ( is_wp_error($$feed) || !$$feed->get_item_quantity() )
continue;
$items = $$feed->get_items(0, 5);
// Pick a random, non-installed plugin
while ( true ) {
// Abort this foreach loop iteration if there's no plugins left of this type
if ( 0 == count($items) )
continue 2;
$item_key = array_rand($items);
$item = $items[$item_key];
list($link, $frag) = explode( '#', $item->get_link() );
$link = esc_url($link);
if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
$slug = $matches[1];
else {
unset( $items[$item_key] );
continue; continue;
$items = $$feed->get_items(0, 5);
// Pick a random, non-installed plugin
while ( true ) {
// Abort this foreach loop iteration if there's no plugins left of this type
if ( 0 == count($items) )
continue 2;
$item_key = array_rand($items);
$item = $items[$item_key];
list($link, $frag) = explode( '#', $item->get_link() );
$link = esc_url($link);
if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
$slug = $matches[1];
else {
unset( $items[$item_key] );
continue;
}
// Is this random plugin's slug already installed? If so, try again.
reset( $plugin_slugs );
foreach ( $plugin_slugs as $plugin_slug ) {
if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
unset( $items[$item_key] );
continue 2;
}
}
// If we get to this point, then the random plugin isn't installed and we can stop the while().
break;
} }
// Eliminate some common badly formed plugin descriptions // Is this random plugin's slug already installed? If so, try again.
while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) reset( $plugin_slugs );
unset($items[$item_key]); foreach ( $plugin_slugs as $plugin_slug ) {
if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
unset( $items[$item_key] );
continue 2;
}
}
if ( !isset($items[$item_key]) ) // If we get to this point, then the random plugin isn't installed and we can stop the while().
continue; break;
$title = esc_html( $item->get_title() );
$description = esc_html( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
echo "<li class='dashboard-news-plugin'><span>$label:</span> <a href='$link' class='dashboard-news-plugin-link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span></li>";
$$feed->__destruct();
unset( $$feed );
} }
echo '</ul>'; // Eliminate some common badly formed plugin descriptions
while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
unset($items[$item_key]);
if ( !isset($items[$item_key]) )
continue;
$title = esc_html( $item->get_title() );
$description = esc_html( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
echo "<li class='dashboard-news-plugin'><span>$label:</span> <a href='$link' class='dashboard-news-plugin-link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span></li>";
$$feed->__destruct();
unset( $$feed );
} }
echo '</ul>';
} }
/** /**

View File

@ -730,7 +730,7 @@ function get_others_pending($user_id) {
*/ */
function wp_dashboard_quick_press_output() { function wp_dashboard_quick_press_output() {
_deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' ); _deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' );
wp_dashboard_quick_draft(); wp_dashboard_quick_press();
} }
/** /**

View File

@ -1,3 +1,4 @@
/* global pagenow */
var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad; var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
jQuery(document).ready( function($) { jQuery(document).ready( function($) {
@ -28,9 +29,7 @@ jQuery(document).ready( function($) {
}); });
// These widgets are sometimes populated via ajax // These widgets are sometimes populated via ajax
ajaxWidgets = [ ajaxWidgets = ['dashboard_primary'];
'dashboard_rss'
];
ajaxPopulateWidgets = function(el) { ajaxPopulateWidgets = function(el) {
function show(i, id) { function show(i, id) {
@ -38,7 +37,7 @@ jQuery(document).ready( function($) {
if ( e.length ) { if ( e.length ) {
p = e.parent(); p = e.parent();
setTimeout( function(){ setTimeout( function(){
p.load( ajaxurl + '?action=dashboard-widgets&widget=' + id, '', function() { p.load( ajaxurl + '?action=dashboard-widgets&widget=' + id + '&pagenow=' + pagenow, '', function() {
p.hide().slideDown('normal', function(){ p.hide().slideDown('normal', function(){
$(this).css('display', ''); $(this).css('display', '');
}); });

View File

@ -1 +1 @@
var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){function b(){var a=1,b=parseInt(jQuery(window).width());b>799&&1299>b&&(a=2),b>1300&&1799>b&&(a=3),b>1800&&(a=4),jQuery(".metabox-holder").attr("class",jQuery(".metabox-holder").attr("class").replace(/columns-\d+/,"columns-"+a))}var c=a("#welcome-panel"),d=a("#wp_welcome_panel-hide"),e=function(b){a.post(ajaxurl,{action:"update-welcome-panel",visible:b,welcomepanelnonce:a("#welcomepanelnonce").val()})};c.hasClass("hidden")&&d.prop("checked")&&c.removeClass("hidden"),a(".welcome-panel-close, .welcome-panel-dismiss a",c).click(function(b){b.preventDefault(),c.addClass("hidden"),e(0),a("#wp_welcome_panel-hide").prop("checked",!1)}),d.click(function(){c.toggleClass("hidden",!this.checked),e(this.checked?1:0)}),ajaxWidgets=["dashboard_rss"],ajaxPopulateWidgets=function(b){function c(b,c){var d,e=a("#"+c+" div.inside:visible").find(".widget-loading");e.length&&(d=e.parent(),setTimeout(function(){d.load(ajaxurl+"?action=dashboard-widgets&widget="+c,"",function(){d.hide().slideDown("normal",function(){a(this).css("display","")})})},500*b))}b?(b=b.toString(),-1!=a.inArray(b,ajaxWidgets)&&c(0,b)):a.each(ajaxWidgets,c)},ajaxPopulateWidgets(),postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets}),quickPressLoad=function(){var b,c=a("#quickpost-action");b=a("#quick-press").submit(function(){function c(){var b=a("#draft-list li").first();b.css("background","#fffbe5"),setTimeout(function(){b.css("background","none")},1e3)}return a("#dashboard_quick_draft #publishing-action .spinner").show(),a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!0),a.post(b.attr("action"),b.serializeArray(),function(b){a("#dashboard_quick_draft .inside").html(b),a("#quick-press").removeClass("initial-form"),quickPressLoad(),c(),a("#title").focus()}),!1}),a("#publish").click(function(){c.val("post-quickpress-publish")}),a("#title, #tags-input, #content").each(function(){var b=a(this),c=a("#"+this.id+"-prompt-text");""===this.value&&c.removeClass("screen-reader-text"),c.click(function(){a(this).addClass("screen-reader-text"),b.focus()}),b.blur(function(){""===this.value&&c.removeClass("screen-reader-text")}),b.focus(function(){c.addClass("screen-reader-text")})}),a("#quick-press").on("click focusin",function(){a(this).addClass("quickpress-open"),a("#description-wrap, p.submit").slideDown(200),wpActiveEditor="content"})},quickPressLoad(),a(".show-more a").on("click",function(b){a(this).fadeOut().closest(".activity-block").find("li.hidden").fadeIn().removeClass("hidden"),b.preventDefault()}),jQuery(document).ready(function(){b()}),jQuery(window).resize(_.debounce(function(){b()},30))}); var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){function b(){var a=1,b=parseInt(jQuery(window).width());b>799&&1299>b&&(a=2),b>1300&&1799>b&&(a=3),b>1800&&(a=4),jQuery(".metabox-holder").attr("class",jQuery(".metabox-holder").attr("class").replace(/columns-\d+/,"columns-"+a))}var c=a("#welcome-panel"),d=a("#wp_welcome_panel-hide"),e=function(b){a.post(ajaxurl,{action:"update-welcome-panel",visible:b,welcomepanelnonce:a("#welcomepanelnonce").val()})};c.hasClass("hidden")&&d.prop("checked")&&c.removeClass("hidden"),a(".welcome-panel-close, .welcome-panel-dismiss a",c).click(function(b){b.preventDefault(),c.addClass("hidden"),e(0),a("#wp_welcome_panel-hide").prop("checked",!1)}),d.click(function(){c.toggleClass("hidden",!this.checked),e(this.checked?1:0)}),ajaxWidgets=["dashboard_primary"],ajaxPopulateWidgets=function(b){function c(b,c){var d,e=a("#"+c+" div.inside:visible").find(".widget-loading");e.length&&(d=e.parent(),setTimeout(function(){d.load(ajaxurl+"?action=dashboard-widgets&widget="+c+"&pagenow="+pagenow,"",function(){d.hide().slideDown("normal",function(){a(this).css("display","")})})},500*b))}b?(b=b.toString(),-1!=a.inArray(b,ajaxWidgets)&&c(0,b)):a.each(ajaxWidgets,c)},ajaxPopulateWidgets(),postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets}),quickPressLoad=function(){var b,c=a("#quickpost-action");b=a("#quick-press").submit(function(){function c(){var b=a("#draft-list li").first();b.css("background","#fffbe5"),setTimeout(function(){b.css("background","none")},1e3)}return a("#dashboard_quick_draft #publishing-action .spinner").show(),a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!0),a.post(b.attr("action"),b.serializeArray(),function(b){a("#dashboard_quick_draft .inside").html(b),a("#quick-press").removeClass("initial-form"),quickPressLoad(),c(),a("#title").focus()}),!1}),a("#publish").click(function(){c.val("post-quickpress-publish")}),a("#title, #tags-input, #content").each(function(){var b=a(this),c=a("#"+this.id+"-prompt-text");""===this.value&&c.removeClass("screen-reader-text"),c.click(function(){a(this).addClass("screen-reader-text"),b.focus()}),b.blur(function(){""===this.value&&c.removeClass("screen-reader-text")}),b.focus(function(){c.addClass("screen-reader-text")})}),a("#quick-press").on("click focusin",function(){a(this).addClass("quickpress-open"),a("#description-wrap, p.submit").slideDown(200),wpActiveEditor="content"})},quickPressLoad(),a(".show-more a").on("click",function(b){a(this).fadeOut().closest(".activity-block").find("li.hidden").fadeIn().removeClass("hidden"),b.preventDefault()}),jQuery(document).ready(function(){b()}),jQuery(window).resize(_.debounce(function(){b()},30))});