<commit_before>let timeoutId = null;
let currentTooltip = null;
let cursorX = 0;
let cursorY = 0;

function initTooltip(container) {
    disableCssTooltips(container);
    trackMousePosition();

    let nodes = container.querySelectorAll('.qp-node');

    for (let i = 0; i < nodes.length; i++) {
        let node = nodes[i];
        node.addEventListener("mouseover", function() {
            timeoutId = window.setTimeout(function () {
                currentTooltip = container.querySelector(".qp-tt").cloneNode(true);
                document.body.appendChild(currentTooltip);
                currentTooltip.style.left = cursorX + 'px';
                currentTooltip.style.top = cursorY + 'px';
            }, 500);
        });
        node.addEventListener("mouseout", function () {
            window.clearTimeout(timeoutId);
            if (currentTooltip != null) {
                document.body.removeChild(currentTooltip);
                currentTooltip = null;
            }<commit_msg>Tooltip fixes.<commit_after>let timeoutId = null;
let currentTooltip = null;
let cursorX = 0;
let cursorY = 0;

function initTooltip(container) {
    disableCssTooltips(container);
    trackMousePosition();

    let nodes = container.querySelectorAll('.qp-node');

    for (let i = 0; i < nodes.length; i++) {
        let node = nodes[i];
        node.addEventListener("mouseover", function() {
            if (timeoutId != null) {
                return;
            }
            timeoutId = window.setTimeout(function () {
                currentTooltip = container.querySelector(".qp-tt").cloneNode(true);
                document.body.appendChild(currentTooltip);
                currentTooltip.style.left = cursorX + 'px';
                currentTooltip.style.top = cursorY + 'px';
            }, 500);
        });
        node.addEventListener("mouseout", function (event) {
            // http://stackoverflow.com/questions/4697758/prevent-onmouseout-when-hovering-child-element-of-the-parent-absolute-div-withou
            var e = event.toElement || event.relatedTarget;
            if (e.parentNode == node || e == node) {
                return;
            }

            window.clearTimeout(timeoutId);
            timeoutId = null;
            if (currentTooltip != null) {
                document.body.removeChild(currentTooltip);
                currentTooltip = null;
            }
{'fraction_non_alphanumeric': 0.12010008340283569, 'fraction_numerical': 0.0079232693911593, 'mean_word_length': 2.0717029449423814, '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': '7609461', 'n_tokens_mistral': 641, 'n_tokens_neox': 626, 'n_words': 123}