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: https://develop.svn.wordpress.org/trunk@7590 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2008-04-02 16:22:53 +00:00
parent 414be415cd
commit ecc7ec153a
1 changed files with 12 additions and 6 deletions

View File

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