<commit_before>var dhtmlPopupVars = new Array;
dhtmlPopupVars.currentWin = "";
dhtmlPopupVars.dragging = false;
dhtmlPopupVars.offsetX = 0;
dhtmlPopupVars.offsetY = 0;

function dhtmlDebug(s) {
	var theDiv = document.getElementById("dhtmlMonitor");
	if (theDiv != null) {
		theDiv.innerHTML = s;
	}
}

function dhtmlPopupGetDiv(winName) {
	var theDiv = document.getElementById("dhtmlPopup_" + winName);
	return theDiv;
}

function dhtmlPopupToggle(winName, e) {
	var theDiv = dhtmlPopupGetDiv(winName);
	dhtmlDebug("theDiv for " + winName + " = " + theDiv);
	if (theDiv.style.visibility == "hidden") {
		dhtmlPopupShow(winName, e);
	} else {
		dhtmlPopupHide(winName, e);
	}
}

function dhtmlPopupHide(winName, e) {
	var theDiv = dhtmlPopupGetDiv(winName);
	theDiv.style.visibility = "hidden";
}

function dhtmlPopupShow(winName, e) {
	var theDiv = dhtmlPopupGetDiv(winName);
	dhtmlDebug("e.clientX=" + e.clientX + ", window.pageXOffset=" + window.pageXOffset + ", window.innerWidth=" + window.innerWidth + ", window.pageYOffset=" + window.pageYOffset + ", theDiv.offsetWidth=" + theDiv.offsetWidth + ", theDiv.offsetHeight=" + theDiv.offsetHeight);
	if (e.clientX > 0) {
		theDiv.style.left = (e.clientX - 10) + "px";
		theDiv.style.top = (e.clientY + 15) + "px";<commit_msg>Improve positioning of popup when near the edge or scrolled<commit_after>var dhtmlPopupVars = new Array;
dhtmlPopupVars.currentWin = "";
dhtmlPopupVars.dragging = false;
dhtmlPopupVars.offsetX = 0;
dhtmlPopupVars.offsetY = 0;

function dhtmlDebug(s) {
	var theDiv = document.getElementById("dhtmlMonitor");
	if (theDiv != null) {
		theDiv.innerHTML = theDiv.innerHTML + s;
	}
}

function dhtmlPopupGetDiv(winName) {
	var theDiv = document.getElementById("dhtmlPopup_" + winName);
	return theDiv;
}

function dhtmlPopupToggle(winName, e) {
	var theDiv = dhtmlPopupGetDiv(winName);
	dhtmlDebug("theDiv for " + winName + " = " + theDiv);
	if (theDiv.style.visibility == "hidden") {
		dhtmlPopupShow(winName, e);
	} else {
		dhtmlPopupHide(winName, e);
	}
}

function dhtmlPopupHide(winName, e) {
	var theDiv = dhtmlPopupGetDiv(winName);
	theDiv.style.visibility = "hidden";
}

function dhtmlPopupShow(winName, e) {
	var theDiv = dhtmlPopupGetDiv(winName);
	dhtmlDebug("<br />e.clientX=" + e.clientX + ", window.pageXOffset=" + window.pageXOffset + ", window.innerWidth=" + window.innerWidth + ", window.pageYOffset=" + window.pageYOffset + ", theDiv.offsetWidth=" + theDiv.offsetWidth + ", theDiv.offsetHeight=" + theDiv.offsetHeight);
	if (e.clientX > 0) {
		var maxLeftPos = window.innerWidth - theDiv.offsetWidth;
		var leftPos = e.clientX - 10;
		if (leftPos > maxLeftPos) {
			leftPos = maxLeftPos;
		}
		theDiv.style.left = (leftPos) + "px";
		theDiv.style.top = (window.pageYOffset + e.clientY + 15) + "px";
{'fraction_non_alphanumeric': 0.14459992823824902, 'fraction_numerical': 0.005023322569070686, 'mean_word_length': 5.021598272138229, 'pattern_counts': {'":': 0, '<': 4, '<?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': '5560410', 'n_tokens_mistral': 1029, 'n_tokens_neox': 1029, 'n_words': 191}