<commit_before>(function($) {
    var loading = false;
    var opts = null;

    $.autopager = function(_opts) {
        var defaults = {
            content: $("#content"),
            link: $("link[rel=next]"),
            onStart: function() { },
            onComplete: function() { }
        };
        opts = $.extend({}, defaults, _opts);

        $(window).scroll(function() {
            if ((opts.content.offset().top + opts.content.height()) < ($(document).scrollTop() + $(window).height())) {
                if (loading || !opts.link) return;

                opts.onStart();
                loading = true;
                $.getJSON(opts.link.attr("href"), function(json, status) {
                    opts.content.append(json.html);
                    opts.link.attr("href", json.next_url);
                    loading = false;
                    opts.onComplete();
                });
            }
        });
    }
})($);
<commit_msg>fix autoloading: stop loading if next_url is null<commit_after>(function($) {
    var loading = false;
    var opts = null;

    $.autopager = function(_opts) {
        var defaults = {
            content: $("#content"),
            link: $("link[rel=next]"),
            onStart: function() { },
            onComplete: function() { }
        };
        opts = $.extend({}, defaults, _opts);

        $(window).scroll(function() {
            if ((opts.content.offset().top + opts.content.height()) < ($(document).scrollTop() + $(window).height())) {
                if (loading || !opts.link || !opts.link.attr("href")) return;

                opts.onStart();
                loading = true;
                $.getJSON(opts.link.attr("href"), function(json, status) {
                    opts.content.append(json.html);
                    opts.link.attr("href", json.next_url);
                    loading = false;
                    opts.onComplete();
                });
            }
        });
    }
})($);

{'fraction_non_alphanumeric': 0.16945712836123794, 'fraction_numerical': 0.0, 'mean_word_length': 1.5217391304347827, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7378080', 'n_tokens_mistral': 539, 'n_tokens_neox': 512, 'n_words': 98}