<commit_before>function scrollToElement(parentElement, childElement) {
	parentElement.scrollTop(parentElement.scrollTop() + childElement.offset().top - parentElement.offset().top);
	parentElement.scrollLeft(parentElement.scrollLeft() + childElement.offset().left - parentElement.offset().left);
}

//FIXME: delete these
function getJSON(url, onSuccess, onFail) {
	var xhr = new XMLHttpRequest();
	xhr.open('get', url);
	xhr.onreadystatechange = function() {
		if (xhr.readyState !== 4) {
			return;
		}

		if (xhr.status === 200) {
			if (onSuccess instanceof Function) {
				var obj = JSON.parse(xhr.responseText);
				(onSuccess)(obj);
			}
		} else {
			if(onFail instanceof Function) {
				(onFail)(xhr);
			} else {
				try {
					var json = JSON.parse(xhr.responseText);
					var error = json.error;
					var message = json.message;
					alert(error + '\n' + message);
				}catch(err) {
					alert(xhr.statusText);
				}
			}
		}
	};
	xhr.send();
}

function deleteJSON(url, onSuccess, onFail) {
	var xhr = new XMLHttpRequest();
	xhr.open('post', url + '?_method=DELETE');
	xhr.onreadystatechange = function() {
		if (xhr.readyState !== 4) {
			return;
		}

		if (xhr.status === 200) {
			if (onSuccess instanceof Function) {
				var obj = JSON.parse(xhr.responseText);
				(onSuccess)(obj);
			}
		} else {
			if(onFail instanceof Function) {
				(onFail)(xhr);
			} else {
				try {
					var json = JSON.parse(xhr.responseText);
					var error = json.error;
					var message = json.message;
					alert(error + '\n' + message);
				}catch(err) {
					alert(xhr.statusText);
				}
			}
		}
	};
	xhr.send();
}

function post(url, parameter, onSuccess, onFail) {
	var xhr = new XMLHttpRequest();
	xhr.open('post', url);
	xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xhr.onreadystatechange = function() {
		if (xhr.readyState !== 4) {
			return;
		}

		if (xhr.status === 200) {
			if (onSuccess instanceof Function) {
				var obj = JSON.parse(xhr.responseText);
				(onSuccess)(obj);
			}
		} else {
			if(onFail instanceof Function) {
				(onFail)(xhr);
			}
		}
	};
	xhr.send(parameter);
}

function resizer(event) {
	var name = event.animationName;

	if (name === "big") {
		document.body.removeClass('menu-open');
	} else if (name === "small") {
		document.body.removeClass('menu-open');
		document.body.removeClass('side-open');
	}
}

function clickPersistentMenu(event) {
	var target = $(event.target);
	//FIXME: data-filter
	var action = target.attr('data-action');
	closeMenu();

	if (action === 'all') {
		getAllEntries();
	}
}

function clickComplementaryMenu(event) {
	var target = $(event.target);
	if (["input", "textarea"].indexOf(target.localName) >= 0) {
		return;
	}

	while (target.attr('data-action') === null) {
		target = target.parentElement;
		if (target === null) {
			return;
		}
	}

	var action = target.attr('data-action');
	closeSide();

	if (action === 'remove-this') {
		removeCurrentSelected();
	} else if (action === 'change-theme') {
		var theme_name = target.attr('data-theme-name');
		changeTheme(theme_name);
	}
}

function removeCurrentSelected() {
	var current = $('[role=navigation] .current');

	var url = current.attr('data-remove-feed-url') || current.attr('data-remove-category-url');
	if (url) {
		var parentMenu = current;
		while (parentMenu.hasClass('fold') === false) {
			parentMenu = parentMenu.parent();
			if (parentMenu.length === 0) {
				break;
			}
		}

		deleteJSON(url, function(obj) {
			makeFeedList(obj, parentMenu);
		});
	}
}

function toggleMenu(event) {
	closeSide();
	$(document.body).toggleClass('menu-open');
}

function toggleSide(event) {
	closeMenu();
	$(document.body).toggleClass('side-open');
}

function toggleFolding(event) {
	var target = $(event.target);
	while (target.hasClass('header') === false) {
		target = target.parent();
		if (target === null) {
			return;
		}
	}

	target.toggleClass('closed');
}

function closeMenu() {
	$(document.body).removeClass('menu-open');
}

function closeSide() {
	$(document.body).removeClass('side-open');
}

