WordPress.org

Make WordPress Core

Changeset 7590


Ignore:
Timestamp:
04/02/2008 04:22:53 PM (10 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/index.php

    r7504 r7590  
    1010?>
    1111<script type="text/javascript">
    12     jQuery(function() {
    13         jQuery('#dashboard_incoming_links div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=incominglinks');
    14         jQuery('#dashboard_primary div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=devnews');
    15         jQuery('#dashboard_secondary div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=planetnews');
    16         jQuery('#dashboard_plugins div.dashboard-widget-content').not( '.dashboard-widget-control' ).find( '.widget-loading' ).parent().load('index-extra.php?jax=plugins');
    17     });
     12jQuery(function($) {
     13    var ajaxWidgets = {
     14        dashboard_incoming_links: 'incominglinks',
     15        dashboard_primary: 'devnews',
     16        dashboard_secondary: 'planetnews',
     17        dashboard_plugins: 'plugins'
     18    };
     19    $.each( ajaxWidgets, function(i,a) {
     20        var e = jQuery('#' + i + ' div.dashboard-widget-content').not('.dashboard-widget-control').find('.widget-loading');
     21        if ( e.size() ) { e.parent().load('index-extra.php?jax=' + a); }
     22    } );
     23});
    1824</script>
    1925<?php
Note: See TracChangeset for help on using the changeset viewer.