Welcome to mirror list, hosted at ThFree Co, Russian Federation.

commits.js « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b31fe485896865d09f0104af225fac248a144886 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var CommitsList = {
  ref:null,
  limit:0,
  offset:0,
  disable:false,

  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;
        }
      });

      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"});
    },

  append:
    function(count, html) {
      $("#commits_list").append(html);
      if(count > 0) {
        this.offset += count;
      } else { 
        this.disable = true;
      }
    },

  initLoadMore:
    function() {
      $(document).endlessScroll({
        bottomPixels: 400,
        fireDelay: 1000,
        fireOnce:true,
        ceaseFire: function() { 
          return CommitsList.disable;
        },
        callback: function(i) {
          CommitsList.getOld();
        }
      });
    }
}