<commit_before>/**/

var doc = document;
var win = window;

var xtnd = function xtnd(){
	for(var i = 1; i < arguments.length; i++) {
		for (var key in arguments[i]){
			if(arguments[i].hasOwnProperty(key)) {
				arguments[0][key] = arguments[i][key];
			}
		}
	}
	return arguments[0];
};



function BrotCtrl(){
	this.elems = {};
	xtnd(this.elems, {
		z: doc.getElementById('zoom'),
		x: doc.getElementById('xOffset'),
		y: doc.getElementById('yOffset'),
		i: doc.getElementById('iterations'),
		t: doc.getElementById('renderTime')
	});
}

xtnd(BrotCtrl.prototype, {
	Z:function(){ return parseInt(this.elems.z.value) },
	X:function(){ return parseFloat(this.elems.x.value) },
	Y:function(){ return parseFloat(this.elems.y.value) },
	I:function(){ return parseInt(this.elems.i.value) },
	T:function(){ return parseInt(this.elems.t.value) },

	dsbl:function(){
		for (var key in this.elems){
			if (this.elems.hasOwnProperty(key)){
				this.elems[key].setAttribute('disabled','disabled');
			}
		}
	},
	enbl:function(){
		for (var key in this.elems) {
			if (this.elems.hasOwnProperty(key)) {
				this.elems[key].removeAttribute('disabled');
			}
		}
	},
	setSteps:function(){
		var zoom = this.Z();
		var cStep = 0.5 / zoom;
		var zStep = Math.abs(Math.ceil(zoom / 10) || 1);

		if (cStep) {
			this.elems.x.setAttribute('step', cStep + '');
			this.elems.y.setAttribute('step', cStep + '');
		}

		this.elems.z.setAttribute('step', zStep + '');

	},
	setEvents:function(){
		for (var key in this.elems) {
			if(this.elems.hasOwnProperty(key)) {
				this.elems[key].addEventListener('change', function(){
					this.brot.update();
				});
			}
		}

		var Key = { UP:38, RIGHT:39, DOWN:40, LEFT:37 };

		var ctrl = this;
		win.addEventListener('keydown',function(e){
			if (e.ctrlKey) {
				switch (e.keyCode) {
					case Key.UP:    ctrl.elems.z.value = ctrl.Z() + parseFloat(ctrl.elems.z.step); break;
					case Key.DOWN:  ctrl.elems.z.value = ctrl.Z() - parseFloat(ctrl.elems.z.step); break;
					case Key.LEFT:  ctrl.elems.i.value = ctrl.I() - parseFloat(ctrl.elems.i.step); break;
					case Key.RIGHT: ctrl.elems.i.value = ctrl.I() + parseFloat(ctrl.elems.i.step); break;
				}
			} else {
				switch (e.keyCode) {
					case Key.UP:    ctrl.elems.y.value = ctrl.Y() + parseFloat(ctrl.elems.y.step); break;
					case Key.DOWN:  ctrl.elems.y.value = ctrl.Y() - parseFloat(ctrl.elems.y.step); break;
					case Key.LEFT:  ctrl.elems.x.value = ctrl.X() + parseFloat(ctrl.elems.x.step); break;
					case Key.RIGHT: ctrl.elems.x.value = ctrl.X() - parseFloat(ctrl.elems.x.step); break;
				}
			}

			if (([37, 38, 39, 40]).indexOf(e.keyCode) != -1 ) {
				this.brot.update();<commit_msg>Update brot.js<commit_after>/* <NAME> 2013*/

var doc = document;
var win = window;

var xtnd = function xtnd(){
	for(var i = 1; i < arguments.length; i++) {
		for (var key in arguments[i]){
			if(arguments[i].hasOwnProperty(key)) {
				arguments[0][key] = arguments[i][key];
			}
		}
	}
	return arguments[0];
};



function BrotCtrl(){
	this.elems = {};
	xtnd(this.elems, {
		z: doc.getElementById('zoom'),
		x: doc.getElementById('xOffset'),
		y: doc.getElementById('yOffset'),
		i: doc.getElementById('iterations'),
		t: doc.getElementById('renderTime')
	});
}

xtnd(BrotCtrl.prototype, {
	Z:function(){ return parseInt(this.elems.z.value) },
	X:function(){ return parseFloat(this.elems.x.value) },
	Y:function(){ return parseFloat(this.elems.y.value) },
	I:function(){ return parseInt(this.elems.i.value) },
	T:function(){ return parseInt(this.elems.t.value) },

	dsbl:function(){
		for (var key in this.elems){
			if (this.elems.hasOwnProperty(key)){
				this.elems[key].setAttribute('disabled','disabled');
			}
		}
	},
	enbl:function(){
		for (var key in this.elems) {
			if (this.elems.hasOwnProperty(key)) {
				this.elems[key].removeAttribute('disabled');
			}
		}
	},
	setSteps:function(){
		var zoom = this.Z();
		var cStep = 0.5 / zoom;
		var zStep = Math.abs(Math.ceil(zoom / 10) || 1);

		if (cStep) {
			this.elems.x.setAttribute('step', cStep + '');
			this.elems.y.setAttribute('step', cStep + '');
		}

		this.elems.z.setAttribute('step', zStep + '');

	},
	setEvents:function(){
		for (var key in this.elems) {
			if(this.elems.hasOwnProperty(key)) {
				this.elems[key].addEventListener('change', function(){
					win.brot.update();
				});
			}
		}

		var Key = { UP:38, RIGHT:39, DOWN:40, LEFT:37 };

		var ctrl = this;
		win.addEventListener('keydown',function(e){
			if (e.ctrlKey) {
				switch (e.keyCode) {
					case Key.UP:    ctrl.elems.z.value = ctrl.Z() + parseFloat(ctrl.elems.z.step); break;
					case Key.DOWN:  ctrl.elems.z.value = ctrl.Z() - parseFloat(ctrl.elems.z.step); break;
					case Key.LEFT:  ctrl.elems.i.value = ctrl.I() - parseFloat(ctrl.elems.i.step); break;
					case Key.RIGHT: ctrl.elems.i.value = ctrl.I() + parseFloat(ctrl.elems.i.step); break;
				}
			} else {
				switch (e.keyCode) {
					case Key.UP:    ctrl.elems.y.value = ctrl.Y() + parseFloat(ctrl.elems.y.step); break;
					case Key.DOWN:  ctrl.elems.y.value = ctrl.Y() - parseFloat(ctrl.elems.y.step); break;
					case Key.LEFT:  ctrl.elems.x.value = ctrl.X() + parseFloat(ctrl.elems.x.step); break;
					case Key.RIGHT: ctrl.elems.x.value = ctrl.X() - parseFloat(ctrl.elems.x.step); break;
				}
			}

			if (([37, 38, 39, 40]).indexOf(e.keyCode) != -1 ) {
				this.brot.update();
{'fraction_non_alphanumeric': 0.19468203793231684, 'fraction_numerical': 0.01004090740052064, 'mean_word_length': 3.412633305988515, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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': '3332513', 'n_tokens_mistral': 2327, 'n_tokens_neox': 2056, 'n_words': 358}