<commit_before>$(document).ready(function() {

    var $modals = $('.modal');
    var $addModal = $('.add-modal');
    var $editModal = $('.edit-modal');
    
    $('.btn-add').on('click', function(e) {
        e.preventDefault();
        populateModalForm($addModal, {
            title: 'Hinzufügen',
            closeLabel: 'Schließen',
            submitLabel: 'Hinzufügen',
        });
        $addModal.modal('show');
    });

    $('.btn-edit').on('click', function(e){
        e.preventDefault();
		var entry = $(this).attr('href');
		$.getJSON(entry, function(result) {
			if((!result.courseId)||(result.courseId && result.courseId.length<=2)){result.private = true;}
			populateModalForm($editModal, {
				action: entry,
				title: 'Bearbeiten',
				closeLabel: 'Schließen',
				submitLabel: 'Speichern',
				fields: result
			});
			$editModal.modal('show');
        });
    });

    $modals.find('.close, .btn-close').on('click', function() {
        $modals.modal('hide');
    });
    
    $.datetimepicker.setLocale('de');
    $('input[data-datetime]').datetimepicker({
        format:'d.m.Y H:i',
        mask: '39.19.9999 29:59',
        onShow:function( ct ,input){
            if(input[0].id == "availableDate"){
                console.log("availableDate");
                let due = $(input[0].parentNode.parentNode).find("#dueDate").val().split(" ");
                this.setOptions({
                    minDate:0,
                    maxDate:(due && due[0])?due[0]:false,
                    formatDate:'d.m.Y',
                });
            }
            else if(input[0].id == "dueDate"){
                console.log("dueDate");
                let available = $(input[0].parentNode.parentNode).find("#availableDate").val().split(" ");
                this.setOptions({
                    minDate:(available && available[0])?available[0]:0,
                    maxDate:false,
                    formatDate:'d.m.Y'
                });
            }
        }
    });


    function ajaxForm(element, after){
        const submitButton = element.find('[type=submit]')[0];
        let submitButtonText = submitButton.innerHTML || submitButton.value;
        submitButton.innerHTML = submitButtonText+' <div class="loadingspinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>';
        submitButton.disabled = true;
        const submitButtonStyleDisplay = submitButton.getAttribute("style");
        submitButton.style["display"]="inline-block";
        
        
        const url     = element.attr("action");
        const method  = element.attr("method");
        // update value of ckeditor instances
        ckeditorInstance = element.find('textarea.customckeditor').attr("id");
        if(ckeditorInstance) CKEDITOR.instances[ckeditorInstance].updateElement(); 
        const content = element.serialize();
        let request = $.ajax({<commit_msg>minTime & maxTime doesn't work for any reason<commit_after>$(document).ready(function() {

    var $modals = $('.modal');
    var $addModal = $('.add-modal');
    var $editModal = $('.edit-modal');
    
    $('.btn-add').on('click', function(e) {
        e.preventDefault();
        populateModalForm($addModal, {
            title: 'Hinzufügen',
            closeLabel: 'Schließen',
            submitLabel: 'Hinzufügen',
        });
        $addModal.modal('show');
    });

    $('.btn-edit').on('click', function(e){
        e.preventDefault();
		var entry = $(this).attr('href');
		$.getJSON(entry, function(result) {
			if((!result.courseId)||(result.courseId && result.courseId.length<=2)){result.private = true;}
			populateModalForm($editModal, {
				action: entry,
				title: 'Bearbeiten',
				closeLabel: 'Schließen',
				submitLabel: 'Speichern',
				fields: result
			});
			$editModal.modal('show');
        });
    });

    $modals.find('.close, .btn-close').on('click', function() {
        $modals.modal('hide');
    });
    
    $.datetimepicker.setLocale('de');
    $('input[data-datetime]').datetimepicker({
        format:'d.m.Y H:i',
        mask: '39.19.9999 29:59',
        onShow:function( ct ,input){
            if(input[0].id == "availableDate"){
                console.log("availableDate");
                let due = $(input[0].parentNode.parentNode).find("#dueDate").val().split(" ");
                this.setOptions({
                    minDate:0,
                    maxDate:(due && due[0])?due[0]:false,
                    formatDate:'d.m.Y',
                });
            }
            else if(input[0].id == "dueDate"){
                let available = $(input[0].parentNode.parentNode).find("#availableDate").val().split(" ");
                this.setOptions({
                    minDate:(available && available[0])?available[0]:0,
                    maxDate:false,
                    formatDate:'d.m.Y'
                });
            }
        },
        onSelectDate:function( ct ,input){
            if(input[0].id == "dueDate"){
                let available = $(input[0].parentNode.parentNode).find("#availableDate").val().split(" ");
                this.setOptions({
                    minTime:(available && input.val().split(" ")[0] == available[0])?available[1]:false
                });
            }else if(input[0].id == "availableDate"){
                let dueDate = $(input[0].parentNode.parentNode).find("#dueDate").val().split(" ");
                this.setOptions({
                    maxTime:(dueDate && input.val().split(" ")[0] == dueDate[0])?dueDate[1]:false
                });
            }
        }
    });


    function ajaxForm(element, after){
        const submitButton = element.find('[type=submit]')[0];
        let submitButtonText = submitButton.innerHTML || submitButton.value;
        submitButton.innerHTML = submitButtonText+' <div class="loadingspinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>';
        submitButton.disabled = true;
        const submitButtonStyleDisplay = submitButton.getAttribute("style");
        submitButton.style["display"]="inline-block";
        
        
        const url     = element.attr("action");
        const method  = element.attr("method");
        // update value of ckeditor instances
        ckeditorInstance = element.find('textarea.customckeditor').attr("id");
        if(ckeditorInstance) CKEDITOR.instances[ckeditorInstance].updateElement(); 
        const content = element.serialize();
        let request = $.ajax({
{'fraction_non_alphanumeric': 0.17617295308187672, 'fraction_numerical': 0.009812940815700706, 'mean_word_length': 2.2101377952755907, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, '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': '1849903', 'n_tokens_mistral': 1949, 'n_tokens_neox': 1825, 'n_words': 278}