<commit_before>/*
Script: MooEditable.Group.js
	A MooEditable extension for having multiple MooEditable instances on a page controlled by one toolbar.

License:
	MIT-style license.
*/

MooEditable.Group = new Class({

	Implements: [Options],
	
	options: {
		actions: 'bold italic underline strikethrough | insertunorderedlist insertorderedlist indent outdent | undo redo | createlink unlink | urlimage | toggleview'
	},
    
	initialize: function(toolbarEl, options){
		this.setOptions(options);
		this.actions = this.options.actions.clean().split(' ');
		// setup toolbar
		var self = this;
		this.toolbar = new MooEditable.UI.Toolbar({
			onItemAction: function(){
				var args = $splat(arguments);
				var item = args[0];
                if (!self.activeEditor) return;
                self.activeEditor.focus();
                self.activeEditor.action(item.name, args);
                if (self.activeEditor.mode == 'iframe') self.activeEditor.checkStates();
			}
		}).render(this.actions);
		$(toolbarEl).adopt(this.toolbar);
	},

	add: function(el, options){
		var editor = new MooEditable.Group.Item(el, this, $merge({toolbar:false}, options));
		this.activeEditor = editor;
		return editor;
	}
	
});


MooEditable.Group.Item = new Class({

	Extends: MooEditable,

	initialize: function(el, group, options){
		this.group = group;
		this.parent(el, options);
		// add focus events
		this.textarea.addEvent('focus', function(){
			this.group.activeEditor = this;
		}.bind(this));
		// safari doesnt fire onfocus event, so make it onclick
		this.win.addEvent('focus', function(){
			this.group.activeEditor = this;
		}.bind(this));
	}

});<commit_msg>Code cleanup.<commit_after>/*
Script: MooEditable.Group.js
	A MooEditable extension for having multiple MooEditable instances on a page controlled by one toolbar.

License:
	MIT-style license.
*/

MooEditable.Group = new Class({

	Implements: [Options],
	
	options: {
		actions: 'bold italic underline strikethrough | insertunorderedlist insertorderedlist indent outdent | undo redo | createlink unlink | urlimage | toggleview'
	},
    
	initialize: function(toolbarEl, options){
		this.setOptions(options);
		this.actions = this.options.actions.clean().split(' ');
		var self = this;
		this.toolbar = new MooEditable.UI.Toolbar({
			onItemAction: function(){
				var args = $splat(arguments);
				var item = args[0];
                if (!self.activeEditor) return;
                self.activeEditor.focus();
                self.activeEditor.action(item.name, args);
                if (self.activeEditor.mode == 'iframe') self.activeEditor.checkStates();
			}
		}).render(this.actions);
		$(toolbarEl).adopt(this.toolbar);
	},

	add: function(el, options){
		return this.activeEditor = new MooEditable.Group.Item(el, this, $merge({toolbar: false}, options));
	}
	
});


MooEditable.Group.Item = new Class({

	Extends: MooEditable,

	initialize: function(el, group, options){
		this.group = group;
		this.parent(el, options);
		var focus = function(){
			this.group.activeEditor = this;
		}.bind(this);
		this.textarea.addEvent('focus', focus);
		this.win.addEvent('focus', focus);
	}

});
{'fraction_non_alphanumeric': 0.13604577240940877, 'fraction_numerical': 0.0006357279084551812, 'mean_word_length': 3.6143695014662756, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2634908', 'n_tokens_mistral': 1067, 'n_tokens_neox': 975, 'n_words': 234}