<commit_before>moduleAid.VERSION = '1.1.18';

this.__defineGetter__('addonBar', function() { return $('addon-bar'); });
this.__defineGetter__('bottomBox', function() { return $('browser-bottombox'); });
this.__defineGetter__('browserPanel', function() { return $('browser-panel'); });
this.__defineGetter__('gFindBar', function() { return window.gFindBar; });
this.__defineGetter__('toggleAddonBar', function() { return window.toggleAddonBar; });
this.__defineSetter__('toggleAddonBar', function(v) { return window.toggleAddonBar = v; });
this.__defineGetter__('setToolbarVisibility', function() { return window.setToolbarVisibility; });
this.__defineGetter__('appMenu', function() { return $('appmenu_customizeMenu'); });
this.__defineGetter__('viewMenu', function() { return $('viewToolbarsMenu').firstChild; });
this.__defineGetter__('contextMenu', function() { return $('toolbar-context-menu'); });
this.__defineGetter__('contextOptions', function() { return $(objName+'-contextOptions'); });
this.__defineGetter__('contextSeparator', function() { return $(objName+'-contextSeparator'); });
this.getComputedStyle = function(el) { return window.getComputedStyle(el); };

/* This only returns non-null when inURLBar is true */
this.__defineGetter__('URLBarContainer', function() { return $(objName+'-urlbar-addonbar-container'); });

this.CLIPBAR = 5; // ammount of pixels to clip the bar to when it is closed or hidden

this.addonBarContextNodes = {
	get addonBar () { return addonBar; }
};

this._scrollBarWidth = null;
this.__defineGetter__('scrollBarWidth', function() {
	if(_scrollBarWidth === null) {
		var scrollDiv = document.createElement("div");
		scrollDiv.setAttribute('style', 'width: 100px; height: 100px; overflow: scroll; position: fixed; top: -9999px;');
		scrollDiv = browserPanel.appendChild(scrollDiv);
		
		_scrollBarWidth = 100 -scrollDiv.clientWidth;
		
		browserPanel.removeChild(scrollDiv);
	}
	
	return _scrollBarWidth;
});

this.lwthemeImage = null;
this.moveBarStyle = {};

this.doOpenOptions = function() {
	openOptions();
};

// Menus are dynamic, I need to make sure the entries do what they're supposed to if they're changed
this.setContextMenu = function(e) {
	var notHidden = false;
	for(var n in addonBarContextNodes) {
		if(isAncestor(e.originalTarget.triggerNode, addonBarContextNodes[n])) {
			notHidden = true;
			break;
		}
	}
	toggleAttribute(contextOptions, 'hidden', !notHidden);
	toggleAttribute(contextSeparator, 'hidden', !notHidden);
	
	setAttribute(contextMenu.getElementsByAttribute('toolbarId', 'addon-bar')[0], 'command', 'Browser:ToggleAddonBar');
};

this.setViewMenu = function(e) {
	setAttribute(viewMenu.getElementsByAttribute('toolbarId', 'addon-bar')[0], 'command', 'Browser:ToggleAddonBar');
};

this.setAppMenu = function(e) {
	setAttribute(appMenu.getElementsByAttribute('toolbarId', 'addon-bar')[0], 'command', 'Browser:ToggleAddonBar');
};

this.delayMoveAddonBar = function() {
	timerAid.init('delayMoveAddonBar', moveAddonBar, 0);
};

this.moveWhenStatusBarChanged = function() {
	if(isAncestor($('status-bar'), addonBar)) {
		delayMoveAddonBar();
	}
};

