$(document).on('turbolinks:load', function() {
    if ($('.weapp-banner-setting-container').length > 0) {
        var $form = $('#course_form');

        $('.course.banner-item-bottom').on("change", 'input[type="file"]', function() {
            var $fileInput = $(this);
            var file = this.files[0];
            var imageType = /image.*/;
            if (file && file.type.match(imageType)) {
                $form.ajaxSubmit()
            }
        });

        var $shixunform = $('#shixun_form');

        $('.shixun.banner-item-bottom').on("change", 'input[type="file"]', function() {
            var $fileInput = $(this);
            var file = this.files[0];
            var imageType = /image.*/;
            if (file && file.type.match(imageType)) {
                $shixunform.ajaxSubmit()
            }
        });
    }
})