diff --git a/kallithea/public/js/base.js b/kallithea/public/js/base.js --- a/kallithea/public/js/base.js +++ b/kallithea/public/js/base.js @@ -847,10 +847,9 @@ var renderInlineComments = function(file /** * Double link comments */ -var linkInlineComments = function(firstlinks, comments){ - var $comments = $(comments); +var linkInlineComments = function($firstlinks, $comments){ if ($comments.length > 0) { - $(firstlinks).html('First comment'.format($comments.attr('id'))); + $firstlinks.html('First comment'.format($comments.attr('id'))); } if ($comments.length <= 1) { return; @@ -859,12 +858,12 @@ var linkInlineComments = function(firstl $comments.each(function(i, e){ var prev = ''; if (i > 0){ - var prev_anchor = YUD.getAttribute(comments.item(i-1),'id'); + var prev_anchor = $($comments.get(i-1)).attr('id'); prev = 'Previous comment'.format(prev_anchor); } var next = ''; - if (i+1 < comments.length){ - var next_anchor = YUD.getAttribute(comments.item(i+1),'id'); + if (i+1 < $comments.length){ + var next_anchor = $($comments.get(i+1)).attr('id'); next = 'Next comment'.format(next_anchor); } var $div = $(('
'+ diff --git a/kallithea/templates/changeset/changeset.html b/kallithea/templates/changeset/changeset.html --- a/kallithea/templates/changeset/changeset.html +++ b/kallithea/templates/changeset/changeset.html @@ -205,7 +205,7 @@ ${self.repo_context_bar('changelog', c.c var file_comments = $('.inline-comment-placeholder').toArray(); renderInlineComments(file_comments); - linkInlineComments(document.getElementsByClassName('firstlink'), document.getElementsByClassName("comment")); + linkInlineComments($('.firstlink'), $('.comment')); pyroutes.register('changeset_home', "${h.url('changeset_home', repo_name='%(repo_name)s', revision='%(revision)s')}", diff --git a/kallithea/templates/pullrequests/pullrequest_show.html b/kallithea/templates/pullrequests/pullrequest_show.html --- a/kallithea/templates/pullrequests/pullrequest_show.html +++ b/kallithea/templates/pullrequests/pullrequest_show.html @@ -380,7 +380,7 @@ ${self.repo_context_bar('showpullrequest var file_comments = $('.inline-comment-placeholder').toArray(); renderInlineComments(file_comments); - linkInlineComments(document.getElementsByClassName('firstlink'), document.getElementsByClassName("comment")); + linkInlineComments($('.firstlink'), $('.comment')); $('#updaterevs input').change(function(e){ var update = !!e.target.value;