changeset 5153:abad971d21d1

comments: more jQuery
author Mads Kiilerich <madski@unity3d.com>
date Sun, 17 May 2015 21:41:40 +0200
parents f2d811756977
children f9a581561184
files kallithea/public/js/base.js kallithea/templates/changeset/changeset.html kallithea/templates/pullrequests/pullrequest_show.html
diffstat 3 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/public/js/base.js	Sun May 17 21:37:46 2015 +0200
+++ b/kallithea/public/js/base.js	Sun May 17 21:41:40 2015 +0200
@@ -847,10 +847,9 @@
 /**
  * Double link comments
  */
-var linkInlineComments = function(firstlinks, comments){
-    var $comments = $(comments);
+var linkInlineComments = function($firstlinks, $comments){
     if ($comments.length > 0) {
-        $(firstlinks).html('<a href="#{0}">First comment</a>'.format($comments.attr('id')));
+        $firstlinks.html('<a href="#{0}">First comment</a>'.format($comments.attr('id')));
     }
     if ($comments.length <= 1) {
         return;
@@ -859,12 +858,12 @@
     $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 = '<a href="#{0}">Previous comment</a>'.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 = '<a href="#{0}">Next comment</a>'.format(next_anchor);
             }
             var $div = $(('<div class="prev-next-comment">'+
--- a/kallithea/templates/changeset/changeset.html	Sun May 17 21:37:46 2015 +0200
+++ b/kallithea/templates/changeset/changeset.html	Sun May 17 21:41:40 2015 +0200
@@ -205,7 +205,7 @@
           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')}",
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Sun May 17 21:37:46 2015 +0200
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Sun May 17 21:41:40 2015 +0200
@@ -380,7 +380,7 @@
           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;