From e3126350ce2485effdf1fa097274e406be80d075 Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 21 Nov 2010 16:20:08 +0000 Subject: [PATCH] Don't display search subtitle on themes page. Props ocean90. See #14579 git-svn-id: http://svn.automattic.com/wordpress/trunk@16525 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/list-table.dev.js | 3 +++ wp-admin/js/list-table.js | 2 +- wp-includes/script-loader.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-admin/js/list-table.dev.js b/wp-admin/js/list-table.dev.js index ec07525f59..c8b5f13155 100644 --- a/wp-admin/js/list-table.dev.js +++ b/wp-admin/js/list-table.dev.js @@ -226,6 +226,9 @@ listTable.init(); var data = $(this).parent('.search-box').find(':input').serializeObject(); listTable.update_rows(data, true, function() { + if ( $('h2.nav-tab-wrapper').length ) + return; + $('h2 .subtitle').remove(); if ( data.s ) diff --git a/wp-admin/js/list-table.js b/wp-admin/js/list-table.js index 75b86c9645..4a6d9eb376 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)}a.each(a.query.get(),function(h,i){if(true===i){e[h]=""}else{e[h]=i}});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_i18n);a(".total-pages").html(c.total_pages_i18n);this.set_total_pages(c.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 +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)}a.each(a.query.get(),function(h,i){if(true===i){e[h]=""}else{e[h]=i}});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_i18n);a(".total-pages").html(c.total_pages_i18n);this.set_total_pages(c.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(){if(a("h2.nav-tab-wrapper").length){return}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 9e880c7ddd..e5e9ff14e7 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -379,7 +379,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' ), '20101117' ); + $scripts->add( 'list-table', "/wp-admin/js/list-table$suffix.js", array( 'jquery-query', 'jquery-serialize-object' ), '20101121' ); $scripts->add_data( 'list-table', 'group', 1 ); $scripts->localize( 'list-table', 'listTableL10n', array( 'loading' => __('Loading...'),