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

pager.js « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 769e8a62343af65fa6adc812f69a1c03f4cbe40c (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
var Pager = {
  limit:0,
  offset:0,
  disable:false,

  init:
    function(limit) {
      this.limit=limit;
      this.offset=limit;
      this.initLoadMore();
    },

  getOld:
    function() {
      $('.loading').show();
      $.ajax({
        type: "GET",
        url: location.href,
        data: "limit=" + this.limit + "&offset=" + this.offset,
        complete: function(){ $('.loading').hide()},
        dataType: "script"});
    },

  append:
    function(count, html) {
      $(".content_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 Pager.disable;
        },
        callback: function(i) {
          $('.loading').show();
          Pager.getOld();
        }
     });
    }
}