<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', {
	'padding': [0, 8, 0, 10]
});

ART.Sheet.define('window.art.browser:hidden history.art', {
	'padding': [0, 8, 0, 10],
	'display':'none'
}, 'css');

ART.Sheet.define('window.art.browser history.art', {
	'top':30,
	'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:dragging history.art', {
	'display': 'none'
}, 'css');

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


ART.Sheet.define('window.art.browser history.art divot', {
	'color': hsb(0, 0, 66)
});
ART.Sheet.define('window.art.browser:focused history.art divot', {
	'color': hsb(0, 0, 33)
});

ART.Browser = new Class({

	Extends: ART.Window,

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

	_build: function(){
		this.parent.apply(this, arguments);
		var styles = this.getSheet();
		this.history = new ART.History(
			$merge(this.options.historyOptions, {
				styles: {
					width: styles.width
				}
			})
		).inject(this, this.header);
		this.header.setStyles({
			'overflow': styles.headerOverflow
		});
		this.addEvents({
			shade: function() {
				this._dragging = true;
			},
			unshade: function(){
				this._dragging = false;
				this.history.resize(this.currentWidth);
			},
			focus: function(){
				this.history.enable();
			},
			blur: function(){
				this.history.disable();
			},
			minimize: function(){
				this.history.resize(this.currentWidth);
			},
			maximize: function(){
				this.history.resize(this.currentWidth);
			}
		});
	}

});

ART.WindowTools.implement({

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

});<commit_msg>have to introduce a delay for resizing history while the window draws itself.<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', {
	'padding': [0, 8, 0, 10]
});

ART.Sheet.define('window.art.browser:hidden history.art', {
	'padding': [0, 8, 0, 10],
	'display':'none'
}, 'css');

ART.Sheet.define('window.art.browser history.art', {
	'top':30,
	'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:dragging history.art', {
	'display': 'none'
}, 'css');

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


ART.Sheet.define('window.art.browser history.art divot', {
	'color': hsb(0, 0, 66)
});
ART.Sheet.define('window.art.browser:focused history.art divot', {
	'color': hsb(0, 0, 33)
});

ART.Browser = new Class({

	Extends: ART.Window,

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

	_build: function(){
		this.parent.apply(this, arguments);
		var styles = this.getSheet();
		this.history = new ART.History(
			$merge(this.options.historyOptions, {
				styles: {
					width: styles.width
				}
			})
		).inject(this, this.header);
		this.header.setStyles({
			'overflow': styles.headerOverflow
		});
		
		var sizerTimer;
		var sizer = function(){
			//have to delay here because this.currentWidth isn't defined
			//until after draw, which is also delayed
			$clear(sizerTimer);
			sizerTimer = (function(){
				this.history.resize(this.currentWidth);
			}).delay(1, this);
		}.bind(this);
		this.addEvents({
			shade: function() {
				this._dragging = true;
			},
			unshade: function(){
				this._dragging = false;
				sizer();
			},
			focus: function(){
				this.history.enable();
			},
			blur: function(){
				this.history.disable();
			},
			minimize: sizer,
			maximize: sizer,
			resize: sizer,
			show: sizer
		});
	}

});

ART.WindowTools.implement({

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

});
{'fraction_non_alphanumeric': 0.18916415836999306, 'fraction_numerical': 0.013660569576290808, 'mean_word_length': 3.736842105263158, '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': '2241347', 'n_tokens_mistral': 1753, 'n_tokens_neox': 1526, 'n_words': 303}