(() => {
  const Pager = {
    init(limit, preload, disable, callback) {
      this.limit = limit != null ? limit : 0;
      this.disable = disable != null ? disable : false;
      this.callback = callback != null ? callback : $.noop;
      this.loading = $('.loading').first();
      if (preload) {
        this.offset = 0;
        this.getOld();
      } else {
        this.offset = this.limit;
      }
      this.initLoadMore();
    },
    getOld() {
      this.loading.show();
      $.ajax({
        type: 'GET',
        url: $('.content_list').data('href') || window.location.href,
        data: `limit=${this.limit}&offset=${this.offset}`,
        complete: () => this.loading.hide(),
        success: (data) => {
          Pager.append(data.count, data.html);
          Pager.callback();
        },
        dataType: 'json',
      });
    },
    append(count, html) {
      $('.content_list').append(html);
      if (count > 0) {
        this.offset += count;
      } else {
        this.disable = true;
      }
    },
    initLoadMore() {
      $(document).unbind('scroll');
      $(document).endlessScroll({
        bottomPixels: 400,
        fireDelay: 1000,
        fireOnce: true,
        ceaseFire: () => Pager.disable !== true,
        callback: () => {
          if (!this.loading.is(':visible')) {
            this.loading.show();
            Pager.getOld();
          }
        },
      });
    },
  };

  window.Pager = Pager;
})();

@@ -34,16 +34,20 @@
 it(limit
+ = 0
 , preloa
@@ -47,16 +47,24 @@
  preload
+ = false
 , disabl
@@ -64,16 +64,24 @@
  disable
+ = false
 , callba
@@ -82,16 +82,25 @@
 callback
+ = $.noop
 ) %7B%0A    
@@ -123,28 +123,8 @@
 imit
- != null ? limit : 0
 ;%0A  
@@ -153,34 +153,8 @@
 able
- != null ? disable : false
 ;%0A  
@@ -185,36 +185,8 @@
 back
- != null ? callback : $.noop
 ;%0A  
@@ -383,24 +383,25 @@
 e();%0A    %7D,%0A
+%0A
     getOld()
@@ -794,24 +794,25 @@
  %7D);%0A    %7D,%0A
+%0A
     append(c
@@ -969,23 +969,24 @@
       %7D%0A
-
     %7D,%0A
+%0A
     init

use param defaults and add spacing for readability