<commit_before>'use strict';

// ------------------------------------------------------------------------------------------ Component Dependencies

// Unfortunately, Bootstrap requires global jQuery object
var $ = require('jquery');

// ------------------------------------------------------------------------------------------ Component Variables

var COMPONENT_ATTR = 'name="baseurl"';
var COMPONENT_SELECTOR = '[' + COMPONENT_ATTR + ']';

// ------------------------------------------------------------------------------------------ Component Definition

function BaseUrl(element) {
	var component = this;
	component.$element = $(element);

	var current = window.location.protocol + '//' + window.location.host;
	var baseUrl = element.getAttribute('value');
	if(baseUrl.indexOf(current) !== 0) {
		$('body').prepend('<div class="baseurl alert alert-warning"><strong>Warning</strong>: the base URL is set to ' + baseUrl + ' but you are accessing this page from ' + current + '. It is recommended to update the BaseUrl setting.</div>');
	}
}

// ------------------------------------------------------------------------------------------ Component Initialization

$(COMPONENT_SELECTOR).each(function(index, element) {
	return new BaseUrl(element);
});<commit_msg>#41 Add support for sending tokens by email Fixing issue with baseUrl component: the port number should also be taken into consideration. Matching should use 'host' instead of 'hostname' property.<commit_after>'use strict';

// ------------------------------------------------------------------------------------------ Component Dependencies

// Unfortunately, Bootstrap requires global jQuery object
var $ = require('jquery');

// ------------------------------------------------------------------------------------------ Component Variables

var COMPONENT_ATTR = 'name="baseurl"';
var COMPONENT_SELECTOR = '[' + COMPONENT_ATTR + ']';

// ------------------------------------------------------------------------------------------ Component Definition

function BaseUrl(element) {
	var component = this;
	component.$element = $(element);

	var current = document.createElement('a');
	current.href = window.location.href;

	var baseUrl = document.createElement('a');
	baseUrl.href = element.getAttribute('value');

	if(current.host != baseUrl.host) {
		$('body').prepend('<div class="baseurl alert alert-warning"><strong>Warning</strong>: the base URL is set to ' + baseUrl.host + ' but you are accessing this page from ' + current.host + '. It is recommended to update the BaseUrl setting.</div>');
	}
}

// ------------------------------------------------------------------------------------------ Component Initialization

$(COMPONENT_SELECTOR).each(function(index, element) {
	return new BaseUrl(element);
});
{'fraction_non_alphanumeric': 0.3618018018018018, 'fraction_numerical': 0.001081081081081081, 'mean_word_length': 1.5968194574368568, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1541874', 'n_tokens_mistral': 598, 'n_tokens_neox': 584, 'n_words': 176}