<commit_before>(function ($) {
    'use strict';

    var defaults = {
        // Twitter-style pagination container selector.
        containerSelector: '.endless_container',
        // Twitter-style pagination loading selector.
        loadingSelector: '.endless_loading',
        // Twitter-style pagination link selector.
        moreSelector: 'a.endless_more',
        // Digg-style pagination page template selector.
        pageSelector: '.endless_page_template',
        // Digg-style pagination link selector.
        pagesSelector: 'a.endless_page_link',
        // The page wrapper
        pageContainer: 'table tbody',
        // Callback called when the user clicks to get another page.
        onClick: function() {},
        // Callback called when the data fetch begins
        onBefore: function() {},
        // Callback called when the new page is correctly displayed.
        onCompleted: function() {},
        // Callback calledn when a sorting is completed
        onSort: undefined,
        // Set this to true to use the paginate-on-scroll feature.
        paginateOnScroll: false,
        // If paginate-on-scroll is on, this margin will be used.
        paginateOnScrollMargin : 1,
        // If paginate-on-scroll is on, it is possible to define chunks.
        paginateOnScrollChunkSize: 0,
        // End Point to fetch data
        endPoint: location.pathname,
        // Form to get filters from
        formSelector: null,
        // Custom filters that can be passed
        customFilters: {},
        // Enable sorting
        enableSorting: true,
        // Sorter 
        sorterTriggerSelector: 'table th',
        // Column to sort by
        sortColumn: {},
        // CSS class to header when sorting ASC
        cssSortingClassAsc: 'headerSortUp',
        // CSS class to header when sorting DESC
        cssSortingClassDesc: 'headerSortDown',
        // Selector to Search Field
        searchField: null,
        // Save the initial context
        initialContext: {},
        // Initial amount of loaded pages
        loadedPages: 1,
        // To clear all on reload
        clearAllOnReload: true,
    };

    var settings = null;
    var toLoad = false;

    var methods = {
        init : function(options) {

            settings = $.extend(defaults, options);

            var getContext = function( link ) {
                return settings.initialContext = {
                    key: link.attr('rel').split(' ')[0],
                    url: link.attr('href')
                };
            };

            return this.each(function() 
            {
                var element = $(this);

                // Configure to check if there is form to filter
                methods.configFormFilter( element );
                // Configure sorting feature
                methods.configSorting( element );
                // Configure search field
                methods.configSearchField( element );

                // Twitter-style pagination.
                element.on( 'click', settings.moreSelector, function() {

                    if ( toLoad ) return false;

                    toLoad = true;

                    var link = $(this),
                        html_link = link.get(0),
                        container = link.closest(settings.containerSelector),
                        loading = container.find(settings.loadingSelector);

                    // Avoid multiple Ajax calls.
                    if ( loading.is(':visible') ) {
                        return false;
                    }

                    link.hide();
                    loading.show();

                    var context = getContext( link );

                    // Fire onClick callback.
                    if ( settings.onClick.apply( html_link, [context] ) !== false ) {

                        var params = {
                            url: context.url,
                            data: methods.getData(),
                            complete: function( fragment )
                            {
                                container.before( fragment );
                                container.remove();
                                
                                // Increase the number of loaded pages.
                                settings.loadedPages += 1;

                                // Fire onCompleted callback.
                                settings.onCompleted.apply( html_link, [context, fragment] );

                                toLoad = false;
                            }
                        };

                        methods.fetchPage( params );
                    }

                    return false;
                });

                // On scroll pagination.
                if ( settings.paginateOnScroll ) {

                    var win = $(window),
                        doc = $(document);

                    win.scroll(
                        function()
                        {
                            if ( doc.height() - win.height() -
                                win.scrollTop() <= settings.paginateOnScrollMargin )
                                 {

                                    // Do not paginate on scroll if chunks are used and
                                    // the current chunk is complete.
                                    var chunckSize = settings.paginateOnScrollChunkSize;

                                    if ( !chunckSize || settings.loadedPages % chunckSize ) {
                                        element.find( settings.moreSelector ).click();
                                    }
                            }
                        }
                    );
                }
<commit_msg>drop jquery 3.0 deprecation warnings<commit_after>(function ($) {
    'use strict';

    var defaults = {
        // Twitter-style pagination container selector.
        containerSelector: '.endless_container',
        // Twitter-style pagination loading selector.
        loadingSelector: '.endless_loading',
        // Twitter-style pagination link selector.
        moreSelector: 'a.endless_more',
        // Digg-style pagination page template selector.
        pageSelector: '.endless_page_template',
        // Digg-style pagination link selector.
        pagesSelector: 'a.endless_page_link',
        // The page wrapper
        pageContainer: 'table tbody',
        // Callback called when the user clicks to get another page.
        onClick: function() {},
        // Callback called when the data fetch begins
        onBefore: function() {},
        // Callback called when the new page is correctly displayed.
        onCompleted: function() {},
        // Callback calledn when a sorting is completed
        onSort: undefined,
        // Set this to true to use the paginate-on-scroll feature.
        paginateOnScroll: false,
        // If paginate-on-scroll is on, this margin will be used.
        paginateOnScrollMargin : 1,
        // If paginate-on-scroll is on, it is possible to define chunks.
        paginateOnScrollChunkSize: 0,
        // End Point to fetch data
        endPoint: location.pathname,
        // Form to get filters from
        formSelector: null,
        // Custom filters that can be passed
        customFilters: {},
        // Enable sorting
        enableSorting: true,
        // Sorter 
        sorterTriggerSelector: 'table th',
        // Column to sort by
        sortColumn: {},
        // CSS class to header when sorting ASC
        cssSortingClassAsc: 'headerSortUp',
        // CSS class to header when sorting DESC
        cssSortingClassDesc: 'headerSortDown',
        // Selector to Search Field
        searchField: null,
        // Save the initial context
        initialContext: {},
        // Initial amount of loaded pages
        loadedPages: 1,
        // To clear all on reload
        clearAllOnReload: true,
    };

    var settings = null;
    var toLoad = false;

    var methods = {
        init : function(options) {

            settings = $.extend(defaults, options);

            var getContext = function( link ) {
                return settings.initialContext = {
                    key: link.attr('rel').split(' ')[0],
                    url: link.attr('href')
                };
            };

            return this.each(function() 
            {
                var element = $(this);

                // Configure to check if there is form to filter
                methods.configFormFilter( element );
                // Configure sorting feature
                methods.configSorting( element );
                // Configure search field
                methods.configSearchField( element );

                // Twitter-style pagination.
                element.on( 'click', settings.moreSelector, function() {

                    if ( toLoad ) return false;

                    toLoad = true;

                    var link = $(this),
                        html_link = link.get(0),
                        container = link.closest(settings.containerSelector),
                        loading = container.find(settings.loadingSelector);

                    // Avoid multiple Ajax calls.
                    if ( loading.is(':visible') ) {
                        return false;
                    }

                    link.hide();
                    loading.show();

                    var context = getContext( link );

                    // Fire onClick callback.
                    if ( settings.onClick.apply( html_link, [context] ) !== false ) {

                        var params = {
                            url: context.url,
                            data: methods.getData(),
                            complete: function( fragment )
                            {
                                container.before( fragment );
                                container.remove();
                                
                                // Increase the number of loaded pages.
                                settings.loadedPages += 1;

                                // Fire onCompleted callback.
                                settings.onCompleted.apply( html_link, [context, fragment] );

                                toLoad = false;
                            }
                        };

                        methods.fetchPage( params );
                    }

                    return false;
                });

                // On scroll pagination.
                if ( settings.paginateOnScroll ) {

                    var win = $(window),
                        doc = $(document);

                    win.on('scroll', function()
                        {
                            if ( doc.height() - win.height() -
                                win.scrollTop() <= settings.paginateOnScrollMargin )
                                 {

                                    // Do not paginate on scroll if chunks are used and
                                    // the current chunk is complete.
                                    var chunckSize = settings.paginateOnScrollChunkSize;

                                    if ( !chunckSize || settings.loadedPages % chunckSize ) {
                                        element.find( settings.moreSelector ).trigger('click');
                                    }
                            }
                        }
                    );
                }

{'fraction_non_alphanumeric': 0.0809379070777247, 'fraction_numerical': 0.0012158054711246201, 'mean_word_length': 1.097632058287796, 'pattern_counts': {'":': 0, '<': 5, '<?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': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1116793', 'n_tokens_mistral': 2594, 'n_tokens_neox': 2403, 'n_words': 728}