<commit_before><commit_msg>Create navbar.js<commit_after>var Navbar = function(el) {
	var menu = (typeof el === 'object') ? el : queryElement(el), self = this,
		items = menu.getElementsByTagName('LI'), il = items.length;
	
	// methods
	this.init = function(l) {
		l.addEventListener("mouseenter", this.enter, false);
		l.addEventListener("mouseleave", this.leave, false);	
	},
	this.enter = function() {
		if (/in/.test(menu.parentNode.className)) {return;} 
          
          var that = this; // this is now the event target, the LI
		clearTimeout(this.getAttribute('data-timer'));
		if ( !/open/.test(this.className) ) {
			self.timer = setTimeout( function() {

                  addClass(that,'open'); 
                  addClass(that,'open-position');                        

				var s = that.parentNode.childNodes; //all parentNode children
				for ( var h=0; h<s.length; h++ ) {
					if ( s[h] && s[h].className && /open/.test(s[h].className) && s[h] !== that ) {//siblings only
						var _s = s[h];					
						if (!isIE) {
							removeClass(_s,'open'); setTimeout( function() { removeClass(_s,'open-position'); }, 150 ); 
						} else {
							removeClass(_s,'open-position'); removeClass(_s,'open'); 
						}
					}	
				}
			}, 100 );	
			this.setAttribute('data-timer',self.timer);
		}
	},

	this.leave = function() {
		if (/in/.test(menu.parentNode.className)) {return;}
          var that = this;
		clearTimeout(this.getAttribute('data-timer'));
		self.timer = setTimeout( function() {
			if (that && that.className && /open/.test(that.className) && that.querySelector('.form-control') !== document.activeElement ) {
				removeClass(that,'open');
				setTimeout(function(){ removeClass(that,'open-position'); }, (isIE ? 0 : 200))
			}
		}, 500);
		this.setAttribute('data-timer',self.timer);	
	},
	this.timer = null;

	for ( var i=0; i<il; i++ ) {
		this.init(items[i]);
	}	

};

{'fraction_non_alphanumeric': 0.18598524762908325, 'fraction_numerical': 0.007903055848261328, 'mean_word_length': 2.8993839835728954, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3243072', 'n_tokens_mistral': 710, 'n_tokens_neox': 613, 'n_words': 118}