<commit_before>/**
 * Autoload
 */
(function($) {
// Autoload namespace: private properties and methods
var Autoload = {
	/**
	 * Include necessary CSS file
	 */
	css: function(file, options) {
		var collection = $("link[rel=stylesheet]");
		var path = options.basePath + options.cssPath + file;

		for (var i in collection) {
			if (path === collection[i].href) {
				// is loaded
				return true;
			}
		}

		var element = $("<link/>");
		element.attr({
			"href":		path,
			"media":	"all",
			"rel":		"stylesheet",
			"type":		"text/css"
		});
		$("head").append(element);
		return true;
	},

	/**
	 * Search path to js file
	 */
	findPath: function(baseFile) {
		baseFile = baseFile.replace(/\./g, "\\.");
		var collection = $("script");
		var reg = eval("/^(.*)" + baseFile + "$/");
		var path = null;

		for (var i in collection) {
			if (null === path) {
				var p = reg.exec(collection[i].src);
				if (null !== p) {
					return p[1];
				}
			}
		}
		return path;
	},

	/**
	 * Include necessary JavaScript file
	 */
	js: function(file, options) {
		var collection = $("script");
		var path = options.basePath + options.jsPath + file;

		for (var i in collection) {
			if (path === collection[i].src) {
				// is loaded
				return true;
			}
		}

		// When local used in Firefox got [Exception... "Access to restricted URI denied" code: "1012"]
		$.ajax({
			url: path,
			dataType: "script",
			success: function(data, textStatus, XMLHttpRequest) {
				if (options.successCallback) {
					options.successCallback();
				}
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
				console.log(XMLHttpRequest, textStatus, errorThrown);
			}
		});
		return true;
	}
};

/*
 * Autoload namespace: public properties and methods
 */
$.autoload = {
	css: function(names, options) {
		var basePath = Autoload.findPath(options.baseFile);
		var cssPath = (undefined === options.cssPath) ? "css/" : options.cssPath;
		options = {"basePath": basePath, "cssPath": cssPath};

		if ("string" === typeof names) {
			names = [names];
		}

		for (var i = 0; i < names.length; i++) {
			Autoload.css(names[i], options);
		}
	},

	js: function(names, options) {
		options.basePath = Autoload.findPath(options.baseFile);
		options.jsPath = (undefined === options.jsPath) ? "plugins/" : options.jsPath;

		if ("string" === typeof names) {
			names = [names];
		}

		for (var i = 0; i < names.length; i++) {
			Autoload.js(names[i], options);
		}
	}
};

//$.wysiwyg.autoload.init();

})(jQuery);<commit_msg>updates<commit_after>/**
 * Autoload
 */
(function ($) {
	// Autoload namespace: private properties and methods
	var Autoload = {
		/**
		 * Include necessary CSS file
		 */
		css: function (file, options) {
			var collection = $("link[rel=stylesheet]"),
				path = options.basePath + options.cssPath + file,
				element,
				i;

			for (i = 0; i < collection.length; i += 1) {
				if (path === this.href) {
					// is loaded
					return true;
				}
			}

			element = $("<link/>").attr({
				"href":		path,
				"media":	"all",
				"rel":		"stylesheet",
				"type":		"text/css"
			});
			$("head").append(element);

			return true;
		},

		/**
		 * Search path to js file
		 */
		findPath: function (baseFile) {
			baseFile = baseFile.replace(/\./g, "\\.");

			var collection = $("script"),
				reg = eval("/^(.*)" + baseFile + "$/"),
				i,
				p;

			for (i = 0; i < collection.length; i += 1) {
				p = reg.exec(collection[i].src);

				if (null !== p) {
					return p[1];
				}
			}

			return null;
		},

		/**
		 * Include necessary JavaScript file
		 */
		js: function (file, options) {
			var collection = $("script"),
				path = options.basePath + options.jsPath + file,
				i;

			for (i = 0; i < collection.length; i += 1) {
				if (path === collection[i].src) {
					// is loaded
					return true;
				}
			}

			// When local used in Firefox got [Exception... "Access to restricted URI denied" code: "1012"]
			$.ajax({
				url: path,
				dataType: "script",
				success: function (data, textStatus, XMLHttpRequest) {
					if (options.successCallback) {
						options.successCallback();
					}
				},
				error: function (XMLHttpRequest, textStatus, errorThrown) {
					if (console) {
						console.log(XMLHttpRequest, textStatus, errorThrown);
					}
				}
			});
			return true;
		}
	};

	/*
	 * Autoload namespace: public properties and methods
	 */
	$.autoload = {
		css: function (names, options) {
			var basePath = Autoload.findPath(options.baseFile),
				cssPath = (undefined === options.cssPath) ? "css/" : options.cssPath,
				i;

			options = {"basePath": basePath, "cssPath": cssPath};

			if ("string" === typeof names) {
				names = [names];
			}

			for (i = 0; i < names.length; i += 1) {
				Autoload.css(names[i], options);
			}
		},

		js: function (names, options) {
			var i;

			options.basePath = Autoload.findPath(options.baseFile);
			options.jsPath = (undefined === options.jsPath) ? "plugins/" : options.jsPath;

			if ("string" === typeof names) {
				names = [names];
			}

			for (i = 0; i < names.length; i += 1) {
				Autoload.js(names[i], options);
			}
		}
	};

	//$.wysiwyg.autoload.init();

})(jQuery);
{'fraction_non_alphanumeric': 0.17868217054263566, 'fraction_numerical': 0.004263565891472868, 'mean_word_length': 2.689063616869192, 'pattern_counts': {'":': 12, '<': 12, '<?xml version=': 0, '>': 5, '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': '5487753', 'n_tokens_mistral': 2173, 'n_tokens_neox': 1761, 'n_words': 445}