<commit_before>/* General utility functions. */

'use strict';

const TRANSITION_TIME = "0.25s";

module.exports = {
	RGB2hex: function (rgb) {
		rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
		let r = ("0" + parseInt(rgb[1]).toString(16)).slice(-2);
		let g = ("0" + parseInt(rgb[2]).toString(16)).slice(-2);
		let b = ("0" + parseInt(rgb[3]).toString(16)).slice(-2);
		return `#${r}${g}${b}`;
	},

	transition: function (fromId, toId) {
		// TODO: pineman no understand :'(
		let fromScreen = document.getElementById(fromId),
			toScreen   = document.getElementById(toId);

		document.body.style.overflow = "hidden";
		fromScreen.style.transition = TRANSITION_TIME;
		toScreen.style.transition = TRANSITION_TIME;
		fromScreen.classList.add("transition-out");
		toScreen.classList.add("transition-out");
		toScreen.style.display = "block";

		setTimeout(function () {
			fromScreen.style.display = "none";
			toScreen.classList.remove("transition-out");
			fromScreen.classList.remove("transition-out");
		}, 250);
	},

	clear: function (element) {
		element.innerHTML = '';
	},

	findPlayer: function (id, players) {
		for (let i = 0; i < players.length; i++)
			if (players[i].id == id)
				return players[i];
	},

	findPlayerIndex: function (id, players) {
		for (let i = 0; i < players.length; i++)<commit_msg>[C] restore body `overflow` after transitions<commit_after>/* General utility functions. */

'use strict';

const TRANSITION_TIME = "0.25s";

module.exports = {
	RGB2hex: function (rgb) {
		rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
		let r = ("0" + parseInt(rgb[1]).toString(16)).slice(-2);
		let g = ("0" + parseInt(rgb[2]).toString(16)).slice(-2);
		let b = ("0" + parseInt(rgb[3]).toString(16)).slice(-2);
		return `#${r}${g}${b}`;
	},

	transition: function (fromId, toId) {
		// TODO: pineman no understand :'(
		let fromScreen = document.getElementById(fromId),
			toScreen   = document.getElementById(toId);

		document.body.style.overflow = "hidden";

		fromScreen.style.transition = TRANSITION_TIME;
		toScreen.style.transition = TRANSITION_TIME;
		fromScreen.classList.add("transition-out");
		toScreen.classList.add("transition-out");
		toScreen.style.display = "block";

		setTimeout(function () {
			fromScreen.style.display = "none";
			toScreen.classList.remove("transition-out");
			fromScreen.classList.remove("transition-out");

			setTimeout(function () {
				document.body.style.overflow = "auto";
			}, parseFloat(TRANSITION_TIME) * 1000 + 50);
		}, parseFloat(TRANSITION_TIME) * 1000 + 50);
	},

	clear: function (element) {
		element.innerHTML = '';
	},

	findPlayer: function (id, players) {
		for (let i = 0; i < players.length; i++)
			if (players[i].id == id)
				return players[i];
	},

	findPlayerIndex: function (id, players) {
		for (let i = 0; i < players.length; i++)
{'fraction_non_alphanumeric': 0.19590540063536888, 'fraction_numerical': 0.020120014119308152, 'mean_word_length': 4.143375680580762, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '7273722', 'n_tokens_mistral': 1090, 'n_tokens_neox': 986, 'n_words': 190}