<commit_before>/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License.  
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * searchAndFacet_primer: callbacks for the autocomplete and sidebar widgets
 * see: autocompleteWidget.js and sideBarFacetWidget.js
 * 
 */
$(document).ready(function(){
	'use strict';	
	
	$('span.facetCount').text(''); // default when page loads

	//var pathname = MPI2.searchAndFacetConfig.pathname;
	
	$('input#userInput').val('');  // clears input when pages loads
	
	// default search when search page loads
	if ( /search$/.exec(location.href) ){
		// do default gene search by * when search page loads
		$.fn.fetchSolrFacetCount('*:*');
	}
	else if ( location.href.indexOf('/search#') != -1 ){		
		// load page based on url hash parameters		
		var hashParams = $.fn.parseHashString(window.location.hash.substring(1));	
		$.fn.fetchSolrFacetCount(hashParams.q);
	}
	
	// search via ENTER
	$('input#userInput').keyup(function (e) {		
	    if (e.keyCode == 13) { // user hits enter
	    	var input = $('input#userInput').val();	      
	    	input = input == '' ? '*:*' : input;	    	    	
	    	document.location.href = baseUrl + '/search#q=' + input;
	    }
	}).click(function(){
		$(this).val(''); // clears input 
	});
	
	// search via button click
	$('button#acSearch').click(function(){
		var input = $('input#userInput').val();
		input = input == '' ? '*:*' : input;			
		document.location.href = baseUrl + '/search#q=' + input;
	});
			
	// auto-complete is always created
	// load total facetCount of all data types by default when searchAndFacet page loads
	/*window.jQuery('input#userInput').mpi2AutoComplete({
		
			solrBaseURL_bytemark: MPI2.searchAndFacetConfig.solrBaseURL_bytemark,			
			solrBaseURL_ebi: MPI2.searchAndFacetConfig.solrBaseURL_ebi,
			search_pathname: pathname,			        
			
			loadSideBar: function(event, data){					
				//console.log('loadSideBar: q: '+ data.q + ' core: ' + data.core + ' fq: ' + data.fq);
				// calls left side bar widget	
						
				window.jQuery('div#leftSideBar').mpi2LeftSideBar({  
					data: data, // key q: query string
			        geneGridElem: 'div#mpi2-search'			                                      
				});				
			},
			redirectedSearch: function(event, data){				
				// Make a hidden form on your page, and submit it here.
					
			    var form = "<form id='hiddenSrch' action='" + pathname + "' method='get'>"				
			    		 + "<input type='text' name='core' value='" + data.core + "'>"
			             + "<input type='text' name='fq' value=" + encodeURI(data.fq) + ">"			                                
			             + "<input type='text' name='q' value='" + data.q + "'>"
			             + "</form>";                     

			    window.jQuery('div#bannerSearch').append(form);
			    window.jQuery('form#hiddenSrch').hide().submit();			    
		   } 
		}).click(function(){
				window.jQuery(this).val('');
				//$('span.facetCount').text('');			
	}); */<commit_msg>Adding new file to Git<commit_after>/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License.  
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * searchAndFacet_primer: callbacks for the autocomplete and sidebar widgets
 * see: autocompleteWidget.js and sideBarFacetWidget.js
 * 
 */
$(document).ready(function(){
	'use strict';	
	
	$('span.facetCount').text(''); // default when page loads

	//var pathname = MPI2.searchAndFacetConfig.pathname;
	
	$('input#userInput').val('');  // clears input when pages loads
	
	// default search when search page loads
	if ( /search$/.exec(location.href) ){
		// do default gene search by * when search page loads
		$.fn.fetchSolrFacetCount('*:*');
	}
	else if ( location.href.indexOf('/search#') != -1 ){		
		// load page based on url hash parameters		
		var hashParams = $.fn.parseHashString(window.location.hash.substring(1));	
		$.fn.fetchSolrFacetCount(hashParams.q);
	}
	
	// search via ENTER
	$('input#userInput').keyup(function (e) {		
	    if (e.keyCode == 13) { // user hits enter
	    	var input = $('input#userInput').val();
	    	if (input == ''){
	    		document.location.href = baseUrl + '/search';
	    	}
	    	else {
	    		document.location.href = baseUrl + '/search#q=' + input;
	    	}
	    }
	}).click(function(){
		$(this).val(''); // clears input 
	});
	
	// search via button click
	$('button#acSearch').click(function(){
		var input = $('input#userInput').val();
		if (input == ''){
    		document.location.href = baseUrl + '/search';
    	}
    	else {
    		document.location.href = baseUrl + '/search#q=' + input;
    	}		
	});		

{'fraction_non_alphanumeric': 0.14715302491103202, 'fraction_numerical': 0.006939501779359431, 'mean_word_length': 2.85, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3108258', 'n_tokens_mistral': 1921, 'n_tokens_neox': 1684, 'n_words': 476}