<commit_before>ext.modules.endless_scrolling = {
  name: 'endless_scrolling',
  dText: 'Endless scrolling',
  loaded: false,
  prepared: false,
  pages: [{
    path_name: '/|/index.php',
    options: {
      optName: 'main',
      loading: '#pager_index:last',
      loadingPosition: 'before',
      path: '/sphinx.php',
      domExtract: '#torrent_list tr:not(.head_torrent)',
      domInsertion: '#torrent_list',
      ignoreFirst: 10,
      pageModifier: -1
    }
  }, {
    path_name: '/sphinx.php',
    options: {
      optName: 'sphinx',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#torrent_list tr:not(.head_torrent)',
      domInsertion: '#torrent_list',
      pageModifier: -1
    }
  }, {
    path_name: '/forums.php',
    params: {
      action: 'viewforum'
    },
    options: {
      optName: 'viewforum',
      loading: '.thin table',
      loadingPosition: 'after',
      pagination: '.linkbox:not(:first)',
      domExtract: 'tbody tr:not(.colhead)',
      domInsertion: '.thin tr:last',
      domInsertionPosition: 'after',
      scrollOffset: 180,
      stopInsertBottomOffset: 100,
      notListeningToTrigger: true,
      endOfStream: 'No posts to display!'
    }
  }, {
    path_name: '/forums.php',
    params: {
      action: 'viewtopic'
    },
    options: {
      optName: 'viewtopic',
      loading: '.thin table:last',
      loadingPosition: 'after',
      pagination: '.linkbox',
      domExtract: '.thin table',
      domInsertion: '.thin table:last',
      domInsertionPosition: 'after',
      scrollOffset: 600,
      stopInsertBottomOffset: 100
    }
  }, {
    path_name: '/logs.php',
    options: {
      optName: 'logs',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: 'tbody tr:not(:first)',
      domInsertion: 'tbody',
      pageModifier: -1
    }
  }, {
    path_name: '/req.php',
    options: {
      optName: 'req',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#requests_list tbody tr:not(:first)',
      domInsertion: '#requests_list tbody',
      pageModifier: -1,
      notListeningToTrigger: true
    }
  }, {
    path_name: '/series.php',
    options: {
      optName: 'series',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#torrent_list tr:not(.head_torrent)',
      domInsertion: '#torrent_list tbody',
      pageModifier: -1
    }
  }, {
    path_name: '/my.php',
    params: {
      action: 'activity',
    },
    options: {
      optName: 'activity',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#table_snatchlist tbody tr:not(:first)',
      domInsertion: '#table_snatchlist tbody',
      pageModifier: -1
    }
  }, {
    path_name: '/dupe.php',
    options: {
      optName: 'dupe',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#dupe_list tbody tr:not(:first)',
      domInsertion: '#dupe_list tbody',
      pageModifier: -1,
      notListeningToTrigger: true
    }
  }],

  defaultScrollOffset: 200,
  backTopButtonOffset: 10,
  loadingPage: false,
  waitForInsert: false,
  lostPage: false,
  ignoreScrolling: false,
  stopEndlessScrolling: false,
  pauseEndlessScrolling: false,

  dbg: function() {
    utils.dbg(this.name, arguments);
  },

  prepare: function(mOptions) {
    var module = this;
    module.options = mOptions;
    module.prepared = true;

    module.pager = {
      firstPage: 1 + (module.options.pageModifier || 0),
      pages: []
    };
    module.pager.thisPage = ext.url.params && ext.url.params.page ?
      (ext.url.params.page == 'last' ? false : Number(ext.url.params.page)) : Number(module.pager.firstPage);
    module.pager.maxPage = module.options.pagination ? module.pager.thisPage : false;

    module.nextPage = module.pager.thisPage !== false ? module.pager.thisPage + 1 : false;
    module.previousLookedPage = module.pager.thisPage;
    module.insertedOffsets = {
      0: module.previousLookedPage
    };

    module.extractPagerAlignData();
  },

  loadModule: function() {
    var module = this;
    module.loaded = true;

    module.dbg('loadModule : url relative pages : [%d/%d]', module.pager.thisPage, module.pager.maxPage);
    module.rewritePagination(module.pager.thisPage);
    module.interceptPaginationClicks();

    $(document).scroll(function() {
      module.endlessScroll();
    });

    // Auto endless scrolling pause if any textarea has been focused - mostly forums usage
    $('textarea').focus(function() {
      if (!module.waitForInsert) {
        module.dbg('loadModule : Focused textarea - Pause endless scrolling');
        module.waitForInsert = true;
      }
    });

    $(document).on('click', 'a[onclick]', function() {
      var onClickFunction = $(this).attr('onclick');
      if ((onClickFunction.indexOf('Quote') != -1 || onClickFunction.indexOf('insertion') != -1) && $(
          'textarea').length) {
        module.waitForInsert = true;
      }
    });

    // Listen to after dom modifications by other modules
    $(document).on('es_dom_process_done', function() {
      module.rebuildInsertedOffsets();
      $(document).trigger('scroll');
    });

    module.dbg('loadModule : Ready');
  },
<commit_msg>document.body may not be available on first scroll<commit_after>ext.modules.endless_scrolling = {
  name: 'endless_scrolling',
  dText: 'Endless scrolling',
  loaded: false,
  prepared: false,
  pages: [{
    path_name: '/|/index.php',
    options: {
      optName: 'main',
      loading: '#pager_index:last',
      loadingPosition: 'before',
      path: '/sphinx.php',
      domExtract: '#torrent_list tr:not(.head_torrent)',
      domInsertion: '#torrent_list',
      ignoreFirst: 10,
      pageModifier: -1
    }
  }, {
    path_name: '/sphinx.php',
    options: {
      optName: 'sphinx',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#torrent_list tr:not(.head_torrent)',
      domInsertion: '#torrent_list',
      pageModifier: -1
    }
  }, {
    path_name: '/forums.php',
    params: {
      action: 'viewforum'
    },
    options: {
      optName: 'viewforum',
      loading: '.thin table',
      loadingPosition: 'after',
      pagination: '.linkbox:not(:first)',
      domExtract: 'tbody tr:not(.colhead)',
      domInsertion: '.thin tr:last',
      domInsertionPosition: 'after',
      scrollOffset: 180,
      stopInsertBottomOffset: 100,
      notListeningToTrigger: true,
      endOfStream: 'No posts to display!'
    }
  }, {
    path_name: '/forums.php',
    params: {
      action: 'viewtopic'
    },
    options: {
      optName: 'viewtopic',
      loading: '.thin table:last',
      loadingPosition: 'after',
      pagination: '.linkbox',
      domExtract: '.thin table',
      domInsertion: '.thin table:last',
      domInsertionPosition: 'after',
      scrollOffset: 600,
      stopInsertBottomOffset: 100
    }
  }, {
    path_name: '/logs.php',
    options: {
      optName: 'logs',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: 'tbody tr:not(:first)',
      domInsertion: 'tbody',
      pageModifier: -1
    }
  }, {
    path_name: '/req.php',
    options: {
      optName: 'req',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#requests_list tbody tr:not(:first)',
      domInsertion: '#requests_list tbody',
      pageModifier: -1,
      notListeningToTrigger: true
    }
  }, {
    path_name: '/series.php',
    options: {
      optName: 'series',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#torrent_list tr:not(.head_torrent)',
      domInsertion: '#torrent_list tbody',
      pageModifier: -1
    }
  }, {
    path_name: '/my.php',
    params: {
      action: 'activity',
    },
    options: {
      optName: 'activity',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#table_snatchlist tbody tr:not(:first)',
      domInsertion: '#table_snatchlist tbody',
      pageModifier: -1
    }
  }, {
    path_name: '/dupe.php',
    options: {
      optName: 'dupe',
      loading: '.pager_align:last',
      loadingPosition: 'before',
      pagination: '.pager_align',
      domExtract: '#dupe_list tbody tr:not(:first)',
      domInsertion: '#dupe_list tbody',
      pageModifier: -1,
      notListeningToTrigger: true
    }
  }],

  defaultScrollOffset: 200,
  backTopButtonOffset: 10,
  loadingPage: false,
  waitForInsert: false,
  lostPage: false,
  ignoreScrolling: false,
  stopEndlessScrolling: false,
  pauseEndlessScrolling: false,

  dbg: function() {
    utils.dbg(this.name, arguments);
  },

  prepare: function(mOptions) {
    var module = this;
    module.options = mOptions;
    module.prepared = true;

    module.pager = {
      firstPage: 1 + (module.options.pageModifier || 0),
      pages: []
    };
    module.pager.thisPage = ext.url.params && ext.url.params.page ?
      (ext.url.params.page == 'last' ? false : Number(ext.url.params.page)) : Number(module.pager.firstPage);
    module.pager.maxPage = module.options.pagination ? module.pager.thisPage : false;

    module.nextPage = module.pager.thisPage !== false ? module.pager.thisPage + 1 : false;
    module.previousLookedPage = module.pager.thisPage;
    module.insertedOffsets = {
      0: module.previousLookedPage
    };

    module.extractPagerAlignData();
  },

  loadModule: function() {
    var module = this;
    module.loaded = true;

    module.dbg('loadModule : url relative pages : [%d/%d]', module.pager.thisPage, module.pager.maxPage);
    module.rewritePagination(module.pager.thisPage);
    module.interceptPaginationClicks();

    $(document).ready(function() {
      $(document).scroll(function() {
        module.endlessScroll();
      });
    });

    // Auto endless scrolling pause if any textarea has been focused - mostly forums usage
    $('textarea').focus(function() {
      if (!module.waitForInsert) {
        module.dbg('loadModule : Focused textarea - Pause endless scrolling');
        module.waitForInsert = true;
      }
    });

    $(document).on('click', 'a[onclick]', function() {
      var onClickFunction = $(this).attr('onclick');
      if ((onClickFunction.indexOf('Quote') != -1 || onClickFunction.indexOf('insertion') != -1) && $(
          'textarea').length) {
        module.waitForInsert = true;
      }
    });

    // Listen to after dom modifications by other modules
    $(document).on('es_dom_process_done', function() {
      module.rebuildInsertedOffsets();
      $(document).trigger('scroll');
    });

    module.dbg('loadModule : Ready');
  },

{'fraction_non_alphanumeric': 0.1472127007035901, 'fraction_numerical': 0.005773047086415298, 'mean_word_length': 2.785250938886992, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1766355', 'n_tokens_mistral': 3619, 'n_tokens_neox': 3546, 'n_words': 694}