WordPress.org

Make WordPress Core

Ticket #6533: 6533.diff

File 6533.diff, 1.4 KB (added by mdawaffe, 10 years ago)
  • wp-admin/index.php

     
    99function index_js() {
    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
    2026}