diff options
author | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-20 08:24:14 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-20 08:24:14 +0200 |
commit | cff951912734a5aeea0ebb3e4ca01f704004a466 (patch) | |
tree | 38e064b2551458052f7962efa615c2e4e0b4075c /app/assets/javascripts/commits.js | |
parent | 6d5c9698726e268a9cd392a5782c055031bb1bb9 (diff) | |
download | gitlab-ce-cff951912734a5aeea0ebb3e4ca01f704004a466.tar.gz |
Dashboard perfomance improved. Filter for projects page
Diffstat (limited to 'app/assets/javascripts/commits.js')
-rw-r--r-- | app/assets/javascripts/commits.js | 93 |
1 files changed, 45 insertions, 48 deletions
diff --git a/app/assets/javascripts/commits.js b/app/assets/javascripts/commits.js index 6e5b2102a68..bb06df55c6e 100644 --- a/app/assets/javascripts/commits.js +++ b/app/assets/javascripts/commits.js @@ -1,55 +1,52 @@ -$(document).ready(function(){ - $(".day-commits-table li.commit").live('click', function(e){ - if(e.target.nodeName != "A") { - location.href = $(this).attr("url"); - e.stopPropagation(); - return false; - } - }); -}); - var CommitsList = { + ref:null, + limit:0, + offset:0, -ref:null, -limit:0, -offset:0, - -init: - function(ref, limit) { - this.ref=ref; - this.limit=limit; - this.offset=limit; - this.initLoadMore(); - $('.loading').show(); - }, - -getOld: - function() { - $('.loading').show(); - $.ajax({ - type: "GET", - url: location.href, - data: "limit=" + this.limit + "&offset=" + this.offset + "&ref=" + this.ref, - complete: function(){ $('.loading').hide()}, - dataType: "script"}); - }, + init: + function(ref, limit) { + $(".day-commits-table li.commit").live('click', function(e){ + if(e.target.nodeName != "A") { + location.href = $(this).attr("url"); + e.stopPropagation(); + return false; + } + }); -append: - function(count, html) { - $("#commits_list").append(html); - if(count > 0) { - this.offset += count; + this.ref=ref; + this.limit=limit; + this.offset=limit; this.initLoadMore(); - } - }, + $('.loading').show(); + }, + + getOld: + function() { + $('.loading').show(); + $.ajax({ + type: "GET", + url: location.href, + data: "limit=" + this.limit + "&offset=" + this.offset + "&ref=" + this.ref, + complete: function(){ $('.loading').hide()}, + dataType: "script"}); + }, -initLoadMore: - function() { - $(window).bind('scroll', function(){ - if($(window).scrollTop() == $(document).height() - $(window).height()){ - $(window).unbind('scroll'); - CommitsList.getOld(); + append: + function(count, html) { + $("#commits_list").append(html); + if(count > 0) { + this.offset += count; + this.initLoadMore(); } - }); - } + }, + + initLoadMore: + function() { + $(window).bind('scroll', function(){ + if($(window).scrollTop() == $(document).height() - $(window).height()){ + $(window).unbind('scroll'); + CommitsList.getOld(); + } + }); + } } |