<commit_before>function cancelBrandName() {
	$(".addNewbrandName").hide();
	$(".inBrandName").val("");
}

function cancelCarType() {
	$(".addNewCarType").hide();
	$(".inCarTypeName").val("");
}

function addCarType() {
	$(".addNewCarType").show();
}

function addBrand() {
	$(".addNewbrandName").show();
}

function addNewbrandName() {
	// 把参数提交给Action
	var location = (window.location+'').split('/');
	var basePath = location[0]+'//'+location[2]+'/'+location[3]; 
	
	$.ajax({
		url: "CarInfoServlet",
		type: 'GET',
		data: {
			opr: "addBrandName",
			brandName: $(".inBrandName").val()
		},
		dataType: 'json',
		success: function(data) {
			if (data == 'false') {
				$(".inBrandName").val("");
				alert("输入了重复的车辆品牌");
			} else {
				$("#brandName").append($("<option value='"+ data.brandId +"' >" + data.brandName +"</option>"));
				cancelBrandName();
			}
		}
	})
	cancelBrandName();
}

function brandNameChange() {
	// document.getElementsByName("brandId")[0].value = document.getElementsByClassName("brandNameC")[0].value;
	var location = (window.location+'').split('/');
	var basePath = location[0]+'//'+location[2]+'/'+location[3]; 
	
	$.ajax({
		url: "CarInfoServlet",
		type: 'GET',
		data: {
			opr: "getCarTypeOptions",
			brandId: $("#brandName").val()
		},
		dataType: 'json',
		success: function(data) {
			if (data.length == 0) {
				alert("该品牌下没有具体类型的车");
			} else {
				$("#cartypeName").html("");
				$("#cartypeName").append("<option value='-1'>--请输入型号--</option>");
				$.each(data, function(index, carType) {
					$("#cartypeName").append($("<option value='"+ carType.cartypeId +"' >" + carType.cartypeName +"</option>"));
				})
				
				cancelCarType();
			}
		}
	})
	cancelCarType();
	
}

function delCatInfo(index, carId, selectObj) {
	
	alert(index, carId + $(selectObj).val())
	var location = (window.location+'').split('/');
	var basePath = location[0]+'//'+location[2]+'/'+location[3]; 
	
	$.ajax({
		url: "CarInfoServlet",
		type: 'GET',
		data: {
			opr: "delCarInfo",
			carInfoId: carId
		},
		dataType: 'json',
		success: function(data) {
			$("#" + index).remove();
		}
	});
}

function addCarTypeName() {
	
	if ($("#brandName").val() != -1) {
		$.ajax({
			url: "CarInfoServlet",
			type: 'GET',
			data: {
				opr: "addCarType",
				brandId: $("#brandName").val(),
				carTypeName: $(".inCarTypeName").val()
			},
			dataType: 'json',
			success: function(data) {
				$("#cartypeName").html("");
				$("#cartypeName").append("<option value='-1'>--请输入型号--</option>");
				var flag = false;
				var tmp = null;
				$.each(data, function(index, carType) {
					$("#cartypeName").append($("<option value='"+ carType.cartypeId +"' >" + carType.cartypeName +"</option>"));
					if ($(".inCarTypeName").val() == carType.cartypeName) {
						alert("输入了重复的车辆型号");
						tmp = carType.cartypeId;
						flag = true;
					}<commit_msg>fix bug<commit_after>function cancelBrandName() {
	$(".addNewbrandName").hide();
	$(".inBrandName").val("");
}

function cancelCarType() {
	$(".addNewCarType").hide();
	$(".inCarTypeName").val("");
}

function addCarType() {
	$(".addNewCarType").show();
}

function addBrand() {
	$(".addNewbrandName").show();
}

function addNewbrandName() {
	// 把参数提交给Action
	var location = (window.location+'').split('/');
	var basePath = location[0]+'//'+location[2]+'/'+location[3]; 
	
	$.ajax({
		url: "CarInfoServlet",
		type: 'GET',
		data: {
			opr: "addBrandName",
			brandName: $(".inBrandName").val()
		},
		dataType: 'json',
		success: function(data) {
			if (data == 'false') {
				$(".inBrandName").val("");
				alert("输入了重复的车辆品牌");
			} else {
				$("#brandName").append($("<option value='"+ data.brandId +"' >" + data.brandName +"</option>"));
				cancelBrandName();
			}
		}
	})
	cancelBrandName();
}

function brandNameChange() {
	// document.getElementsByName("brandId")[0].value = document.getElementsByClassName("brandNameC")[0].value;
	var location = (window.location+'').split('/');
	var basePath = location[0]+'//'+location[2]+'/'+location[3]; 
	
	$.ajax({
		url: "CarInfoServlet",
		type: 'GET',
		data: {
			opr: "getCarTypeOptions",
			brandId: $("#brandName").val()
		},
		dataType: 'json',
		success: function(data) {
			if (data.length == 0) {
				alert("该品牌下没有具体类型的车");
			} else {
				$("#cartypeName").html("");
				$("#cartypeName").append("<option value='-1'>--请输入型号--</option>");
				$.each(data, function(index, carType) {
					$("#cartypeName").append($("<option value='"+ carType.cartypeId +"' >" + carType.cartypeName +"</option>"));
				})
				
				cancelCarType();
			}
		}
	})
	cancelCarType();
	
}

function delCatInfo(index, carId, selectObj) {
	
	alert(index, carId + $(selectObj).val())
	var location = (window.location+'').split('/');
	var basePath = location[0]+'//'+location[2]+'/'+location[3]; 
	
	$.ajax({
		url: "CarInfoServlet",
		type: 'GET',
		data: {
			opr: "delCarInfo",
			carInfoId: carId
		},
		dataType: 'json',
		success: function(data) {
			$("#" + index).remove();
		}
	});
}

function addCarTypeName() {
	
	if ($("#brandName").val() != -1) {
		$.ajax({
			url: "CarInfoServlet",
			type: 'GET',
			data: {
				opr: "addCarType",
				brandId: $("#brandName").val(),
				carTypeName: $(".inCarTypeName").val()
			},
			dataType: 'json',
			success: function(data) {
				$("#cartypeName").html("");
				$("#cartypeName").append("<option value='-1'>--请输入型号--</option>");
				var flag = false;
				var tmp = null;
				$.each(data, function(index, carType) {
					$("#cartypeName").append($("<option value='"+ carType.cartypeId +"' >" + carType.cartypeName +"</option>"));
					if ($(".inCarTypeName").val() == carType.cartypeName) {
						tmp = carType.cartypeId;
						flag = true;
					}
{'fraction_non_alphanumeric': 0.2429398351166462, 'fraction_numerical': 0.005262234695667427, 'mean_word_length': 3.8363019508057676, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '2537149', 'n_tokens_mistral': 2418, 'n_tokens_neox': 2123, 'n_words': 332}