<commit_before>/* List Creator Javascript
 */
var sessionVar = Math.random();
var skipVersions = false;
var lastName = '';

function checklink() {
	//http://www.minecraftforum.net/topic/\d+-
	var link = $('#link').val();
	if(link != "") {
		if(/^[a-z]+:\/\//i.test(link)) {
			if(/(http:\/\/)*(www.)*minecraftforum.net\/topic\/\d+-./.test(link)) {
				$('#link').val(link.match(/(http:\/\/)*(www.)*minecraftforum.net\/topic\/\d+-/)[0]);
				$('#linktext').html('<span class="found">MCF Link cut</span>');
			}
			link = $('#link').val();
			if(!/http:\/\/bit\.ly\/[a-zA-Z0-9]*/.test(link)) {
				if($('#linktext').html() == '<span class="found">MCF Link cut</span>') {
					$('#linktext').html('<span class="found">MCF Link cut - <a href="javascript:bitly();">bit.ly this link</a></span>');
				} else {
					$('#linktext').html('<span class="found"><a href="javascript:bitly();">bit.ly this link</a></span>');
				}
			}
		} else {
			$('#linktext').html('<span class="failed">Not a valid link</span>');
		}
	} else {
		$('#linktext').html('Link to the mod\'s page');
	}
}

function setVersions(versionlist) {
	window.skipVersions = true;
	var versions = versionlist.split(',');
	if(versions.indexOf('1.5.2') != -1)
		$('#ver152').attr('checked', true);
	else
		$('#ver152').attr('checked', false);
	if(versions.indexOf('1.5.1') != -1)
		$('#ver151').attr('checked', true);
	else
		$('#ver151').attr('checked', false);
	if(versions.indexOf('1.5.0') != -1)
		$('#ver150').attr('checked', true);
	else
		$('#ver150').attr('checked', false);
	if(versions.indexOf('1.4.7') != -1)
		$('#ver147').attr('checked', true);
	else
		$('#ver147').attr('checked', false);
	if(versions.indexOf('1.4.5') != -1)
		$('#ver145').attr('checked', true);
	else
		$('#ver145').attr('checked', false);
	if(versions.indexOf('1.4.2') != -1)
		$('#ver142').attr('checked', true);
	else
		$('#ver142').attr('checked', false);
}

function bitly() {
	$.getJSON("tools/bitly.php?mode=save&link=" + $('#link').val(), function(data) {
			$('#link').val(data['link']);
			$('#linktext').html('<span class="found">Link shortened!</span>');
			generate();
		});
}

function loadbitly() {
	var link = $('#link').val();
	if(/http:\/\/bit\.ly\/[a-zA-Z0-9]*/.test(link)) {
		$('#linktext').html('Extracting bitly info...');
		$.getJSON("tools/bitly.php?mode=info&link=" + $('#link').val(), function(data) {
			if(/ - Minecraft Forum/.test(data['title']))
				data['title'] = data['title'].replace(/ - Minecraft Forum/, "");
			if(/\[[a-zA-Z0-9.]*\]/.test(data['title']))
				data['title'] = data['title'].replace(/\[[a-zA-Z0-9.\/]*\]/g, "");
			data['title'] = $.trim(data['title']);
			$('#linktext').html('<span class="found"><a href="' + data['link'] +'">' + data['title'] + '</a></span>');
		});
	}
}

