<commit_before>var levelID;

function csrfSafeMethod(method) {
    // these HTTP methods do not require CSRF protection
    return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}

var CONFIRMATION_DATA = {
    'deleteLevel': {
        options: {
            title: 'Delete level',
        },
        html: "<p>This student's level will be permanently deleted. Are you sure?</p>",
        confirm: function() {
            var csrftoken = $.cookie('csrftoken');
            $.ajax({
                url : '/rapidrouter/level_moderation/delete/' + levelID,
                type : 'POST',
                dataType: 'json',
                beforeSend: function(xhr, settings) {
                    if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
                        xhr.setRequestHeader("X-CSRFToken", csrftoken);
                    }
                },
                success: function(json) {
                    if(json.success) {
                        document.forms["levelModerationForm"].submit();
                    }
                    else {
                        console.error("Failed to delete student level.");
                    }
                },
                error : function(xhr,errmsg,err) {
                    console.error(xhr.status + ": " + errmsg + " " + err + " " + xhr.responseText);
                }
            });
        },
    }
};

$(document).ready(function() {
	$(".delete").click(function() {
        
	  	levelID = this.getAttribute('value');
	  	openConfirmationBox('deleteLevel');
	});

	$('.play').click(function() {
		window.location.href = '/rapidrouter/' + this.getAttribute('value');
	});
});<commit_msg>Fixed custom level link in level moderation<commit_after>var levelID;

function csrfSafeMethod(method) {
    // these HTTP methods do not require CSRF protection
    return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}

var CONFIRMATION_DATA = {
    'deleteLevel': {
        options: {
            title: 'Delete level',
        },
        html: "<p>This student's level will be permanently deleted. Are you sure?</p>",
        confirm: function() {
            var csrftoken = $.cookie('csrftoken');
            $.ajax({
                url : '/rapidrouter/level_moderation/delete/' + levelID,
                type : 'POST',
                dataType: 'json',
                beforeSend: function(xhr, settings) {
                    if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
                        xhr.setRequestHeader("X-CSRFToken", csrftoken);
                    }
                },
                success: function(json) {
                    if(json.success) {
                        document.forms["levelModerationForm"].submit();
                    }
                    else {
                        console.error("Failed to delete student level.");
                    }
                },
                error : function(xhr,errmsg,err) {
                    console.error(xhr.status + ": " + errmsg + " " + err + " " + xhr.responseText);
                }
            });
        },
    }
};

$(document).ready(function() {
	$(".delete").click(function() {
        
	  	levelID = this.getAttribute('value');
	  	openConfirmationBox('deleteLevel');
	});

	$('.play').click(function() {
		window.location.href = '/rapidrouter/custom/' + this.getAttribute('value');
	});
});
{'fraction_non_alphanumeric': 0.141757916543356, 'fraction_numerical': 0.0, 'mean_word_length': 1.576219512195122, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, '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': '3505439', 'n_tokens_mistral': 942, 'n_tokens_neox': 896, 'n_words': 162}