Unify comment display. Props mdawaffe. fixes #6025
git-svn-id: http://svn.automattic.com/wordpress/trunk@7082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c313442072
commit
51a3623aed
|
@ -354,8 +354,10 @@ case 'add-comment' :
|
|||
die('-1');
|
||||
$search = isset($_POST['s']) ? $_POST['s'] : false;
|
||||
$start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24;
|
||||
$status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false;
|
||||
$mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail';
|
||||
|
||||
list($comments, $total) = _wp_get_comment_list( $search, $start, 1 );
|
||||
list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1 );
|
||||
|
||||
if ( !$comments )
|
||||
die('1');
|
||||
|
@ -363,7 +365,7 @@ case 'add-comment' :
|
|||
foreach ( (array) $comments as $comment ) {
|
||||
get_comment( $comment );
|
||||
ob_start();
|
||||
_wp_comment_list_item( $comment->comment_ID );
|
||||
_wp_comment_row( $comment->comment_ID, $mode );
|
||||
$comment_list_item = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$x->add( array(
|
||||
|
|
|
@ -51,6 +51,12 @@ if ( isset($_GET['comment_status']) )
|
|||
$comment_status = attribute_escape($_GET['comment_status']);
|
||||
else
|
||||
$comment_status = '';
|
||||
|
||||
if ( isset($_GET['s']) )
|
||||
$search_dirty = $_GET['s'];
|
||||
else
|
||||
$search_dirty = '';
|
||||
$search = attribute_escape( $search );
|
||||
?>
|
||||
<?php
|
||||
if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) {
|
||||
|
@ -105,12 +111,13 @@ unset($status_links);
|
|||
</ul>
|
||||
|
||||
<p id="post-search">
|
||||
<input type="text" id="post-search-input" name="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" />
|
||||
<input type="text" id="post-search-input" name="s" value="<?php echo $search; ?>" />
|
||||
<input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" />
|
||||
</p>
|
||||
|
||||
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
|
||||
<input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
|
||||
</form>
|
||||
|
||||
<ul class="view-switch">
|
||||
<li <?php if ( 'detail' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'detail', $_SERVER['REQUEST_URI'])) ?>"><?php _e('Detail View') ?></a></li>
|
||||
|
@ -126,7 +133,7 @@ else
|
|||
|
||||
$start = $offset = ( $page - 1 ) * 20;
|
||||
|
||||
list($_comments, $total) = _wp_get_comment_list( $comment_status, isset($_GET['s']) ? $_GET['s'] : false, $start, 25 ); // Grab a few extra
|
||||
list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, 25 ); // Grab a few extra
|
||||
|
||||
$comments = array_slice($_comments, 0, 20);
|
||||
$extra_comments = array_slice($_comments, 20);
|
||||
|
@ -140,6 +147,8 @@ $page_links = paginate_links( array(
|
|||
|
||||
?>
|
||||
|
||||
<form id="comments-form" action="" method="post">
|
||||
|
||||
<div class="tablenav">
|
||||
|
||||
<?php
|
||||
|
@ -175,64 +184,28 @@ if ($comments) {
|
|||
</thead>
|
||||
<tbody id="the-comment-list" class="list:comment">
|
||||
<?php
|
||||
foreach ($comments as $comment) {
|
||||
$post = get_post($comment->comment_post_ID);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
$the_comment_status = wp_get_comment_status($comment->comment_ID);
|
||||
$class = ('unapproved' == $the_comment_status) ? 'unapproved' : '';
|
||||
$post_link = '<a href="' . get_comment_link() . '">' . get_the_title($comment->comment_post_ID) . '</a>';
|
||||
$author_url = get_comment_author_url();
|
||||
if ( 'http://' == $author_url )
|
||||
$author_url = '';
|
||||
$author_url_display = $author_url;
|
||||
if ( strlen($author_url_display) > 50 )
|
||||
$author_url_display = substr($author_url_display, 0, 49) . '...';
|
||||
$ptime = get_post_time('G', true);
|
||||
if ( ( abs(time() - $ptime) ) < 86400 )
|
||||
$ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) );
|
||||
else
|
||||
$ptime = mysql2date(__('Y/m/d \a\t g:i A'), $post->post_date);
|
||||
|
||||
$delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
|
||||
$approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
|
||||
$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
|
||||
|
||||
foreach ($comments as $comment)
|
||||
_wp_comment_row( $comment->comment_ID, $mode );
|
||||
?>
|
||||
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
|
||||
<td style="text-align: center;"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
|
||||
<td class="comment">
|
||||
<p class="comment-author"><strong><a class="row-title" href="comment.php?action=editcomment&c=<?php echo $comment->comment_ID?>"><?php comment_author(); ?></a></strong><br />
|
||||
<?php if ( !empty($author_url) ) : ?>
|
||||
<a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a> |
|
||||
<?php endif; ?>
|
||||
<?php if ( !empty($comment->comment_author_email) ): ?>
|
||||
<?php comment_author_email_link() ?> |
|
||||
<?php endif; ?>
|
||||
<a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=detail"><?php comment_author_IP() ?></a>
|
||||
</p>
|
||||
<p><?php if ( 'list' == $mode ) comment_excerpt(); else comment_text(); ?></p>
|
||||
<p><?php printf(__('From %1$s, %2$s'), $post_link, $ptime) ?></p>
|
||||
</td>
|
||||
<td><?php comment_date(__('Y/m/d')); ?></td>
|
||||
<td>
|
||||
<?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
if ( 'approved' != $the_comment_status ) {
|
||||
if ( $comment_status ) // we're looking at list of only approved or only unapproved comments
|
||||
echo "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:33FF33:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
|
||||
else // we're looking at all comments
|
||||
echo "<span class='approve'><a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:none:33FF33' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | </span>';
|
||||
}
|
||||
echo "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
|
||||
echo "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end foreach
|
||||
?></tbody>
|
||||
</tbody>
|
||||
<tbody id="the-extra-comment-list" class="list:comment" style="display: none;">
|
||||
<?php
|
||||
foreach ($extra_comments as $comment)
|
||||
_wp_comment_row( $comment->comment_ID, $mode );
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<form id="get-extra-comments" method="post" action="" class="add:the-extra-comment-list:" style="display: none;">
|
||||
<input type="hidden" name="s" value="<?php echo $search; ?>" />
|
||||
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
|
||||
<input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
|
||||
<input type="hidden" name="page" value="<?php echo isset($_REQUEST['page']) ? absint( $_REQUEST['page'] ) : 1; ?>" />
|
||||
<?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
|
||||
</form>
|
||||
|
||||
<div id="ajax-response"></div>
|
||||
<?php
|
||||
} else {
|
||||
|
@ -251,4 +224,6 @@ if ( $page_links )
|
|||
<br style="clear:both;" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
|
|
|
@ -164,26 +164,41 @@ if ($posts) {
|
|||
</div>
|
||||
|
||||
<?php
|
||||
if ( 1 == count($posts) && isset( $_GET['page_id'] ) ) {
|
||||
|
||||
if ( 1 == count($posts) && isset( $_GET['page_id'] ) ) :
|
||||
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
|
||||
if ($comments) {
|
||||
if ( $comments ) :
|
||||
// Make sure comments, post, and post_author are cached
|
||||
update_comment_cache($comments);
|
||||
$post = get_post($id);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
?>
|
||||
<h3 id="comments"><?php _e('Comments') ?></h3>
|
||||
<ol id="the-comment-list" class="list:comment commentlist">
|
||||
|
||||
<br class="clear" />
|
||||
|
||||
<table class="widefat" style="margin-top: .5em">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e('Comment') ?></th>
|
||||
<th scope="col"><?php _e('Date') ?></th>
|
||||
<th scope="col"><?php _e('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-comment-list" class="list:comment">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ( $comments as $comment ) {
|
||||
_wp_comment_list_item( $comment->comment_ID, ++$i );
|
||||
}
|
||||
echo '</ol>';
|
||||
} // end if comments
|
||||
foreach ($comments as $comment)
|
||||
_wp_comment_row( $comment->comment_ID, 'detail', false );
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
||||
endif; // comments
|
||||
endif; // posts;
|
||||
|
||||
?>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -184,31 +184,46 @@ foreach ($arc_result as $arc_row) {
|
|||
if ( $page_links )
|
||||
echo "<div class='tablenav-pages'>$page_links</div>";
|
||||
?>
|
||||
<br style="clear:both;" />
|
||||
<br class="clear" />
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
if ( 1 == count($posts) && isset( $_GET['p'] ) ) {
|
||||
if ( 1 == count($posts) && isset( $_GET['p'] ) ) :
|
||||
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
|
||||
if ($comments) {
|
||||
if ( $comments ) :
|
||||
// Make sure comments, post, and post_author are cached
|
||||
update_comment_cache($comments);
|
||||
$post = get_post($id);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
?>
|
||||
<h3 id="comments"><?php _e('Comments') ?></h3>
|
||||
<ol id="the-comment-list" class="list:comment commentlist">
|
||||
|
||||
<br class="clear" />
|
||||
|
||||
<table class="widefat" style="margin-top: .5em">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e('Comment') ?></th>
|
||||
<th scope="col"><?php _e('Date') ?></th>
|
||||
<th scope="col"><?php _e('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="the-comment-list" class="list:comment">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ( $comments as $comment ) {
|
||||
_wp_comment_list_item( $comment->comment_ID, ++$i );
|
||||
}
|
||||
echo '</ol>';
|
||||
} // end if comments
|
||||
foreach ($comments as $comment)
|
||||
_wp_comment_row( $comment->comment_ID, 'detail', false );
|
||||
?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
||||
endif; // comments
|
||||
endif; // posts;
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
|
|
|
@ -592,49 +592,64 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
|
|||
return array($comments, $total);
|
||||
}
|
||||
|
||||
function _wp_comment_list_item( $id, $alt = 0 ) {
|
||||
global $authordata, $comment;
|
||||
$comment =& get_comment( $id );
|
||||
$id = (int) $comment->comment_ID;
|
||||
$class = '';
|
||||
function _wp_comment_row( $comment_id, $mode, $checkbox = true ) {
|
||||
global $comment, $post;
|
||||
$comment = get_comment( $comment_id );
|
||||
$post = get_post($comment->comment_post_ID);
|
||||
$authordata = get_userdata($post->post_author);
|
||||
$comment_status = wp_get_comment_status($id);
|
||||
if ( 'unapproved' == $comment_status )
|
||||
$class .= ' unapproved';
|
||||
if ( $alt % 2 )
|
||||
$class .= ' alternate';
|
||||
echo "<li id='comment-$id' class='$class'>";
|
||||
$the_comment_status = wp_get_comment_status($comment->comment_ID);
|
||||
$class = ('unapproved' == $the_comment_status) ? 'unapproved' : '';
|
||||
$post_link = '<a href="' . get_comment_link() . '">' . get_the_title($comment->comment_post_ID) . '</a>';
|
||||
$author_url = get_comment_author_url();
|
||||
if ( 'http://' == $author_url )
|
||||
$author_url = '';
|
||||
$author_url_display = $author_url;
|
||||
if ( strlen($author_url_display) > 50 )
|
||||
$author_url_display = substr($author_url_display, 0, 49) . '...';
|
||||
$ptime = get_post_time('G', true);
|
||||
if ( ( abs(time() - $ptime) ) < 86400 )
|
||||
$ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) );
|
||||
else
|
||||
$ptime = mysql2date(__('Y/m/d \a\t g:i A'), $post->post_date);
|
||||
|
||||
$delete_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
|
||||
$approve_url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
|
||||
$spam_url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
|
||||
|
||||
?>
|
||||
<p><strong class="comment-author"><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
|
||||
|
||||
<?php comment_text() ?>
|
||||
|
||||
<p><?php comment_date(__('M j, g:i A')); ?> — [
|
||||
<?php
|
||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
echo " <a href='comment.php?action=editcomment&c=$id'>" . __('Edit') . '</a>';
|
||||
$url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) );
|
||||
echo " | <a href='$url' class='delete:the-comment-list:comment-$id'>" . __('Delete') . '</a> ';
|
||||
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
|
||||
$url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$id", "unapprove-comment_$id" ) );
|
||||
echo "<span class='unapprove'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:FFFF33'>" . __('Unapprove') . '</a> </span>';
|
||||
$url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$id", "approve-comment_$id" ) );
|
||||
echo "<span class='approve'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:33FF33:33FF33'>" . __('Approve') . '</a> </span>';
|
||||
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
|
||||
<?php if ( $checkbox ) : ?>
|
||||
<td style="text-align: center;"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="comment">
|
||||
<p class="comment-author"><strong><a class="row-title" href="comment.php?action=editcomment&c=<?php echo $comment->comment_ID?>"><?php comment_author(); ?></a></strong><br />
|
||||
<?php if ( !empty($author_url) ) : ?>
|
||||
<a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a> |
|
||||
<?php endif; ?>
|
||||
<?php if ( !empty($comment->comment_author_email) ): ?>
|
||||
<?php comment_author_email_link() ?> |
|
||||
<?php endif; ?>
|
||||
<a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=detail"><?php comment_author_IP() ?></a>
|
||||
</p>
|
||||
<p><?php if ( 'list' == $mode ) comment_excerpt(); else comment_text(); ?></p>
|
||||
<p><?php printf(__('From %1$s, %2$s'), $post_link, $ptime) ?></p>
|
||||
</td>
|
||||
<td><?php comment_date(__('Y/m/d')); ?></td>
|
||||
<td>
|
||||
<?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
if ( 'approved' != $the_comment_status ) {
|
||||
if ( $comment_status ) // we're looking at list of only approved or only unapproved comments
|
||||
echo "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:33FF33:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
|
||||
else // we're looking at all comments
|
||||
echo "<span class='approve'><a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:none:33FF33' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | </span>';
|
||||
}
|
||||
$url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) );
|
||||
echo " | <a href='$url' class='delete:the-comment-list:comment-$id::spam=1'>" . __('Spam') . '</a> ';
|
||||
}
|
||||
if ( !is_single() ) {
|
||||
$post = get_post($comment->comment_post_ID, OBJECT, 'display');
|
||||
$post_title = wp_specialchars( $post->post_title, 'double' );
|
||||
$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
|
||||
?>
|
||||
] — <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a>
|
||||
<?php } ?>
|
||||
</p>
|
||||
</li>
|
||||
<?php
|
||||
echo "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
|
||||
echo "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var list; var extra;
|
||||
var theList; var theExtraList;
|
||||
jQuery(function($) {
|
||||
|
||||
var dimAfter = function( r, settings ) {
|
||||
|
@ -24,15 +24,15 @@ var delAfter = function( r, settings ) {
|
|||
}
|
||||
});
|
||||
|
||||
if ( extra.size() == 0 || extra.children().size() == 0 ) {
|
||||
if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
list[0].wpList.add( extra.children(':eq(0)').remove().clone() );
|
||||
theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
|
||||
$('#get-extra-comments').submit();
|
||||
}
|
||||
|
||||
extra = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
|
||||
list = $('#the-comment-list').wpList( { dimAfter : dimAfter, delAfter : delAfter, addColor: 'none' } );
|
||||
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
|
||||
theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
|
||||
|
||||
} );
|
||||
|
|
|
@ -62,7 +62,12 @@ var wpList = {
|
|||
},
|
||||
|
||||
parseClass: function(e,t) {
|
||||
var c = []; try { c = $(e).attr('class').match(new RegExp(t+':[A-Za-z0-9:_=-]+'))[0].split(':'); } catch(r) {}
|
||||
var c = [], cl;
|
||||
try {
|
||||
cl = $(e).attr('class') || '';
|
||||
cl = cl.match(new RegExp(t+':[A-Za-z0-9:_=-]+'));
|
||||
if ( cl ) { c = cl[0].split(':'); }
|
||||
} catch(r) {}
|
||||
return c;
|
||||
},
|
||||
|
||||
|
@ -87,11 +92,12 @@ var wpList = {
|
|||
ajaxAdd: function( e, s ) {
|
||||
var list = this; e = $(e); s = s || {};
|
||||
var cls = wpList.parseClass(e,'add');
|
||||
s = $.extend(s, {
|
||||
element: s.element || cls[2] || e.attr( 'id' ) || null,
|
||||
addColor: s.addColor || '#' + ( cls[3] || 'FFFF33' )
|
||||
} );
|
||||
s = wpList.pre.call( list, e, s, 'add' );
|
||||
|
||||
s.element = cls[2] || e.attr( 'id' ) || s.element || null;
|
||||
if ( cls[3] ) { s.addColor = '#' + cls[3]; }
|
||||
else { s.addColor = s.addColor || '#FFFF33'; }
|
||||
|
||||
if ( !s ) { return false; }
|
||||
|
||||
if ( !e.is("[class^=add:" + list.id + ":]") ) { return !wpList.add.call( list, e, s ); }
|
||||
|
@ -150,11 +156,12 @@ var wpList = {
|
|||
ajaxDel: function( e, s ) {
|
||||
var list = this; e = $(e); s = s || {};
|
||||
var cls = wpList.parseClass(e,'delete');
|
||||
s = $.extend(s, {
|
||||
element: s.element || cls[2] || null,
|
||||
delColor: s.delColor || '#' + ( cls[3] || 'FF3333' )
|
||||
} );
|
||||
s = wpList.pre.call( list, e, s, 'delete' );
|
||||
|
||||
s.element = cls[2] || s.element || null;
|
||||
if ( cls[3] ) { s.delColor = '#' + cls[3]; }
|
||||
else { s.delColor = s.delColor || '#FF3333'; }
|
||||
|
||||
if ( !s || !s.element ) { return false; }
|
||||
|
||||
s.action = 'delete-' + s.what;
|
||||
|
@ -208,13 +215,15 @@ var wpList = {
|
|||
ajaxDim: function( e, s ) {
|
||||
var list = this; e = $(e); s = s || {};
|
||||
var cls = wpList.parseClass(e,'dim');
|
||||
s = $.extend(s, {
|
||||
element: s.element || cls[2] || null,
|
||||
dimClass: s.dimClass || cls[3] || null,
|
||||
dimAddColor: s.dimAddColor || '#' + ( cls[4] || 'FFFF33' ),
|
||||
dimDelColor: s.dimDelColor || '#' + ( cls[5] || 'FF3333' )
|
||||
} );
|
||||
s = wpList.pre.call( list, e, s, 'dim' );
|
||||
|
||||
s.element = cls[2] || s.element || null;
|
||||
s.dimClass = cls[3] || s.dimClass || null;
|
||||
if ( cls[4] ) { s.dimAddColor = '#' + cls[4]; }
|
||||
else { s.dimAddColor = s.dimAddColor || '#FFFF33'; }
|
||||
if ( cls[5] ) { s.dimDelColor = '#' + cls[5]; }
|
||||
else { s.dimDelColor = s.dimDelColor || '#FF3333'; }
|
||||
|
||||
if ( !s || !s.element || !s.dimClass ) { return true; }
|
||||
|
||||
s.action = 'dim-' + s.what;
|
||||
|
@ -280,7 +289,7 @@ var wpList = {
|
|||
},
|
||||
|
||||
add: function( e, s ) {
|
||||
list = $(this);
|
||||
var list = $(this);
|
||||
e = $(e);
|
||||
|
||||
var old = false;
|
||||
|
|
|
@ -61,7 +61,7 @@ class WP_Scripts {
|
|||
'whoaText' => __("Slow down, I'm still sending your data!")
|
||||
) );
|
||||
|
||||
$this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('jquery'), '20080226' );
|
||||
$this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('jquery'), '20080228' );
|
||||
$this->localize( 'wp-lists', 'wpListL10n', array(
|
||||
'url' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php'
|
||||
) );
|
||||
|
@ -125,7 +125,7 @@ class WP_Scripts {
|
|||
'good' => __('Good'),
|
||||
'strong' => __('Strong')
|
||||
) );
|
||||
$this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080227' );
|
||||
$this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080228' );
|
||||
$this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' );
|
||||
$this->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080108' );
|
||||
$this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
|
||||
|
|
Loading…
Reference in New Issue