function generate() {
	var json = '  {\r\n';
	json += '    "name":"' + $.trim($('#name').val()) + '",\r\n';
	json += '    "other":"' + $.trim($('#other').val()) + '",\r\n';
	json += '    "link":"' + $.trim($('#link').val()) + '",\r\n';
	json += '    "desc":"' + $.trim($('#desc').val()) + '",\r\n';
	json += '    "author":"' + $.trim($('#author').val()) + '",\r\n';
	if($.trim($('#type').val()) != "")
		json += '    "type":["' +
			$.map($('#type').val().split(','), $.trim).join('","') +
			'"],\r\n';
	else
		json += '    "type":[],\r\n';
	
	if($.trim($('#dependencies').val()) != "")
		json += '    "dependencies":["' +
			$.map($('#dependencies').val().split(','), $.trim).join('","') +
			'"],\r\n';
	else<commit_msg>Added Link name placeholder in case bitly name is empty<commit_after>/* List Creator Javascript
 */
var sessionVar = Math.random();
var skipVersions = false;
var lastName = '';

function checklink() {
	//http://www.minecraftforum.net/topic/\d+-
	var link = $('#link').val();
	if(link != "") {
		if(/^[a-z]+:\/\//i.test(link)) {
			if(/(http:\/\/)*(www.)*minecraftforum.net\/topic\/\d+-./.test(link)) {
				$('#link').val(link.match(/(http:\/\/)*(www.)*minecraftforum.net\/topic\/\d+-/)[0]);
				$('#linktext').html('<span class="found">MCF Link cut</span>');
			}
			link = $('#link').val();
			if(!/http:\/\/bit\.ly\/[a-zA-Z0-9]*/.test(link)) {
				if($('#linktext').html() == '<span class="found">MCF Link cut</span>') {
					$('#linktext').html('<span class="found">MCF Link cut - <a href="javascript:bitly();">bit.ly this link</a></span>');
				} else {
					$('#linktext').html('<span class="found"><a href="javascript:bitly();">bit.ly this link</a></span>');
				}
			}
		} else {
			$('#linktext').html('<span class="failed">Not a valid link</span>');
		}
	} else {
		$('#linktext').html('Link to the mod\'s page');
	}
}

function setVersions(versionlist) {
	window.skipVersions = true;
	var versions = versionlist.split(',');
	if(versions.indexOf('1.5.2') != -1)
		$('#ver152').attr('checked', true);
	else
		$('#ver152').attr('checked', false);
	if(versions.indexOf('1.5.1') != -1)
		$('#ver151').attr('checked', true);
	else
		$('#ver151').attr('checked', false);
	if(versions.indexOf('1.5.0') != -1)
		$('#ver150').attr('checked', true);
	else
		$('#ver150').attr('checked', false);
	if(versions.indexOf('1.4.7') != -1)
		$('#ver147').attr('checked', true);
	else
		$('#ver147').attr('checked', false);
	if(versions.indexOf('1.4.5') != -1)
		$('#ver145').attr('checked', true);
	else
		$('#ver145').attr('checked', false);
	if(versions.indexOf('1.4.2') != -1)
		$('#ver142').attr('checked', true);
	else
		$('#ver142').attr('checked', false);
}

function bitly() {
	$.getJSON("tools/bitly.php?mode=save&link=" + $('#link').val(), function(data) {
			$('#link').val(data['link']);
			$('#linktext').html('<span class="found">Link shortened!</span>');
			generate();
		});
}

function loadbitly() {
	var link = $('#link').val();
	if(/http:\/\/bit\.ly\/[a-zA-Z0-9]*/.test(link)) {
		$('#linktext').html('Extracting bitly info...');
		$.getJSON("tools/bitly.php?mode=info&link=" + $('#link').val(), function(data) {
			if(/ - Minecraft Forum/.test(data['title']))
				data['title'] = data['title'].replace(/ - Minecraft Forum/, "");
			if(/\[[a-zA-Z0-9.]*\]/.test(data['title']))
				data['title'] = data['title'].replace(/\[[a-zA-Z0-9.\/]*\]/g, "");
			data['title'] = $.trim(data['title']);
			if(data['title'] == "")
				data['title'] = "Link";
			$('#linktext').html('<span class="found"><a href="' + data['link'] +'">' + data['title'] + '</a></span>');
		});
	}
}

function generate() {
	var json = '  {\r\n';
	json += '    "name":"' + $.trim($('#name').val()) + '",\r\n';
	json += '    "other":"' + $.trim($('#other').val()) + '",\r\n';
	json += '    "link":"' + $.trim($('#link').val()) + '",\r\n';
	json += '    "desc":"' + $.trim($('#desc').val()) + '",\r\n';
	json += '    "author":"' + $.trim($('#author').val()) + '",\r\n';
	if($.trim($('#type').val()) != "")
		json += '    "type":["' +
			$.map($('#type').val().split(','), $.trim).join('","') +
			'"],\r\n';
	else
		json += '    "type":[],\r\n';
	
	if($.trim($('#dependencies').val()) != "")
		json += '    "dependencies":["' +
			$.map($('#dependencies').val().split(','), $.trim).join('","') +
			'"],\r\n';
	else
{'fraction_non_alphanumeric': 0.33394547252436785, 'fraction_numerical': 0.019494278852945333, 'mean_word_length': 3.8526387936943114, 'pattern_counts': {'":': 16, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '5689449', 'n_tokens_mistral': 2896, 'n_tokens_neox': 2668, 'n_words': 391}