<commit_before>var clickEvent={
	runAnalytics : [],
	assignCallback : function(func)
	{
		this.runAnalytics=func;	
	}
};

function callAjax(url, callbackFunction) {

    var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            callbackFunction(xmlhttp.responseText);
        }
    }

    xmlhttp.open("GET", url, true);
    xmlhttp.send();
}

function visitArray(arr, visitor) {
    var result = [];

    for (var i = 0; i < arr.length; i++) {
        result[i] = visitor(arr[i]);
    }

    return result;
}

function renderBadge(key, badgeData)
{
	var outString="<div class=\"paper-badge\"><p>"+key+"</p>";
	var all=badgeData.split(";");
	outString+="<img style=\'max-width: 8em\' src='"+all[0]+"' />";
	outString+="<p>"+all[1]+"</p></div>";

	return outString;
}

function createBadgeJSON(badgeData)
{
	var all=badgeData.split(";");
	var all1=all[0].split("@");
	var imageUrl="\"imageUrl\":\""+all1[1]+"\"";
	var taxon="\"taxonomyClass\":\""+all1[0].split("_").join(" ")+"\"";
	var all2="{"+imageUrl+","+taxon+",\"authorList\":"+"[\""+all[1].split(",").join("\",\"")+"\"]}";

	return all2;
}

function insertCSS()
{
	return ".paper-badge {float: left; width: 10em; height: 20em; overflow: hidden; border-top: 1px solid #ccc; height 15em; padding: 2%; margin-right: 1%; margin-top: 2%}.badge-span {width: 15em; display: inline-block; font-size: 88%; line-height: 1.2; color: #333; padding: 0.4em; cursor: hand; cursor: pointer}.paper-badge img {margin-left: 10%; margin-bottom: 1%}.badges-active {color: #fff !important; background: #7ab441}.paper-badges-hidden {display: none}";
}

function showLine(event)
{
	var bindBadge=this.getAttribute("data-bind-badge");
	
	if(event.type=="click") {clickEvent.runAnalytics({"orcid" : bindBadge, "taxonomyClass" : this.getAttribute("data-bind-taxonomy")});}

	//var boundElem=$(".badge span[data-bind-badge="+bindBadge+"]");
	//boundElem.attr("title", "badge count: "+boundElem.length+"; ORCID: "+bindBadge.split("\_").join(" "));
	var allElems=document.getElementsByClassName("badge-span");
	visitArray(allElems, function(item){if(item.getAttribute("data-bind-badge") == bindBadge){item.className = "badge-span badges-active"; item.setAttribute("title", "ORCID: "+bindBadge.split("\_").join(" "));}else item.className = "badge-span";});
}

function nextAction()
{
	var bindBadge=this.getAttribute("data-bind-badge");
	window.open("http://orcid.org/"+bindBadge, "orcid");
}

function splitArray(arr, lookGroup, taxonomyClass)
{
	var ttt="";

	for(var i=0, arrLen=arr.length; i<arrLen; i++)
		{
		var noIn=lookGroup[arr[i]];
		ttt+="<span class=\"badge-span\" data-bind-badge='"+arr[i]+"' data-bind-taxonomy='"+taxonomyClass+"'>"+noIn.split("_").join(" ")+"</span>";
		}

	return ttt;
}

function showBadgeFurniture(confIn)
{
	var furnitureClass=(confIn["furniture-class"]) ? confIn["furniture-class"] : "paper-badges-hidden";
	var doi=confIn["article-doi"];
		
	callAjax("https://badges.mozillascience.org/papers/"+doi+"/badges/count", function(dataItem){
		var badgesCount=(dataItem) ? dataItem : 0;
		
		if(badgesCount && dataItem/dataItem)
			{
			visitArray(document.querySelectorAll("."+furnitureClass), function(elem){
				
				if(elem.classList.contains(furnitureClass))
					{
					elem.classList.remove(furnitureClass);	
					}
			});
			}
	});
}

function showBadges(confIn, callback){

	var k="";

	var containerClass=(confIn["container-class"]) ? confIn["container-class"] : "badge-container";
	var doi=confIn["article-doi"];<commit_msg>IE9 bug fix to ensure site furniture shows correctly.<commit_after>var clickEvent={
	runAnalytics : [],
	assignCallback : function(func)
	{
		this.runAnalytics=func;	
	}
};

function callAjax(url, callbackFunction) {

    var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            callbackFunction(xmlhttp.responseText);
        }
    }

    xmlhttp.open("GET", url, true);
    xmlhttp.send();
}

