$('#sidebar').stickySidebar({
    topSpacing: 20,
    bottomSpacing: 20,
});
(function ($) {
    "use strict";
    let counter;
    counter = 10;
    let loading = true
    $(window).scroll(function () {
        if ($(window).scrollTop() + $(window).height() == $(document).height()) {
            function see_more() {
                if (loading) {
                    var csrftoken = $.cookie('csrftoken')
                    let info;
                    info = {
                        'counter': counter,
                        'csrfmiddlewaretoken': csrftoken,
                        'flag': 'articles',
                        'tag': tag,
                        'column': column,
                        'search': search,
                        'order': order
                    }
                    $.ajax({
                        type: "POST",
                        url: '../article_list_call/',
                        data: info,
                        datatype: 'json',
                        headers: {"X-CSRFToken": csrftoken},
                        success: function (data) {
                            counter = counter + 10;
                            if (data.indexOf('已经到底了') === -1) {
                                $("#articles_list").append(data);
                            } else {
                                loading = false;
                            }
                        }
                    })
                }

            }

            see_more();
        }
    })

})(jQuery);
