<commit_before>/*
---
name: ART.Browser
description: A window with navigation controls.
requires: [ART.Window, ART.History]
provides: ART.Browser
...
*/

ART.Sheet.define('window.art.browser', {
	'header-height': 60,
	'header-overflow': 'visible'
});

ART.Sheet.define('window.art.browser history.art', {
	'top':30,
	'padding': '0 8px 0 10px'
}, 'css');

ART.Sheet.define('window.art.browser history.art button.art', {
	'shadow-color': hsb(0, 0, 100, 0.4)
});

ART.Sheet.define('window.art.browser history.art input', {
	'left': 58
}, 'css');

ART.Sheet.define('window.art.browser history.art input.disabled', {
	'left': 58
}, 'css');

ART.Sheet.define('window.art.browser:dragging history.art', {
	'display': 'none'
}, 'css');

ART.Sheet.define('window.art.browser history.art', {
	'display': 'block'
}, 'css');

ART.Browser = new Class({

	Extends: ART.Window,

	options: {
		className: 'art browser',
		historyOptions: {
			className: 'art browser',
			editable: false
		}
	},

	_build: function(){
		this.parent.apply(this, arguments);
		this.history = new ART.History(this.options.historyOptions).setState('hidden', true).inject(this, this.header);
		this.history._firstHidden = true;
		document.id(this.history).setStyle('opacity', 0);
		var styles = ART.Sheet.lookup(this.toString());
		this.header.setStyles({
			'overflow': styles.headerOverflow
		});
		this.history.resize();
		this.addEvent('shade', function(dragging) {
			this._dragging = dragging;
			if (!dragging) this.history.resize();
		}.bind(this));
	},

	resize: function(){
		this.parent.apply(this, arguments);
		if (this.history && !this._dragging) this.history.resize();
	},

	show: function() {
		var ret = this.parent.apply(this, arguments);
		if (this.history) this.history.resize();
		return ret;
	},

	draw: function(){
		this.parent.apply(this, arguments);
		if (this.history._firstHidden) {
			this.history._firstHidden = false;
			document.id(this.history).setStyle('opacity', 1);
		}
	}

});

ART.WindowTools.implement({

	getHistory: function() {
		return this.getWindow().history;
	}
<commit_msg>the history element in art.browser should be absolutely positioned<commit_after>/*
---
name: ART.Browser
description: A window with navigation controls.
requires: [ART.Window, ART.History]
provides: ART.Browser
...
*/

ART.Sheet.define('window.art.browser', {
	'header-height': 60,
	'header-overflow': 'visible'
});

ART.Sheet.define('window.art.browser history.art', {
	'top':30,
	'padding': '0 8px 0 10px',
	'position': 'absolute'
}, 'css');

ART.Sheet.define('window.art.browser history.art button.art', {
	'shadow-color': hsb(0, 0, 100, 0.4)
});

ART.Sheet.define('window.art.browser history.art input', {
	'left': 58
}, 'css');

ART.Sheet.define('window.art.browser history.art input.disabled', {
	'left': 58
}, 'css');

ART.Sheet.define('window.art.browser:dragging history.art', {
	'display': 'none'
}, 'css');

ART.Sheet.define('window.art.browser history.art', {
	'display': 'block'
}, 'css');

ART.Browser = new Class({

	Extends: ART.Window,

	options: {
		className: 'art browser',
		historyOptions: {
			className: 'art browser',
			editable: false
		}
	},

	_build: function(){
		this.parent.apply(this, arguments);
		this.history = new ART.History(this.options.historyOptions).setState('hidden', true).inject(this, this.header);
		this.history._firstHidden = true;
		document.id(this.history).setStyle('opacity', 0);
		var styles = ART.Sheet.lookup(this.toString());
		this.header.setStyles({
			'overflow': styles.headerOverflow
		});
		this.addEvent('shade', function(dragging) {
			this._dragging = dragging;
			if (!dragging) this.history.resize();
		}.bind(this));
	},

	_resizeHistory: function(){
		var delta = 0;
		['margin-left', 'margin-right', 'padding-left', 'padding-right'].each(function(dim) {
			delta += $(this.history).getStyle(dim).toInt();
		}, this);
		this.history.resize(this.currentWidth - delta);
	},

	resize: function(){
		this.parent.apply(this, arguments);
		if (this.history && !this._dragging) this._resizeHistory();
	},

	show: function() {
		var ret = this.parent.apply(this, arguments);
		if (this.history) this._resizeHistory();
		return ret;
	},

	draw: function(){
		this.parent.apply(this, arguments);
		if (this.history._firstHidden) {
			this.history._firstHidden = false;
			this._resizeHistory();
			document.id(this.history).setStyle('opacity', 1);
		}
	}

});

ART.WindowTools.implement({

	getHistory: function() {
		return this.getWindow().history;
	}

{'fraction_non_alphanumeric': 0.18776418242491658, 'fraction_numerical': 0.010011123470522803, 'mean_word_length': 4.423401688781665, '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': '4712462', 'n_tokens_mistral': 1665, 'n_tokens_neox': 1529, 'n_words': 294}