Permalink
Browse files

Fade the audit log in and out. Set a timeout for showing and hiding t…

…he audit log, so we don't rely entirely on the imprecise movements of the mouse

Closes #1
  • Loading branch information...
1 parent 4402492 commit c1b88f1b02f510e0c9cc1e43042b3a067f74c645 @danielbachhuber danielbachhuber committed Jun 26, 2012
Showing with 21 additions and 11 deletions.
  1. +21 −11 p2-resolved-posts.php
View
@@ -190,19 +190,19 @@ function p2_action_links() {
$text = __( 'Flag Unresolved', 'p2-resolve' );
}
- echo ' | <a title="' . esc_attr( $title ) . '" href="' . esc_url( $link ) . '" class="' . implode( ' ', $css ) . '">' . esc_html( $text ) . '</a>';
+ $output = ' | <span class="p2-resolve-wrap"><a title="' . esc_attr( $title ) . '" href="' . esc_url( $link ) . '" class="' . implode( ' ', $css ) . '">' . esc_html( $text ) . '</a>';
// Hide our audit log output here too
$audit_logs = get_post_meta( get_the_id(), self::audit_log_key );
$audit_logs = array_reverse( $audit_logs, true );
- $audit_log_output = '<ul class="p2-resolved-posts-audit-log">';
+ $output .= '<ul class="p2-resolved-posts-audit-log">';
foreach( $audit_logs as $audit_log ) {
- $audit_log_output .= $this->single_audit_log_output( $audit_log );
+ $output .= $this->single_audit_log_output( $audit_log );
}
- $audit_log_output .= '</ul>';
- echo $audit_log_output;
+ $output .= '</ul></span>';
+ echo $output;
}
/**
@@ -315,20 +315,30 @@ function action_wp_head_ajax() {
jQuery(document).ready(function(){
+ var p2_resolved_hover_in = null;
+ var p2_resolved_hover_out = null;
+
// Display the most recent audit log for each post
jQuery('#main #postlist li.post .p2-resolved-posts-audit-log').each( function() {
jQuery('li', this).last().show();
});
- jQuery('.actions .p2-resolve-link').hover(
+ jQuery('.actions .p2-resolve-wrap').hover(
function(){
- var audit_log = jQuery(this).closest('.post').find('.p2-resolved-posts-audit-log');
- if ( audit_log.find('li').length )
- audit_log.show();
+ clearTimeout( p2_resolved_hover_out );
+ var audit_log = jQuery(this).find('.p2-resolved-posts-audit-log');
+ if ( audit_log.find('li').length ) {
+ p2_resolved_hover_in = setTimeout( function() {
+ audit_log.fadeIn();
+ }, 1250 );
+ }
},
function(){
- var audit_log = jQuery(this).closest('.post').find('.p2-resolved-posts-audit-log');
- audit_log.hide();
+ clearTimeout( p2_resolved_hover_in );
+ var audit_log = jQuery(this).find('.p2-resolved-posts-audit-log');
+ p2_resolved_hover_out = setTimeout( function() {
+ audit_log.fadeOut();
+ }, 500 );
}
);

0 comments on commit c1b88f1

Please sign in to comment.