function visitArray(arr, visitor) {
    var result = [];

    for (var i = 0; i < arr.length; i++) {
        result[i] = visitor(arr[i]);
    }

    return result;
}

function renderBadge(key, badgeData)
{
	var outString="<div class=\"paper-badge\"><p>"+key+"</p>";
	var all=badgeData.split(";");
	outString+="<img style=\'max-width: 8em\' src='"+all[0]+"' />";
	outString+="<p>"+all[1]+"</p></div>";

	return outString;
}

function createBadgeJSON(badgeData)
{
	var all=badgeData.split(";");
	var all1=all[0].split("@");
	var imageUrl="\"imageUrl\":\""+all1[1]+"\"";
	var taxon="\"taxonomyClass\":\""+all1[0].split("_").join(" ")+"\"";
	var all2="{"+imageUrl+","+taxon+",\"authorList\":"+"[\""+all[1].split(",").join("\",\"")+"\"]}";

	return all2;
}

function insertCSS()
{
	return ".paper-badge {float: left; width: 10em; height: 20em; overflow: hidden; border-top: 1px solid #ccc; height 15em; padding: 2%; margin-right: 1%; margin-top: 2%}.badge-span {width: 15em; display: inline-block; font-size: 88%; line-height: 1.2; color: #333; padding: 0.4em; cursor: hand; cursor: pointer}.paper-badge img {margin-left: 10%; margin-bottom: 1%}.badges-active {color: #fff !important; background: #7ab441}.paper-badges-hidden {display: none}";
}

function showLine(event)
{
	var bindBadge=this.getAttribute("data-bind-badge");
	
	if(event.type=="click") {clickEvent.runAnalytics({"orcid" : bindBadge, "taxonomyClass" : this.getAttribute("data-bind-taxonomy")});}

	//var boundElem=$(".badge span[data-bind-badge="+bindBadge+"]");
	//boundElem.attr("title", "badge count: "+boundElem.length+"; ORCID: "+bindBadge.split("\_").join(" "));
	var allElems=document.getElementsByClassName("badge-span");
	visitArray(allElems, function(item){if(item.getAttribute("data-bind-badge") == bindBadge){item.className = "badge-span badges-active"; item.setAttribute("title", "ORCID: "+bindBadge.split("\_").join(" "));}else item.className = "badge-span";});
}

function nextAction()
{
	var bindBadge=this.getAttribute("data-bind-badge");
	window.open("http://orcid.org/"+bindBadge, "orcid");
}

function splitArray(arr, lookGroup, taxonomyClass)
{
	var ttt="";

	for(var i=0, arrLen=arr.length; i<arrLen; i++)
		{
		var noIn=lookGroup[arr[i]];
		ttt+="<span class=\"badge-span\" data-bind-badge='"+arr[i]+"' data-bind-taxonomy='"+taxonomyClass+"'>"+noIn.split("_").join(" ")+"</span>";
		}

	return ttt;
}

function showBadgeFurniture(confIn)
{
	var furnitureClass=(confIn["furniture-class"]) ? confIn["furniture-class"] : "paper-badges-hidden";
	var doi=confIn["article-doi"];
		
	callAjax("https://badges.mozillascience.org/papers/"+doi+"/badges/count", function(dataItem){
		var badgesCount=(dataItem) ? dataItem : 0;
		
		if(badgesCount && dataItem/dataItem)
			{
			visitArray(document.querySelectorAll("."+furnitureClass), function(elem){
				var list=elem.classList;
					
				if(list!==undefined && list.contains(furnitureClass))
					{
					list.remove(furnitureClass);	
					}
				else
					{
					var className=elem.className;
					var indStart=className.indexOf(furnitureClass);
					var indEnd=className.indexOf(" ", indStart);
	
					indEnd=(indEnd>=0) ? indEnd : className.length;
					elem.className=className.substring(0, indStart)+" "+className.substring(indEnd);
					}	
			});
			}
	});
}

function showBadges(confIn, callback){

	var k="";

	var containerClass=(confIn["container-class"]) ? confIn["container-class"] : "badge-container";
	var doi=confIn["article-doi"];
{'fraction_non_alphanumeric': 0.2090755428422832, 'fraction_numerical': 0.012612144064490963, 'mean_word_length': 4.94435857805255, 'pattern_counts': {'":': 6, '<': 25, '<?xml version=': 0, '>': 22, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '2872545', 'n_tokens_mistral': 2971, 'n_tokens_neox': 2753, 'n_words': 450}