<commit_before>/* jshint unused:vars, undef:true, browser:true, jquery:true */
/* global tinyMCE */

if(!window.multilingual_attribute_mceWorkaround) { (function(window, $) {

function couple($textarea, realID) {
	var me = this;
	me.$textarea = $textarea;
	$textarea.before(me.$final = $('<input type="hidden" name="' + realID + '" id="' + realID + '" />').val($textarea.val()));
	var form = $textarea.closest('form')[0];
	var id = $textarea.attr('id');
	couple.all.push(me);
	var lookForMCE = function(cb) {
		var mce = null;
		if(window.tinyMCE) {
			$.each(tinyMCE.get(), function() {
				if(this.initialized) {
					var $form = $(this.contentAreaContainer).closest('form');
					if($form.length && ($form[0] === form) && (this.id === id)) {
						mce = this;
						return false;
					}
				}
			});
		}
		if(mce) {
			cb(mce);
		}
		else {
			setTimeout(function() {lookForMCE(cb); }, 100);
		}
	};
	lookForMCE(function(mce) {
		me.mce = mce;
		me.mce.onChange.add(function(ed, l) {
			me.$final.val(mce.getContent());
		});
	});
}
couple.all = [];

window.multilingual_attribute_mceWorkaround = function(mceID) {
	$('[name="' + mceID + '"]').each(function(index, textarea) {
		var already = false;
		$.each(couple.all, function() {
			if(this.$textarea[0] === textarea) {
				already = true;
				return false;
			}
		});<commit_msg>Remove references to disposed html editors<commit_after>/* jshint unused:vars, undef:true, browser:true, jquery:true */
/* global tinyMCE */

if(!window.multilingual_attribute_mceWorkaround) { (function(window, $) {

function couple($textarea, realID) {
	var me = this;
	me.$textarea = $textarea;
	$textarea.before(me.$final = $('<input type="hidden" name="' + realID + '" id="' + realID + '" />').val($textarea.val()));
	var form = $textarea.closest('form')[0];
	var id = $textarea.attr('id');
	couple.all.push(me);
	var lookForMCE = function(cb) {
		var mce = null;
		if(window.tinyMCE) {
			$.each(tinyMCE.get(), function() {
				if(this.initialized) {
					var $form = $(this.contentAreaContainer).closest('form');
					if($form.length && ($form[0] === form) && (this.id === id)) {
						mce = this;
						return false;
					}
				}
			});
		}
		if(mce) {
			cb(mce);
		}
		else {
			setTimeout(function() {lookForMCE(cb); }, 100);
		}
	};
	lookForMCE(function(mce) {
		me.mce = mce;
		me.mce.onChange.add(function(ed, l) {
			me.$final.val(mce.getContent());
		});
		me.mce.onRemove.add(function(ed) {
			$.each(couple.all, function(i, c) {
				if(c === me) {
					couple.all.splice(i, 1);
					return false;
				}
			});
		});
	});
}
couple.all = [];

window.multilingual_attribute_mceWorkaround = function(mceID) {
	$('[name="' + mceID + '"]').each(function(index, textarea) {
		var already = false;
		$.each(couple.all, function() {
			if(this.$textarea[0] === textarea) {
				already = true;
				return false;
			}
		});
{'fraction_non_alphanumeric': 0.209351011863224, 'fraction_numerical': 0.0045359385903698535, 'mean_word_length': 3.5652866242038215, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6742896', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1084, 'n_words': 185}