// 加载 modal
function load_modal(article_id, comment_id) {
    let modal_body = '#modal_body_' + comment_id;
    let modal_id = '#comment_' + comment_id;

    // 加载编辑器
    if ($(modal_body).children().length === 0) {
        let content = '<iframe src="/comment/post_comment/' +
            article_id +
            '/' +
            comment_id +
            '"' +
            ' frameborder="0" style="width: 100%; height: 100%;" id="iframe_' +
            comment_id +
            '"></iframe>';
        $(modal_body).append(content);
    }
    ;
    $(modal_id).modal('show');
}

$(".django-ckeditor-widget").removeAttr('style');
$('#sidebar').stickySidebar({
    topSpacing: 20,
    bottomSpacing: 20,
});

function confirm_delete() {
    layer.open({
        title: "删除文章",
        content: "确认删除这篇文章吗？",
        yes: function (index, layero) {
            $('form#safe_delete button').click();
            layer.close(index);
        },
    })
}

(function ($) {
    "use strict";

    if ($('.text-slider').length == 1) {
        console.log('233ok')
        var typed_strings = $('.text-slider-items').text();
        var typed = new Typed('.text-slider', {
            strings: typed_strings.split(','),
            typeSpeed: 80,
            loop: true,
            backDelay: 1100,
            backSpeed: 30
        });
    }

    function initParallax() {
        $('#masthead').parallax("100%", 0.3);
        $('#content').parallax("20%", 0.7);
    }

    initParallax();
})(jQuery);