{"size": 1398, "ext": "js", "max_stars_repo_path": "resources/assets/js/app.js", "max_stars_repo_name": "danielkleach/blog", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "resources/assets/js/app.js", "max_issues_repo_name": "danielkleach/blog", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "resources/assets/js/app.js", "max_forks_repo_name": "danielkleach/blog", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 43.6875, "max_line_length": 132, "alphanum_fraction": 0.3633762518}
$(document).ready(function() {
    const win = $(window);
    let page = 2;

    win.scroll(function() {
        if ($(document).height() - win.height() == win.scrollTop()) {
            $.ajax({
                url: '/posts/?page=' + page,
                dataType: 'json',
                success: function(response) {
                    page += 1;
                    $.each(response.data, function(key, value) {
                        let date = moment(value.date).format("LL");
                        let post = `<div class="article-block">
                                    <span class="subject"><a href="/subjects/${value.subject.slug}">${value.subject.name}</a></span>
                                    <h2 class="title"><a href="/posts/${value.slug}">${value.title}</a></h2>
                                    <span class="date">${date}</span>
                                    <div class="content">
                                    <p>${value.content}</p>
                                    </div>
                                    <span class="read-more"><a href="/posts/${value.slug}">Read More</a></span>
                            </div>`;
                        $('main').append(post);
                    });
                },
                error: function(error) {
                    console.log(error);
                }
            });
        }
    });
});