From a5fc5dcbf48e8e5a027d81af766b567a9c744bf7 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 27 Feb 2008 00:46:27 +0000 Subject: [PATCH] Don't load wp-lists on pages that don't need it. Props mdawaffe. fixes #6011 git-svn-id: https://develop.svn.wordpress.org/trunk@7057 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/edit-comments.php | 3 +-- wp-admin/edit-pages.php | 3 +-- wp-admin/edit-post-rows.php | 6 ++---- wp-admin/edit.php | 7 ------- wp-admin/includes/template.php | 15 ++------------- wp-admin/js/edit-posts.js | 22 ---------------------- wp-admin/js/users.js | 23 +---------------------- wp-admin/link-manager.php | 3 +-- wp-admin/upload.php | 5 ----- wp-admin/users.php | 16 +++++++--------- wp-includes/script-loader.php | 3 +-- 11 files changed, 16 insertions(+), 90 deletions(-) diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index c814a591cf..c9296f42a3 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -179,8 +179,7 @@ if ($comments) { $post = get_post($comment->comment_post_ID); $authordata = get_userdata($post->post_author); $the_comment_status = wp_get_comment_status($comment->comment_ID); - $class = ('alternate' == $class) ? '' : ''; - $class .= ('unapproved' == $the_comment_status) ? ' unapproved' : ''; + $class = ('unapproved' == $the_comment_status) ? 'unapproved' : ''; $post_link = '' . get_the_title($comment->comment_post_ID) . ''; $author_url = get_comment_author_url(); if ( 'http://' == $author_url ) diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index 0d6cef77d8..015795a33b 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -33,7 +33,6 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) { $title = __('Pages'); $parent_file = 'edit.php'; -wp_enqueue_script( 'wp-lists' ); wp_enqueue_script('admin-forms'); require_once('admin-header.php'); @@ -139,7 +138,7 @@ if ($posts) { - + diff --git a/wp-admin/edit-post-rows.php b/wp-admin/edit-post-rows.php index 46a14752b5..6f0fbe6a53 100644 --- a/wp-admin/edit-post-rows.php +++ b/wp-admin/edit-post-rows.php @@ -10,15 +10,13 @@ - + \n\t\n"; // Hack! $class = ( $i_post > 15 || 'alternate' == $class) ? '' : 'alternate'; global $current_user; $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); @@ -165,7 +163,7 @@ foreach($posts_columns as $column_name=>$column_display_name) { case 'control_delete': ?> - ID) ) { echo "ID) . "' class='delete:the-list:post-$post->ID delete'>" . __('Delete') . ""; } ?> + ID) ) { echo "ID) . "' class='delete'>" . __('Delete') . ""; } ?> max_num_pages = ceil( $wp_query->found_posts / 15 ); // We grab 20 but only show 15 ( 5 more for ajax extra ) if ( !isset( $_GET['paged'] ) ) $_GET['paged'] = 1; @@ -179,10 +176,6 @@ foreach ($arc_result as $arc_row) { - -
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index d2cb49e64a..d5aa9df7ac 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -263,20 +263,9 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) { // convert it to table rows $out = ''; $class = ''; - $i = 0; $count = 0; - foreach( $tags as $tag ) { - if( $i ) { - $i = 0; - $class = ' class="alternate"'; - } else { - $i = 1; - $class = ''; - } - - $out .= _tag_row( $tag, $class ); - $count++; - } + foreach( $tags as $tag ) + $out .= _tag_row( $tag, ++$count % 2 ? ' class="alternate"' : '' ); // filter and send to screen $out = apply_filters('tag_rows', $out); diff --git a/wp-admin/js/edit-posts.js b/wp-admin/js/edit-posts.js index 5241c4c5ff..e69de29bb2 100644 --- a/wp-admin/js/edit-posts.js +++ b/wp-admin/js/edit-posts.js @@ -1,22 +0,0 @@ -jQuery(function($) { -var delAfter; var extra; var list; - -if ( document.location.href.match(/(\?|&)c=/) ) - delAfter = function() { $('#comments, #the-comment-list').remove(); } -else - delAfter = function() { - list[0].wpList.add( extra.children(':eq(0)').remove().clone() ); - $('#get-extra-posts').submit(); - } - -var addBefore = function ( settings ) { - var q = document.location.href.split('?'); - if ( q[1] ) - settings.data += '&' + q[1]; - return settings; -} - -extra = $('#the-extra-list').wpList( { alt: '', addBefore: addBefore, addColor: 'none', delColor: 'none' } ); -list = $('#the-list').wpList( { delAfter: delAfter, addColor: 'none' } ); - -} ); diff --git a/wp-admin/js/users.js b/wp-admin/js/users.js index 5b89d0fe20..522cbadf6d 100644 --- a/wp-admin/js/users.js +++ b/wp-admin/js/users.js @@ -1,22 +1 @@ -jQuery( function($) { - var userLists; var list; var addBefore; var addAfter; - - addBefore = function( s ) { - if ( $( '#role-' + $('#role').val() ).size() ) - return s; - return false; - }; - - addAfter = function( r, s ) { - var roleTable = $( '#role-' + $('role', r).text() ); - - var e = $('#user-' + $('user', r).attr('id') ); - if ( !roleTable.size() ) { return; } - if ( !e.size() ) { return; } - - roleTable[0].wpList.add(e.remove().clone()); - }; - - userLists = $('.user-list').wpList(); - list = $('#user-list').wpList( { addBefore: addBefore, addAfter: addAfter } ); -} ); +jQuery( function($) { $('#users').wpList(); } ); diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index 88c543b56e..671ad5c9c7 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -24,7 +24,6 @@ if ( isset($_GET['deleteit']) && isset($_GET['linkcheck']) ) { exit; } -wp_enqueue_script( 'wp-lists' ); wp_enqueue_script('admin-forms'); wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]')); @@ -150,7 +149,7 @@ if ( $links ) { } ?> - + - -
diff --git a/wp-admin/users.php b/wp-admin/users.php index cbf6ec8a4c..0841c41997 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -264,14 +264,17 @@ foreach ( (array) $users_of_blog as $b_user ) { } unset($users_of_blog); +$current_role = false; foreach ( $wp_roles->get_names() as $role => $name ) { if ( !isset($avail_roles[$role]) ) continue; $class = ''; - if ( $role == $_GET['role'] ) + if ( $role == $_GET['role'] ) { + $current_role = $_GET['role']; $class = ' class="current"'; + } $name = translate_with_context($name); $name = sprintf(_c('%1$s (%2$s)|user role with count'), $name, $avail_roles[$role]); @@ -339,12 +342,12 @@ unset($role_links); get_results() as $userid ) { $user_object = new WP_User($userid); $roles = $user_object->roles; $role = array_shift($roles); - $style = ''; $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; echo "\n\t" . user_row($user_object, $style, $role); } @@ -399,7 +402,7 @@ foreach ( $wp_user_search->get_results() as $userid ) { else echo '

' . sprintf(__('Users cannot currently register themselves, but you can manually create users here.'), get_option('siteurl').'/wp-admin/options-general.php#users_can_register') . '

'; ?> -
+ @@ -437,7 +440,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
@@ -450,11 +453,6 @@ foreach ( $wp_user_search->get_results() as $userid ) {

- - - -
- __('Strong') ) ); $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20071104' ); - $this->add( 'admin-posts', '/wp-admin/js/edit-posts.js', array('wp-lists'), '20071023' ); $this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' ); - $this->add( 'admin-forms', '/wp-admin/js/forms.js', array('wp-lists'), '20080108' ); + $this->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080108' ); $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' ); $this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' ); $this->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery'), '20080128' );