<commit_before>define([ "jquery", "message-bus", "module" ], function($, bus, module) {
	var ids = {};

	var config = module.config();
	if (!config.originalMessage) {
		config.originalMessage = "Loading";
	}
	var message;
	var intervalId;

	// Create divs
	var loadingShade = $("<div/>").attr("id", "loading-shade");
	var loadingDiv = $("<div/>").attr("id", "loading-container");
	var loadingMsg = $("<div/>").attr("id", "loading-msg");
	loadingShade.append(loadingDiv);
	loadingDiv.append(loadingMsg);
	$("body").append(loadingShade);

	// Hide divs by default
	loadingShade.hide();

	function updateMessage() {
		var keys = Object.keys(ids);
		console.log(keys);
		if (keys.length == 1) {
			message = keys[0];
		} else {
			message = config.originalMessage;
		}
		loadingMsg.text(message + "...");
	}

	bus.listen("ui-loading:start", function(e, msg) {
		console.log(msg);
		if (ids[msg]) {
			ids[msg]++;
		} else {
			ids[msg] = 1;
		}

		updateMessage();
		loadingShade.show();
		loadingMsg.css("width", loadingMsg.width() + "px");
		
		if (!intervalId) {
			// Add a dot to the message each 0.5s, up to 3 dots
			intervalId = setInterval(function() {
				var divText = loadingMsg.text();
				if (divText.length < message.length + 3) {
					loadingMsg.text(divText + ".");
				} else {
					loadingMsg.text(message);
				}
			}, 500);
		}
	});

	bus.listen("ui-loading:end", function(e, msg) {
		if (!ids[msg] || ids[msg] <= 0) {
			console.warn("Trying to finish non-started loading: " + msg);
			return;
		}

		ids[msg]--;

		var anyoneLoading = false;
		$.each(ids, function(key, value) {
			if (value) {
				anyoneLoading = true;<commit_msg>Adapt address-search events to the ui-loading module. Refs #1026<commit_after>define([ "jquery", "message-bus", "module" ], function($, bus, module) {
	var ids = {};

	var config = module.config();
	if (!config.originalMessage) {
		config.originalMessage = "Loading";
	}
	var message;
	var intervalId;

	// Create divs
	var loadingShade = $("<div/>").attr("id", "loading-shade");
	var loadingDiv = $("<div/>").attr("id", "loading-container");
	var loadingMsg = $("<div/>").attr("id", "loading-msg");
	loadingShade.append(loadingDiv);
	loadingDiv.append(loadingMsg);
	$("body").append(loadingShade);

	// Hide divs by default
	loadingShade.hide();

	function updateMessage() {
		var keys = Object.keys(ids);
		if (keys.length == 1) {
			message = keys[0];
		} else {
			message = config.originalMessage;
		}
		loadingMsg.text(message + "...");
	}

	bus.listen("ui-loading:start", function(e, msg) {
		if (ids[msg]) {
			ids[msg]++;
		} else {
			ids[msg] = 1;
		}

		updateMessage();
		loadingShade.show();
		loadingMsg.css("width", loadingMsg.width() + "px");
		
		if (!intervalId) {
			// Add a dot to the message each 0.5s, up to 3 dots
			intervalId = setInterval(function() {
				var divText = loadingMsg.text();
				if (divText.length < message.length + 3) {
					loadingMsg.text(divText + ".");
				} else {
					loadingMsg.text(message);
				}
			}, 500);
		}
	});

	bus.listen("ui-loading:end", function(e, msg) {
		if (!ids[msg] || ids[msg] <= 0) {
			console.warn("Trying to finish non-started loading: " + msg);
			return;
		}

		ids[msg]--;
		if (!ids[msg]) {
			delete ids[msg];
		}

		var anyoneLoading = false;
		$.each(ids, function(key, value) {
			if (value) {
				anyoneLoading = true;
{'fraction_non_alphanumeric': 0.19195230998509688, 'fraction_numerical': 0.007749627421758569, 'mean_word_length': 3.4687083888149135, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, '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': '6541346', 'n_tokens_mistral': 1351, 'n_tokens_neox': 1168, 'n_words': 257}