this.moveAddonBar = function() {
	// We should do all these calculations to also position the puzzle pieces, even if the add-on bar is closed
	moveBarStyle = {
		maxWidth: -(scrollBarWidth *2),
		left: scrollBarWidth,
		right: scrollBarWidth,
		bottom: 0
	};
	
	var appContentPos = $('content').getBoundingClientRect();
	moveBarStyle.maxWidth += appContentPos.width;
	moveBarStyle.bottom += document.documentElement.clientHeight -appContentPos.bottom;
	moveBarStyle.left += appContentPos.left;
	moveBarStyle.right += document.documentElement.clientWidth -appContentPos.right;
	
	// Firefox 25 introduces per-tab findbars. The findbar is now a part of appcontent, so I have to account for its height as well
	if(Services.vc.compare(Services.appinfo.platformVersion, "25.0a1") >= 0 && !gFindBar.hidden) {
		moveBarStyle.bottom += gFindBar.clientHeight +gFindBar.clientTop;
	}
	
	// Account for the puzzle piece
	moveBarStyle.left += 12;
	moveBarStyle.right += 12;
	
	// Let's try to show it like it's poping up from somewhere when there's something below it
	if(moveBarStyle.bottom > 1) { moveBarStyle.bottom--; }
	
	moveBarStyle.clientHeight = addonBar.clientHeight;
	moveBarStyle.movetoRight = prefAid.movetoRight;
	<commit_msg>bugfix<commit_after>moduleAid.VERSION = '1.1.19';

this.__defineGetter__('addonBar', function() { return $('addon-bar'); });
this.__defineGetter__('bottomBox', function() { return $('browser-bottombox'); });
this.__defineGetter__('browserPanel', function() { return $('browser-panel'); });
this.__defineGetter__('gFindBar', function() { return window.gFindBar; });
this.__defineGetter__('toggleAddonBar', function() { return window.toggleAddonBar; });
this.__defineSetter__('toggleAddonBar', function(v) { return window.toggleAddonBar = v; });
this.__defineGetter__('setToolbarVisibility', function() { return window.setToolbarVisibility; });
this.__defineGetter__('appMenu', function() { return $('appmenu_customizeMenu'); });
this.__defineGetter__('viewMenu', function() { return $('viewToolbarsMenu').firstChild; });
this.__defineGetter__('contextMenu', function() { return $('toolbar-context-menu'); });
this.__defineGetter__('contextOptions', function() { return $(objName+'-contextOptions'); });
this.__defineGetter__('contextSeparator', function() { return $(objName+'-contextSeparator'); });
this.getComputedStyle = function(el) { return window.getComputedStyle(el); };

/* This only returns non-null when inURLBar is true */
this.__defineGetter__('URLBarContainer', function() { return $(objName+'-urlbar-addonbar-container'); });

this.CLIPBAR = 5; // ammount of pixels to clip the bar to when it is closed or hidden

this.addonBarContextNodes = {
	get addonBar () { return addonBar; }
};

this._scrollBarWidth = null;
this.__defineGetter__('scrollBarWidth', function() {
	if(_scrollBarWidth === null) {
		var scrollDiv = document.createElement("div");
		scrollDiv.setAttribute('style', 'width: 100px; height: 100px; overflow: scroll; position: fixed; top: -9999px;');
		scrollDiv = browserPanel.appendChild(scrollDiv);
		
		_scrollBarWidth = 100 -scrollDiv.clientWidth;
		
		browserPanel.removeChild(scrollDiv);
	}
	
	return _scrollBarWidth;
});

this.lwthemeImage = null;
this.moveBarStyle = {};

this.doOpenOptions = function() {
	openOptions();
};

// Menus are dynamic, I need to make sure the entries do what they're supposed to if they're changed
this.setContextMenu = function(e) {
	var notHidden = false;
	for(var n in addonBarContextNodes) {
		if(isAncestor(e.originalTarget.triggerNode, addonBarContextNodes[n])) {
			notHidden = true;
			break;
		}
	}
	toggleAttribute(contextOptions, 'hidden', !notHidden);
	toggleAttribute(contextSeparator, 'hidden', !notHidden);
	
	setAttribute(contextMenu.getElementsByAttribute('toolbarId', 'addon-bar')[0], 'command', 'Browser:ToggleAddonBar');
};

this.setViewMenu = function(e) {
	setAttribute(viewMenu.getElementsByAttribute('toolbarId', 'addon-bar')[0], 'command', 'Browser:ToggleAddonBar');
};

this.setAppMenu = function(e) {
	setAttribute(appMenu.getElementsByAttribute('toolbarId', 'addon-bar')[0], 'command', 'Browser:ToggleAddonBar');
};

this.delayMoveAddonBar = function() {
	timerAid.init('delayMoveAddonBar', moveAddonBar, 0);
};

this.moveWhenStatusBarChanged = function() {
	if(isAncestor($('status-bar'), addonBar)) {
		delayMoveAddonBar();
	}
};

this.moveAddonBar = function() {
	// We should do all these calculations to also position the puzzle pieces, even if the add-on bar is closed
	moveBarStyle = {
		maxWidth: -(scrollBarWidth *2),
		left: scrollBarWidth,
		right: scrollBarWidth,
		bottom: 0
	};
	
	var appContentPos = $('content').getBoundingClientRect();
	moveBarStyle.maxWidth += appContentPos.width;
	moveBarStyle.bottom += document.documentElement.clientHeight -appContentPos.bottom;
	moveBarStyle.left += appContentPos.left;
	moveBarStyle.right += document.documentElement.clientWidth -appContentPos.right;
	
	// Firefox 25 introduces per-tab findbars. The findbar is now a part of appcontent, so I have to account for its height as well
	if(Services.vc.compare(Services.appinfo.platformVersion, "25.0a1") >= 0 && !gFindBar.hidden && !trueAttribute(gFindBar, 'movetotop')) {
		moveBarStyle.bottom += gFindBar.clientHeight +gFindBar.clientTop;
	}
	
	// Account for the puzzle piece
	moveBarStyle.left += 12;
	moveBarStyle.right += 12;
	
	// Let's try to show it like it's poping up from somewhere when there's something below it
	if(moveBarStyle.bottom > 1) { moveBarStyle.bottom--; }
	
	moveBarStyle.clientHeight = addonBar.clientHeight;
	moveBarStyle.movetoRight = prefAid.movetoRight;
	
{'fraction_non_alphanumeric': 0.14495076711701396, 'fraction_numerical': 0.0082436455232425, 'mean_word_length': 6.090097402597403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1059526', 'n_tokens_mistral': 2798, 'n_tokens_neox': 2684, 'n_words': 586}