<commit_before>// VERSION 2.0.1

this.S4E = {
	state: false,

	get progress () { return $('urlbar-progress-alt'); },

	handleEvent: function(e) {
		switch(e.type) {
			// focusing forces a Top style, but bluring sometimes doesn't revert back to the original style,
			// I have no idea how _pmpack is lost though
			case 'LoadedSlimChrome':
			case 'UnloadedSlimChrome':
			case 'blur':
			case 'focus':
				if(gURLBar._pmpack === null) {
					switch(Prefs['progress.urlbar']) {
						case 1:
							gURLBar.pmpack = "end";
							break;
						case 2:
							gURLBar.pmpack = "begin";
							break;
						case 3:
							gURLBar.pmpack = "center";
							break;
						default: break;
					}
				}
				break;
		}
	},

	attrWatcher: function() {
		if(!Prefs.includeNavBar) { return; }

		var current = this.progress && !this.progress.hidden && !this.progress.collapsed;
		this.state = current;
		if(typeof(slimChrome) != 'undefined') {
			if(this.state) {
				// show immediately when progress bar becomes visible
				slimChrome.setMini(true);
			} else if(!slimChrome.onTabSelect()) {
				// don't hide immediately when page load ends
				Timers.init('setMini', () => { slimChrome.hideMiniInABit(); }, 2000);
			}
		}
	}
};

Modules.LOADMODULE = function() {
	Prefs.setDefaults({ ['progress.urlbar']: 1 }, 'status4evar', '');

	Styles.load('S4E', 'S4E');

	Watchers.addAttributeWatcher(S4E.progress, 'hidden', S4E, false, false);
	Watchers.addAttributeWatcher(S4E.progress, 'collapsed', S4E, false, false);
	Watchers.addAttributeWatcher(S4E.progress, 'value', S4E, false, false);

	Listeners.add(window, 'LoadedSlimChrome', S4E);
	Listeners.add(window, 'UnloadedSlimChrome', S4E);
	Listeners.add(gURLBar, 'blur', S4E, true);<commit_msg>fix compatibility with S4E<commit_after>// VERSION 2.0.2

this.S4E = {
	state: false,

	get progress () { return $('urlbar-progress-alt'); },

	handleEvent: function(e) {
		switch(e.type) {
			// focusing forces a Top style, but bluring sometimes doesn't revert back to the original style,
			// I have no idea how _pmpack is lost though
			case 'LoadedSlimChrome':
			case 'UnloadedSlimChrome':
			case 'blur':
			case 'focus':
				if(gURLBar._pmpack === null) {
					switch(Prefs['progress.urlbar']) {
						case 1:
							gURLBar.pmpack = "end";
							break;
						case 2:
							gURLBar.pmpack = "begin";
							break;
						case 3:
							gURLBar.pmpack = "center";
							break;
						default: break;
					}
				}
				break;
		}
	},

	attrWatcher: function() {
		if(!Prefs.includeNavBar) { return; }

		var current = this.progress && !this.progress.hidden && !this.progress.collapsed;
		this.state = current;
		if(typeof(slimChrome) != 'undefined') {
			if(this.state) {
				// show immediately when progress bar becomes visible
				slimChrome.setMini(true);
			} else if(!slimChrome.onTabSelect()) {
				// don't hide immediately when page load ends
				Timers.init('setMini', () => { slimChrome.hideMiniInABit(); }, 2000);
			}
		}
	}
};

Modules.LOADMODULE = function() {
	Prefs.setDefaults({ ['progress.urlbar']: 1 }, 'caligon.s4e');

	Styles.load('S4E', 'S4E');

	Watchers.addAttributeWatcher(S4E.progress, 'hidden', S4E, false, false);
	Watchers.addAttributeWatcher(S4E.progress, 'collapsed', S4E, false, false);
	Watchers.addAttributeWatcher(S4E.progress, 'value', S4E, false, false);

	Listeners.add(window, 'LoadedSlimChrome', S4E);
	Listeners.add(window, 'UnloadedSlimChrome', S4E);
	Listeners.add(gURLBar, 'blur', S4E, true);
{'fraction_non_alphanumeric': 0.15243025596778834, 'fraction_numerical': 0.014092608570606844, 'mean_word_length': 3.4249363867684477, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6707577', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1239, 'n_words': 268}