WordPress.org

Make WordPress Core

Ticket #10133: dashboard-ajax-load-rss-2.patch

File dashboard-ajax-load-rss-2.patch, 13.9 KB (added by azaozz, 6 years ago)
  • wp-admin/includes/dashboard.php

     
    605605} 
    606606 
    607607function wp_dashboard_incoming_links() { 
    608         wp_dashboard_cached_rss_widget( 'dashboard_incoming_links', 'wp_dashboard_incoming_links_output' ); 
     608        echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 
    609609} 
    610610 
    611611/** 
     
    690690} 
    691691 
    692692function wp_dashboard_primary() { 
    693         wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' ); 
     693        echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 
    694694} 
    695695 
    696696function wp_dashboard_primary_control() { 
     
    712712} 
    713713 
    714714function wp_dashboard_secondary() { 
    715         wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' ); 
     715        echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 
    716716} 
    717717 
    718718function wp_dashboard_secondary_control() { 
     
    747747} 
    748748 
    749749function wp_dashboard_plugins() { 
    750         wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array( 
    751                 'http://wordpress.org/extend/plugins/rss/browse/popular/', 
    752                 'http://wordpress.org/extend/plugins/rss/browse/new/', 
    753                 'http://wordpress.org/extend/plugins/rss/browse/updated/' 
    754         ) ); 
     750        echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 
    755751} 
    756752 
    757753/** 
  • wp-admin/js/dashboard.dev.js

     
     1var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad; 
    12 
    23jQuery(document).ready( function($) { 
    3         var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad; 
    44        // These widgets are sometimes populated via ajax 
    55        ajaxWidgets = [ 
    66                'dashboard_incoming_links', 
     
    99                'dashboard_plugins' 
    1010        ]; 
    1111 
    12         ajaxPopulateWidgets = function() { 
    13                 $.each( ajaxWidgets, function() { 
    14                         var e = jQuery('#' + this + ':visible div.inside').find('.widget-loading'); 
    15                         if ( e.size() ) { e.parent().load('index-extra.php?jax=' + this); } 
    16                 } ); 
     12        ajaxPopulateWidgets = function(el) { 
     13                show = function(id, i) { 
     14                        var p, e = $('#' + id + ' div.inside:visible').find('.widget-loading'); 
     15                        if ( e.length ) { 
     16                                p = e.parent(); 
     17                                setTimeout( function(){ p.slideUp().load('index-extra.php?jax=' + id, '', function() { p.slideDown('normal', function(){ $(this).css('display', ''); }); }); }, i * 500 ); 
     18                        } 
     19                } 
     20                if ( el ) { 
     21                        el = el.toString(); 
     22                        if ( $.inArray(el, ajaxWidgets) != -1 ) 
     23                                show(el, 0); 
     24                } else { 
     25                        $.each( ajaxWidgets, function(i) { 
     26                                show(this, i); 
     27                        }); 
     28                } 
    1729        }; 
    1830        ajaxPopulateWidgets(); 
    1931 
    20         postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } ); 
     32        postboxes.add_postbox_toggles('dashboard', { pbshow: ajaxPopulateWidgets } ); 
    2133 
    2234        /* QuickPress */ 
    2335        quickPressLoad = function() { 
  • wp-admin/js/dashboard.js

     
    1 jQuery(document).ready(function(c){var a,b,d;a=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];b=function(){c.each(a,function(){var f=jQuery("#"+this+":visible div.inside").find(".widget-loading");if(f.size()){f.parent().load("index-extra.php?jax="+this)}})};b();postboxes.add_postbox_toggles("dashboard",{onShow:b});d=function(){var e=c("#quickpost-action"),f;f=c("#quick-press").submit(function(){c("#dashboard_quick_press h3").append('<img src="images/wpspin_light.gif" style="margin: 0 6px 0 0; vertical-align: middle" />');c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==e.val()){e.val("post-quickpress-publish")}c("#dashboard_quick_press div.inside").load(f.attr("action"),f.serializeArray(),function(){c("#dashboard_quick_press h3 img").remove();c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");c("#dashboard_quick_press ul").find("li").each(function(){c("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");d()});return false});c("#publish").click(function(){e.val("post-quickpress-publish")})};d()}); 
    2  No newline at end of file 
     1var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];ajaxPopulateWidgets=function(b){show=function(g,c){var f,d=a("#"+g+" div.inside:visible").find(".widget-loading");if(d.length){f=d.parent();setTimeout(function(){f.slideUp().load("index-extra.php?jax="+g,"",function(){f.slideDown("normal",function(){a(this).css("display","")})})},c*500)}};if(b){b=b.toString();if(a.inArray(b,ajaxWidgets)!=-1){show(b,0)}}else{a.each(ajaxWidgets,function(c){show(this,c)})}};ajaxPopulateWidgets();postboxes.add_postbox_toggles("dashboard",{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press h3").append('<img src="images/wpspin_light.gif" style="margin: 0 6px 0 0; vertical-align: middle" />');a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press h3 img").remove();a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})};quickPressLoad()}); 
     2 No newline at end of file 
  • wp-admin/js/postbox.dev.js

     
    44                add_postbox_toggles : function(page,args) { 
    55                        this.init(page,args); 
    66                        $('.postbox h3, .postbox .handlediv').click( function() { 
    7                                 var p = $(this).parent('.postbox'); 
    8                                 /* 
    9                                 if ( p.hasClass('noclick') ) { 
    10                                         p.removeClass('noclick'); 
    11                                         return false; 
    12                                 } 
    13                                 */ 
     7                                var p = $(this).parent('.postbox'), id = p.attr('id'); 
    148                                p.toggleClass('closed'); 
    159                                postboxes.save_state(page); 
     10                                if ( id ) { 
     11                                        if ( !p.hasClass('closed') && $.isFunction(postboxes.pbshow) ) 
     12                                                postboxes.pbshow(id); 
     13                                        else if ( p.hasClass('closed') && $.isFunction(postboxes.pbhide) ) 
     14                                                postboxes.pbhide(id); 
     15                                } 
    1616                        } ); 
    1717                        $('.postbox h3 a').click( function(e) { 
    1818                                e.stopPropagation(); 
  • wp-admin/js/postbox.js

     
    1 var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var e=a(this).parent(".postbox");e.toggleClass("closed");postboxes.save_state(c)});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).attr("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,h=a("#poststuff");if(h.length){if(e==2){h.addClass("has-right-sidebar");a("#side-sortables").addClass("temp-border")}else{if(e==1){h.removeClass("has-right-sidebar");a("#normal-sortables").append(a("#side-sortables").children(".postbox"))}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=1;f<=e;f++){g=a("#"+d(f)+"-sortables");if(g.parent().is(":hidden")){g.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",98/e+"%")}postboxes.save_order(c)});function d(e){switch(e){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,start:function(f,d){a("body").css({WebkitUserSelect:"none",KhtmlUserSelect:"none"})},stop:function(f,d){postboxes.save_order(c);d.item.parent().removeClass("temp-border");a("body").css({WebkitUserSelect:"",KhtmlUserSelect:""})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,b)},pbshow:false,pbhide:false}}(jQuery)); 
    2  No newline at end of file 
     1var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var e=a(this).parent(".postbox"),f=e.attr("id");e.toggleClass("closed");postboxes.save_state(c);if(f){if(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(f)}else{if(e.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(f)}}}});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).attr("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,h=a("#poststuff");if(h.length){if(e==2){h.addClass("has-right-sidebar");a("#side-sortables").addClass("temp-border")}else{if(e==1){h.removeClass("has-right-sidebar");a("#normal-sortables").append(a("#side-sortables").children(".postbox"))}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=1;f<=e;f++){g=a("#"+d(f)+"-sortables");if(g.parent().is(":hidden")){g.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",98/e+"%")}postboxes.save_order(c)});function d(e){switch(e){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,start:function(f,d){a("body").css({WebkitUserSelect:"none",KhtmlUserSelect:"none"})},stop:function(f,d){postboxes.save_order(c);d.item.parent().removeClass("temp-border");a("body").css({WebkitUserSelect:"",KhtmlUserSelect:""})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,b)},pbshow:false,pbhide:false}}(jQuery)); 
     2 No newline at end of file 
  • wp-includes/script-loader.php

     
    249249 
    250250                $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' ); 
    251251 
    252                 $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090327' ); 
     252                $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090618' ); 
    253253                $scripts->add_data( 'postbox', 'group', 1 ); 
    254254                $scripts->localize( 'postbox', 'postboxL10n', array( 
    255255                        'requestFile' => admin_url('admin-ajax.php') 
     
    377377 
    378378                $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); 
    379379 
    380                 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090201' ); 
     380                $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090618' ); 
    381381                $scripts->add_data( 'dashboard', 'group', 1 ); 
    382382 
    383383                $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' );