diff -u b/comment_timer.install b/comment_timer.install --- b/comment_timer.install +++ b/comment_timer.install @@ -111,3 +111,3 @@ ); - db_add_field( 'comment_timer_comment', 'status', $status); + db_add_field('comment_timer_comment', 'status', $status); } diff -u b/comment_timer.module b/comment_timer.module --- b/comment_timer.module +++ b/comment_timer.module @@ -306,13 +306,13 @@ $field_info_extra_fields = field_info_extra_fields('comment', $comment->node_type, 'display'); if ($field_info_extra_fields['comment_time_inclusion']['display'][$real_view_mode]['visible']) { if (comment_access('edit', $comment)) { - drupal_add_js('misc/ajax.js'); $comment->content['links']['comment_timer'] = array( '#theme' => 'links', '#links' => array( 'comment-timer-inclusion' => comment_timer_status_link_array($comment), ), ); + $comment->content['#attached']['js'][] = 'misc/ajax.js'; } else { $markup = ''; @@ -374,20 +374,14 @@ comment_save($comment); if ($type == 'ajax') { $link = comment_timer_status_link_array($comment); - $node = node_load($comment->nid, NULL, TRUE); - $time = array( - '#theme' => 'comment_timer_hhmmss', - '#seconds' => isset($node->comment_timer) ? $node->comment_timer : 0, - '#label_display' => 'hidden', - ); $commands = array(); $commands[] = ajax_command_html('#comment-' . $comment->cid . '+div .comment-timer-inclusion', l($link['title'], $link['href'], array('attributes' => $link['attributes']))); - drupal_alter('comment_timer_commands', $commands, $time); + drupal_alter('comment_timer_commands', $commands, $comment); $page = array('#type' => 'ajax', '#commands' => $commands); ajax_deliver($page); } else { - drupal_goto('node/' . $comment->nid); + drupal_goto('node/' . $comment->nid . '#comment-' . $comment->cid); } } only in patch2: unchanged: --- /dev/null +++ b/comment_timer.api.php @@ -0,0 +1,28 @@ +nid, NULL, TRUE); + $time = array( + '#theme' => 'comment_timer_hhmmss', + '#seconds' => isset($node->comment_timer) ? $node->comment_timer : 0, + '#label_display' => 'hidden', + ); + $commands[] = ajax_command_html('.pane-node-comment-timer .pane-content', drupal_render($time)); +}