From ca4f75d494463bb3dd5bb2efb867486fc71de207 Mon Sep 17 00:00:00 2001 From: scribu Date: Fri, 5 Nov 2010 23:07:00 +0000 Subject: [PATCH] Uncheck mass select checkbox when updating rows via ajax. See #14579 git-svn-id: http://svn.automattic.com/wordpress/trunk@16218 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/list-table.dev.js | 2 ++ wp-admin/js/list-table.js | 2 +- wp-includes/script-loader.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-admin/js/list-table.dev.js b/wp-admin/js/list-table.dev.js index 25eeacabbe..f7bd06afcf 100644 --- a/wp-admin/js/list-table.dev.js +++ b/wp-admin/js/list-table.dev.js @@ -106,6 +106,8 @@ window.listTable = { $('.current-page').val($.query.GET('paged')); + $('th.column-cb :input').attr('checked', false); + if ( this._callback ) this._callback(); } diff --git a/wp-admin/js/list-table.js b/wp-admin/js/list-table.js index 404257e126..046be58302 100644 --- a/wp-admin/js/list-table.js +++ b/wp-admin/js/list-table.js @@ -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('
this.total_pages){return false}this.update_rows({paged:c})},htmlencode:function(c){return a("
").text(c).html()},update_rows:function(d,c,g){if(this.loading){return false}var f=false,e;a.each(d,function(h,i){if(i!=a.query.GET(h)){a.query.SET(h,i);f=true}});if(!f){return false}this.show_overlay();if(c){a.query.SET("paged",1)}e=a.query.get();this._callback=g;this.fetch_list(e,a.proxy(this,"handle_success"),a.proxy(this,"handle_error"));return true},fetch_list:function(d,e,c){d=a.extend(d,{action:"fetch-list",list_args:list_args});a.ajax({url:ajaxurl,global:false,dataType:"json",data:d,success:e,error:c})},handle_success:function(c){if("object"!=typeof c){this.handle_error()}else{this.hide_overlay();this.$tbody.html(c.rows);a(".displaying-num").html(c.total_items);a(".total-pages").html(c.total_pages);this.set_total_pages();a(".current-page").val(a.query.GET("paged"));if(this._callback){this._callback()}}},handle_error:function(){this.hide_overlay();a("h2").after('

'+listTableL10n.error+"

")},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();a(".tablenav-pages a").click(function(){var c=a.query.GET("paged");switch(a(this).attr("class")){case"first-page":c=1;break;case"prev-page":c-=1;break;case"next-page":c+=1;break;case"last-page":c=listTable.get_total_pages();break}listTable.change_page(c);return false});a(".current-page").keypress(function(c){if(13!=c.keyCode){return}listTable.change_page(parseInt(a(this).val()));return false});a("th a").click(function(){var e=a.query.GET("orderby"),c=a.query.GET("order"),d=a(this).parent("th");if(d.hasClass("sortable")){e=a.query.load(a(this).attr("href")).get("orderby");c="asc";a("th.sorted-desc, th.sorted-asc").removeClass("sorted-asc").removeClass("sorted-desc").addClass("sortable");d.removeClass("sortable").addClass("sorted-asc")}else{if(d.hasClass("sorted-asc")){c="desc";d.removeClass("sorted-asc").addClass("sorted-desc")}else{if(d.hasClass("sorted-desc")){c="asc";d.removeClass("sorted-desc").addClass("sorted-asc")}}}listTable.update_rows({orderby:e,order:c},true);return false});function b(c){if("keypress"==c.type&&13!=c.keyCode){return}c.preventDefault();c.stopImmediatePropagation();var d=a(this).parent(".search-box").find(":input").serializeObject();listTable.update_rows(d,true,function(){a("h2 .subtitle").remove();if(d.s){a("h2").append(a('').html(listTableL10n.search.replace("%s",this.htmlencode(d.s))))}})}a(".search-box :submit").click(b);a(".search-box :text").keypress(b);a("#post-query-submit").click(function(){var c={};a(this).parents(".actions").find('select[name!="action"]').each(function(){var d=a(this);c[d.attr("name")]=d.val()});listTable.update_rows(c,true);return false});a(".view-switch a").click(function(){var c=a(this);listTable.update_rows({mode:a.query.load(c.attr("href")).get("mode")},false,function(){a(".view-switch .current").removeClass("current");c.addClass("current")});return false})}); \ No newline at end of file +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('
this.total_pages){return false}this.update_rows({paged:c})},htmlencode:function(c){return a("
").text(c).html()},update_rows:function(d,c,g){if(this.loading){return false}var f=false,e;a.each(d,function(h,i){if(i!=a.query.GET(h)){a.query.SET(h,i);f=true}});if(!f){return false}this.show_overlay();if(c){a.query.SET("paged",1)}e=a.query.get();this._callback=g;this.fetch_list(e,a.proxy(this,"handle_success"),a.proxy(this,"handle_error"));return true},fetch_list:function(d,e,c){d=a.extend(d,{action:"fetch-list",list_args:list_args});a.ajax({url:ajaxurl,global:false,dataType:"json",data:d,success:e,error:c})},handle_success:function(c){if("object"!=typeof c){this.handle_error()}else{this.hide_overlay();this.$tbody.html(c.rows);a(".displaying-num").html(c.total_items);a(".total-pages").html(c.total_pages);this.set_total_pages();a(".current-page").val(a.query.GET("paged"));a("th.column-cb :input").attr("checked",false);if(this._callback){this._callback()}}},handle_error:function(){this.hide_overlay();a("h2").after('

'+listTableL10n.error+"

")},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();a(".tablenav-pages a").click(function(){var c=a.query.GET("paged");switch(a(this).attr("class")){case"first-page":c=1;break;case"prev-page":c-=1;break;case"next-page":c+=1;break;case"last-page":c=listTable.get_total_pages();break}listTable.change_page(c);return false});a(".current-page").keypress(function(c){if(13!=c.keyCode){return}listTable.change_page(parseInt(a(this).val()));return false});a("th a").click(function(){var e=a.query.GET("orderby"),c=a.query.GET("order"),d=a(this).parent("th");if(d.hasClass("sortable")){e=a.query.load(a(this).attr("href")).get("orderby");c="asc";a("th.sorted-desc, th.sorted-asc").removeClass("sorted-asc").removeClass("sorted-desc").addClass("sortable");d.removeClass("sortable").addClass("sorted-asc")}else{if(d.hasClass("sorted-asc")){c="desc";d.removeClass("sorted-asc").addClass("sorted-desc")}else{if(d.hasClass("sorted-desc")){c="asc";d.removeClass("sorted-desc").addClass("sorted-asc")}}}listTable.update_rows({orderby:e,order:c},true);return false});function b(c){if("keypress"==c.type&&13!=c.keyCode){return}c.preventDefault();c.stopImmediatePropagation();var d=a(this).parent(".search-box").find(":input").serializeObject();listTable.update_rows(d,true,function(){a("h2 .subtitle").remove();if(d.s){a("h2").append(a('').html(listTableL10n.search.replace("%s",this.htmlencode(d.s))))}})}a(".search-box :submit").click(b);a(".search-box :text").keypress(b);a("#post-query-submit").click(function(){var c={};a(this).parents(".actions").find('select[name!="action"]').each(function(){var d=a(this);c[d.attr("name")]=d.val()});listTable.update_rows(c,true);return false});a(".view-switch a").click(function(){var c=a(this);listTable.update_rows({mode:a.query.load(c.attr("href")).get("mode")},false,function(){a(".view-switch .current").removeClass("current");c.addClass("current")});return false})}); \ No newline at end of file diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index d7060e5fb5..7f4f396381 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -364,7 +364,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20100407' ); $scripts->add_data( 'theme-preview', 'group', 1 ); - $scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery-query', 'jquery-serialize-object' ), '20101027' ); + $scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery-query', 'jquery-serialize-object' ), '20101106' ); $scripts->add_data( 'list-table', 'group', 1 ); $scripts->localize( 'list-table', 'listTableL10n', array( 'loading' => __('Loading...'),