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: f34f198d85043e4f901adb86bb46b132d6c8111c (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
var Pager = {
  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,
        complete: function(){ $('.loading').hide()},
        dataType: "script"});
    },

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