mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
List table spinner. Props scribu. see #15580
git-svn-id: http://svn.automattic.com/wordpress/trunk@17090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8a8785c98b
commit
3bce6d9be9
File diff suppressed because one or more lines are too long
@ -4193,14 +4193,13 @@ td.media-icon img {
|
||||
}
|
||||
* html #template div {margin-right: 0;}
|
||||
#save {width: 15em;}
|
||||
#loading-items {
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
padding: 10px 0;
|
||||
background-color: #fff;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
opacity: 0.5;
|
||||
.list-ajax-loading {
|
||||
float: right;
|
||||
margin-right: 9px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
.tablenav .list-ajax-loading {
|
||||
margin-top: 7px;
|
||||
}
|
||||
#howto {
|
||||
font-size: 11px;
|
||||
|
@ -199,6 +199,7 @@ class WP_List_Table {
|
||||
<input type="text" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<?php submit_button( $text, 'button', 'submit', false ); ?>
|
||||
</p>
|
||||
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
|
||||
<?php
|
||||
}
|
||||
|
||||
@ -730,11 +731,14 @@ class WP_List_Table {
|
||||
<div class="alignleft actions">
|
||||
<?php $this->bulk_actions( $which ); ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
$this->extra_tablenav( $which );
|
||||
$this->pagination( $which );
|
||||
?>
|
||||
|
||||
if ( 'bottom' == $which ) {
|
||||
?>
|
||||
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
|
||||
<?php } ?>
|
||||
|
||||
<br class="clear" />
|
||||
</div>
|
||||
|
@ -111,16 +111,18 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
|
||||
function display_tablenav( $which ) {
|
||||
if ( 'top' == $which ) { ?>
|
||||
<div class="tablenav">
|
||||
<div class="tablenav top">
|
||||
<div class="alignleft actions">
|
||||
<?php do_action( 'install_plugins_table_header' ); ?>
|
||||
</div>
|
||||
<?php $this->pagination( $which ); ?>
|
||||
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="tablenav">
|
||||
<div class="tablenav bottom">
|
||||
<?php $this->pagination( $which ); ?>
|
||||
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<?php
|
||||
|
@ -127,11 +127,12 @@ class WP_Theme_Install_List_Table extends WP_List_Table {
|
||||
|
||||
function display() {
|
||||
?>
|
||||
<div class="tablenav">
|
||||
<div class="tablenav top">
|
||||
<div class="alignleft actions">
|
||||
<?php do_action( 'install_themes_table_header' ); ?>
|
||||
</div>
|
||||
<?php $this->pagination( 'top' ); ?>
|
||||
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
|
||||
@ -141,8 +142,9 @@ class WP_Theme_Install_List_Table extends WP_List_Table {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="tablenav">
|
||||
<div class="tablenav bottom">
|
||||
<?php $this->pagination( 'bottom' ); ?>
|
||||
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<?php
|
||||
|
@ -85,8 +85,9 @@ class WP_Themes_List_Table extends WP_List_Table {
|
||||
|
||||
function display() {
|
||||
?>
|
||||
<div class="tablenav">
|
||||
<div class="tablenav top">
|
||||
<?php $this->pagination( 'top' ); ?>
|
||||
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
|
||||
@ -96,8 +97,9 @@ class WP_Themes_List_Table extends WP_List_Table {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="tablenav">
|
||||
<div class="tablenav bottom">
|
||||
<?php $this->pagination( 'bottom' ); ?>
|
||||
<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<?php
|
||||
|
@ -14,11 +14,6 @@ window.listTable = {
|
||||
this.set_total_pages();
|
||||
|
||||
this.$tbody = $('#the-list, #the-comment-list');
|
||||
|
||||
this.$overlay = $('<div id="loading-items">')
|
||||
.html(listTableL10n.loading)
|
||||
.hide()
|
||||
.prependTo($('body'));
|
||||
},
|
||||
|
||||
// paging
|
||||
@ -53,7 +48,7 @@ window.listTable = {
|
||||
if ( !different )
|
||||
return false;
|
||||
|
||||
this.show_overlay();
|
||||
this.start_loading();
|
||||
|
||||
if ( reset_paging )
|
||||
$.query.SET('paged', 1);
|
||||
@ -96,7 +91,7 @@ window.listTable = {
|
||||
if ( 'object' != typeof response ) {
|
||||
this.handle_error();
|
||||
} else {
|
||||
this.hide_overlay();
|
||||
this.stop_loading();
|
||||
|
||||
this.$tbody.html(response.rows);
|
||||
|
||||
@ -119,28 +114,23 @@ window.listTable = {
|
||||
},
|
||||
|
||||
handle_error: function() {
|
||||
this.hide_overlay();
|
||||
this.stop_loading();
|
||||
|
||||
$('h2').after('<div class="error ajax below-h2"><p>' + listTableL10n.error + '</p></div>');
|
||||
},
|
||||
|
||||
show_overlay: function() {
|
||||
start_loading: function() {
|
||||
this.loading = true;
|
||||
|
||||
$('.error.ajax').remove();
|
||||
|
||||
this.$overlay
|
||||
.css({
|
||||
width: this.$tbody.width() + 'px',
|
||||
height: this.$tbody.height() - 20 + 'px'
|
||||
})
|
||||
.css(this.$tbody.offset())
|
||||
.show();
|
||||
$('.list-ajax-loading').css('visibility', 'visible');
|
||||
},
|
||||
|
||||
hide_overlay: function() {
|
||||
stop_loading: function() {
|
||||
this.loading = false;
|
||||
this.$overlay.hide();
|
||||
|
||||
$('.list-ajax-loading').css('visibility', 'hidden');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
jQuery(document).ready(function(a){window.listTable={init:function(){this.loading=false;a("form").each(function(){this.reset()});if(""==a.query.GET("paged")){a.query.SET("paged",1)}this.set_total_pages();this.$tbody=a("#the-list, #the-comment-list");this.$overlay=a('<div id="loading-items">').html(listTableL10n.loading).hide().prependTo(a("body"))},set_total_pages:function(e){var d=a(".last-page").attr("href");if(d){this.total_pages=e||a.query.load(d).get("paged")}},get_total_pages:function(){return this.total_pages},htmlencode:function(d){return a("<div/>").text(d).html()},update_rows:function(e,d,h){if(this.loading){return false}var g=false,f={};a.each(e,function(i,j){if(j!=a.query.GET(i)){a.query.SET(i,j);g=true}});if(!g){return false}this.show_overlay();if(d){a.query.SET("paged",1)}a.each(a.query.get(),function(i,j){if(true===j){f[i]=""}else{f[i]=j}});this._callback=h;this.fetch_list(f,a.proxy(this,"handle_success"),a.proxy(this,"handle_error"));return true},fetch_list:function(e,f,d){e=a.extend(e,{action:"fetch-list",list_args:list_args});a.ajax({url:ajaxurl,global:false,dataType:"json",data:e,success:f,error:d})},handle_success:function(d){if("object"!=typeof d){this.handle_error()}else{this.hide_overlay();this.$tbody.html(d.rows);a(".displaying-num").html(d.total_items_i18n);a(".total-pages").html(d.total_pages_i18n);this.set_total_pages(d.total_pages);a(".current-page").val(a.query.GET("paged"));a("th.column-cb :input").attr("checked",false);if(history.replaceState){history.replaceState({},"",location.pathname+a.query)}if(this._callback){this._callback()}}},handle_error:function(){this.hide_overlay();a("h2").after('<div class="error ajax below-h2"><p>'+listTableL10n.error+"</p></div>")},show_overlay:function(){this.loading=true;a(".error.ajax").remove();this.$overlay.css({width:this.$tbody.width()+"px",height:this.$tbody.height()-20+"px"}).css(this.$tbody.offset()).show()},hide_overlay:function(){this.loading=false;this.$overlay.hide()}};listTable.init();function b(e,d){if(e<1){e=1}if(e>listTable.get_total_pages()){e=listTable.get_total_pages()}a(listTable).trigger("beforeChangePage");listTable.update_rows({paged:e},false,function(){if(d.parents(".tablenav.bottom").length){scrollTo(0,0)}a(listTable).trigger("changePage")})}a(".tablenav-pages a").click(function(){var e=a(this),d=a.query.GET("paged");switch(e.attr("class")){case"first-page":d=1;break;case"prev-page":d-=1;break;case"next-page":d+=1;break;case"last-page":d=listTable.get_total_pages();break}b(d,e);return false});a(".current-page").keypress(function(f){if(13!=f.keyCode){return}var d=a(this);b(parseInt(d.val())||1,d);return false});a("th.sortable a, th.sorted a").click(function(){function i(k){return a.query.load(k.find("a").attr("href")).get("order")}var f=a(this),h=f.parent("th"),g=h.index(),j=a.query.load(f.attr("href")).get("orderby"),e;h=h.closest("table").find("thead th:eq("+g+"), tfoot th:eq("+g+")");if(j==a.query.get("orderby")){e=("asc"==a.query.get("order"))?"desc":"asc"}else{e=i(h);var d=a("th.sorted");if(d.length){d.removeClass("sorted").addClass("sortable");d.removeClass("desc").removeClass("asc").addClass("asc"==i(d)?"desc":"asc")}h.removeClass("sortable").addClass("sorted")}h.removeClass("desc").removeClass("asc").addClass(e);listTable.update_rows({orderby:j,order:e},true);return false});function c(d){if("keypress"==d.type&&13!=d.keyCode){return}d.preventDefault();d.stopImmediatePropagation();var e=a(this).parent(".search-box").find(":input").serializeObject();listTable.update_rows(e,true,function(){if(a("h2.nav-tab-wrapper").length){return}if("site-users-network"==pagenow||"site-themes-network"==pagenow){a("h4.search-text").remove();if(e.s){a("ul.subsubsub").after(a('<h4 class="clear search-text">').html(listTableL10n.search.replace("%s",this.htmlencode(e.s))))}}else{a("h2 .subtitle").remove();if(e.s){a("h2").append(a('<span class="subtitle">').html(listTableL10n.search.replace("%s",this.htmlencode(e.s))))}}})}a(".search-box :submit").click(c);a(".search-box :text").keypress(c);a("#post-query-submit").click(function(){var d={};a(this).parents(".actions").find('select[name!="action"]').each(function(){var e=a(this);d[e.attr("name")]=e.val()});listTable.update_rows(d,true);return false});a(".view-switch a").click(function(){var d=a(this);listTable.update_rows({mode:a.query.load(d.attr("href")).get("mode")},false,function(){a(".view-switch .current").removeClass("current");d.addClass("current")});return false})});
|
||||
jQuery(document).ready(function(a){window.listTable={init:function(){this.loading=false;a("form").each(function(){this.reset()});if(""==a.query.GET("paged")){a.query.SET("paged",1)}this.set_total_pages();this.$tbody=a("#the-list, #the-comment-list")},set_total_pages:function(e){var d=a(".last-page").attr("href");if(d){this.total_pages=e||a.query.load(d).get("paged")}},get_total_pages:function(){return this.total_pages},htmlencode:function(d){return a("<div/>").text(d).html()},update_rows:function(e,d,h){if(this.loading){return false}var g=false,f={};a.each(e,function(i,j){if(j!=a.query.GET(i)){a.query.SET(i,j);g=true}});if(!g){return false}this.start_loading();if(d){a.query.SET("paged",1)}a.each(a.query.get(),function(i,j){if(true===j){f[i]=""}else{f[i]=j}});this._callback=h;this.fetch_list(f,a.proxy(this,"handle_success"),a.proxy(this,"handle_error"));return true},fetch_list:function(e,f,d){e=a.extend(e,{action:"fetch-list",list_args:list_args});a.ajax({url:ajaxurl,global:false,dataType:"json",data:e,success:f,error:d})},handle_success:function(d){if("object"!=typeof d){this.handle_error()}else{this.stop_loading();this.$tbody.html(d.rows);a(".displaying-num").html(d.total_items_i18n);a(".total-pages").html(d.total_pages_i18n);this.set_total_pages(d.total_pages);a(".current-page").val(a.query.GET("paged"));a("th.column-cb :input").attr("checked",false);if(history.replaceState){history.replaceState({},"",location.pathname+a.query)}if(this._callback){this._callback()}}},handle_error:function(){this.stop_loading();a("h2").after('<div class="error ajax below-h2"><p>'+listTableL10n.error+"</p></div>")},start_loading:function(){this.loading=true;a(".error.ajax").remove();a(".list-ajax-loading").css("visibility","visible")},stop_loading:function(){this.loading=false;a(".list-ajax-loading").css("visibility","hidden")}};listTable.init();function b(e,d){if(e<1){e=1}if(e>listTable.get_total_pages()){e=listTable.get_total_pages()}a(listTable).trigger("beforeChangePage");listTable.update_rows({paged:e},false,function(){if(d.parents(".tablenav.bottom").length){scrollTo(0,0)}a(listTable).trigger("changePage")})}a(".tablenav-pages a").click(function(){var e=a(this),d=a.query.GET("paged");switch(e.attr("class")){case"first-page":d=1;break;case"prev-page":d-=1;break;case"next-page":d+=1;break;case"last-page":d=listTable.get_total_pages();break}b(d,e);return false});a(".current-page").keypress(function(f){if(13!=f.keyCode){return}var d=a(this);b(parseInt(d.val())||1,d);return false});a("th.sortable a, th.sorted a").click(function(){function i(k){return a.query.load(k.find("a").attr("href")).get("order")}var f=a(this),h=f.parent("th"),g=h.index(),j=a.query.load(f.attr("href")).get("orderby"),e;h=h.closest("table").find("thead th:eq("+g+"), tfoot th:eq("+g+")");if(j==a.query.get("orderby")){e=("asc"==a.query.get("order"))?"desc":"asc"}else{e=i(h);var d=a("th.sorted");if(d.length){d.removeClass("sorted").addClass("sortable");d.removeClass("desc").removeClass("asc").addClass("asc"==i(d)?"desc":"asc")}h.removeClass("sortable").addClass("sorted")}h.removeClass("desc").removeClass("asc").addClass(e);listTable.update_rows({orderby:j,order:e},true);return false});function c(d){if("keypress"==d.type&&13!=d.keyCode){return}d.preventDefault();d.stopImmediatePropagation();var e=a(this).parent(".search-box").find(":input").serializeObject();listTable.update_rows(e,true,function(){if(a("h2.nav-tab-wrapper").length){return}if("site-users-network"==pagenow||"site-themes-network"==pagenow){a("h4.search-text").remove();if(e.s){a("ul.subsubsub").after(a('<h4 class="clear search-text">').html(listTableL10n.search.replace("%s",this.htmlencode(e.s))))}}else{a("h2 .subtitle").remove();if(e.s){a("h2").append(a('<span class="subtitle">').html(listTableL10n.search.replace("%s",this.htmlencode(e.s))))}}})}a(".search-box :submit").click(c);a(".search-box :text").keypress(c);a("#post-query-submit").click(function(){var d={};a(this).parents(".actions").find('select[name!="action"]').each(function(){var e=a(this);d[e.attr("name")]=e.val()});listTable.update_rows(d,true);return false});a(".view-switch a").click(function(){var d=a(this);listTable.update_rows({mode:a.query.load(d.attr("href")).get("mode")},false,function(){a(".view-switch .current").removeClass("current");d.addClass("current")});return false})});
|
@ -304,10 +304,9 @@ function wp_default_scripts( &$scripts ) {
|
||||
$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
|
||||
$scripts->add_data( 'admin-custom-fields', 'group', 1 );
|
||||
|
||||
$scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery-query', 'jquery-serialize-object' ), '20101220' );
|
||||
$scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery-query', 'jquery-serialize-object' ), '20101220b' );
|
||||
$scripts->add_data( 'list-table', 'group', 1 );
|
||||
$scripts->localize( 'list-table', 'listTableL10n', array(
|
||||
'loading' => __('Loading...'),
|
||||
'error' => __('An error has occurred while loading the items.'),
|
||||
'search' => __('Search results for “%s”'),
|
||||
'l10n_print_after' => 'try{convertEntities(listTableL10n);}catch(e){};'
|
||||
@ -485,7 +484,7 @@ function wp_default_styles( &$styles ) {
|
||||
// Any rtl stylesheets that don't have a .dev version for ltr
|
||||
$no_suffix = array( 'farbtastic' );
|
||||
|
||||
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20101220' );
|
||||
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20101220b' );
|
||||
|
||||
$styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20101102' );
|
||||
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
|
||||
|
Loading…
Reference in New Issue
Block a user