Ensure we only fire off ajax requests for the dashboard widgets when the cache has expired. Fixes #6533 for trunk props mdawaffe.

git-svn-id: http://svn.automattic.com/wordpress/trunk@7590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2008-04-02 16:22:53 +00:00
parent 3eee635513
commit 9a15c3a960
1 changed files with 12 additions and 6 deletions

View File

@ -9,12 +9,18 @@ wp_dashboard_setup();
function index_js() {
?>
<script type="text/javascript">
jQuery(function() {
jQuery('#dashboard_incoming_links div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=incominglinks');
jQuery('#dashboard_primary div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=devnews');
jQuery('#dashboard_secondary div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=planetnews');
jQuery('#dashboard_plugins div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=plugins');
});
jQuery(function($) {
var ajaxWidgets = {
dashboard_incoming_links: 'incominglinks',
dashboard_primary: 'devnews',
dashboard_secondary: 'planetnews',
dashboard_plugins: 'plugins'
};
$.each( ajaxWidgets, function(i,a) {
var e = jQuery('#' + i + ' div.dashboard-widget-content').not('.dashboard-widget-control').find('.widget-loading');
if ( e.size() ) { e.parent().load('index-extra.php?jax=' + a); }
} );
});
</script>
<?php
}