Sha256: 4fe9e018fbe9596c578fb29752c1f75c20139dd6f49d01d17a714532ce433a46

Contents?: true

Size: 820 Bytes

Versions: 3

Compression:

Stored size: 820 Bytes

Contents

var commontatorOldCommentIds = $("#commontator-comment-<%=
  @comment.id
%>-children").children().map(function() {
  return '#' + $(this).attr('id');
}).toArray().join(',');

<%=
  render partial: 'show', locals: {
    user: @commontator_user,
    thread: @commontator_thread,
    comment: @comment,
    page: @commontator_page,
    show_all: @commontator_show_all
  }
%>

var commontatorOldComments = $(commontatorOldCommentIds);
var commontatorNewComments = $("#commontator-comment-<%=
  @comment.id
%>-children").children().not(commontatorOldComments);

commontatorNewComments.hide().fadeIn();

if (commontatorOldComments.length > 0) {
  commontatorOldComments[commontatorOldComments.length - 1].scrollIntoView();
} else {
  $("#commontator-comment-<%= @comment.id %>")[0].scrollIntoView();
}

<%= javascript_proc %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
commontator-6.0.1 app/views/commontator/comments/show.js.erb
commontator-6.0.0 app/views/commontator/comments/show.js.erb
commontator-6.0.0.pre.2 app/views/commontator/comments/show.js.erb