function processForm(event) {
	var target = $(event.target);
	event.preventDefault();

	var data = target.serialize();
	var after = target.attr('data-after');
	var action = target.attr('action');
	if (after === "makeFeedList") {
		try {
			var current = $('[role=navigation] .feedlist .current');
			if (target.attr('data-action') === 'addFeed') {
				action = current.attr('data-add-feed-url') ||
					current.parent().prev().attr('data-add-feed-url') ||
					target.attr('action');
			} else if (target.attr('data-action') === 'addCategory') {
				action = current.attr('data-add-category-url') ||
					current.parent().prev().attr('data-add-category-url') ||
					target.attr('action');
			}
		} catch (err) {
		}
		post(action, data, function(res) {
			if (current === null) {
				makeFeedList(res);
			} else {
				var fold = current.next();
				fold.html("");
				//makeCategory(fold, res);
				makeFeedList(res, fold);
			}
			target.each(function(){
				this.reset();<commit_msg>url for new folder<commit_after>function scrollToElement(parentElement, childElement) {
	parentElement.scrollTop(parentElement.scrollTop() + childElement.offset().top - parentElement.offset().top);
	parentElement.scrollLeft(parentElement.scrollLeft() + childElement.offset().left - parentElement.offset().left);
}

//FIXME: delete these
function getJSON(url, onSuccess, onFail) {
	var xhr = new XMLHttpRequest();
	xhr.open('get', url);
	xhr.onreadystatechange = function() {
		if (xhr.readyState !== 4) {
			return;
		}

		if (xhr.status === 200) {
			if (onSuccess instanceof Function) {
				var obj = JSON.parse(xhr.responseText);
				(onSuccess)(obj);
			}
		} else {
			if(onFail instanceof Function) {
				(onFail)(xhr);
			} else {
				try {
					var json = JSON.parse(xhr.responseText);
					var error = json.error;
					var message = json.message;
					alert(error + '\n' + message);
				}catch(err) {
					alert(xhr.statusText);
				}
			}
		}
	};
	xhr.send();
}

function deleteJSON(url, onSuccess, onFail) {
	var xhr = new XMLHttpRequest();
	xhr.open('post', url + '?_method=DELETE');
	xhr.onreadystatechange = function() {
		if (xhr.readyState !== 4) {
			return;
		}

		if (xhr.status === 200) {
			if (onSuccess instanceof Function) {
				var obj = JSON.parse(xhr.responseText);
				(onSuccess)(obj);
			}
		} else {
			if(onFail instanceof Function) {
				(onFail)(xhr);
			} else {
				try {
					var json = JSON.parse(xhr.responseText);
					var error = json.error;
					var message = json.message;
					alert(error + '\n' + message);
				}catch(err) {
					alert(xhr.statusText);
				}
			}
		}
	};
	xhr.send();
}

function post(url, parameter, onSuccess, onFail) {
	var xhr = new XMLHttpRequest();
	xhr.open('post', url);
	xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xhr.onreadystatechange = function() {
		if (xhr.readyState !== 4) {
			return;
		}

		if (xhr.status === 200) {
			if (onSuccess instanceof Function) {
				var obj = JSON.parse(xhr.responseText);
				(onSuccess)(obj);
			}
		} else {
			if(onFail instanceof Function) {
				(onFail)(xhr);
			}
		}
	};
	xhr.send(parameter);
}

function resizer(event) {
	var name = event.animationName;

	if (name === "big") {
		document.body.removeClass('menu-open');
	} else if (name === "small") {
		document.body.removeClass('menu-open');
		document.body.removeClass('side-open');
	}
}

function clickPersistentMenu(event) {
	var target = $(event.target);
	//FIXME: data-filter
	var action = target.attr('data-action');
	closeMenu();

	if (action === 'all') {
		getAllEntries();
	}
}

function clickComplementaryMenu(event) {
	var target = $(event.target);
	if (["input", "textarea"].indexOf(target.localName) >= 0) {
		return;
	}

	while (target.attr('data-action') === null) {
		target = target.parentElement;
		if (target === null) {
			return;
		}
	}

	var action = target.attr('data-action');
	closeSide();

	if (action === 'remove-this') {
		removeCurrentSelected();
	} else if (action === 'change-theme') {
		var theme_name = target.attr('data-theme-name');
		changeTheme(theme_name);
	}
}

function removeCurrentSelected() {
	var current = $('[role=navigation] .current');

	var url = current.attr('data-remove-feed-url') || current.attr('data-remove-category-url');
	if (url) {
		var parentMenu = current;
		while (parentMenu.hasClass('fold') === false) {
			parentMenu = parentMenu.parent();
			if (parentMenu.length === 0) {
				break;
			}
		}

		deleteJSON(url, function(obj) {
			makeFeedList(obj, parentMenu);
		});
	}
}

function toggleMenu(event) {
	closeSide();
	$(document.body).toggleClass('menu-open');
}

function toggleSide(event) {
	closeMenu();
	$(document.body).toggleClass('side-open');
}

function toggleFolding(event) {
	var target = $(event.target);
	while (target.hasClass('header') === false) {
		target = target.parent();
		if (target === null) {
			return;
		}
	}

	target.toggleClass('closed');
}

function closeMenu() {
	$(document.body).removeClass('menu-open');
}

function closeSide() {
	$(document.body).removeClass('side-open');
}

function processForm(event) {
	var target = $(event.target);
	event.preventDefault();

	var data = target.serialize();
	var after = target.attr('data-after');
	var action = target.attr('action');
	if (after === "makeFeedList") {
		try {
			var current = $('[role=navigation] .feedlist .current');
			if (target.attr('data-action') === 'addFeed') {
				action = current.attr('data-add-feed-url') ||
					current.parent().attr('data-add-feed-url') ||
					target.attr('action');
			} else if (target.attr('data-action') === 'addCategory') {
				action = current.attr('data-add-category-url') ||
					current.parent().attr('data-add-category-url') ||
					target.attr('action');
			}
		} catch (err) {
		}
		post(action, data, function(res) {
			if (current === null) {
				makeFeedList(res);
			} else {
				var fold = current.next();
				fold.html("");
				//makeCategory(fold, res);
				makeFeedList(res, fold);
			}
			target.each(function(){
				this.reset();
{'fraction_non_alphanumeric': 0.18086266732771442, 'fraction_numerical': 0.0027764005949429847, 'mean_word_length': 3.6522140221402215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2119133', 'n_tokens_mistral': 3954, 'n_tokens_neox': 3447, 'n_words': 656}