<commit_before>
(function () {

    injectCSS();
    if (window.attachEvent) {
        window.attachEvent('onload', injectChat);
    } else {
        window.addEventListener('load', injectChat, false);
    }

    function openClick() {
        if (!window.intergramId) {
            console.error("To use Intergram you have to set an intergramId ");
            return;
        }

        document.querySelector('#intergramTitle').innerHTML = 'Intergram';
        document.querySelector('#intergramTitle').onclick = closeClick;

        document.querySelector('#intergramRoot').
        insertAdjacentHTML('beforeend',
            '<iframe src=\'https:\/\/idoco.github.io/intergram/chat.html#' + window.intergramId +
            '\' width=\'300\' height=\'350\' frameborder=\'0\' id=\'intergramIframe\' ><\/iframe>')
    }

    function closeClick() {
        document.querySelector('#intergramTitle').innerHTML = "Click to chat with us!";
        document.querySelector('#intergramTitle').onclick = openClick;

        var chatIframe = document.querySelector('#intergramIframe');
        chatIframe.parentNode.removeChild(chatIframe);
    }

    function injectCSS() {
        // add a style tag to the head
        var styleTag = document.createElement("link");
        styleTag.rel = "stylesheet";
        styleTag.type = "text/css";
        styleTag.href = "https://idoco.github.io/intergram/embed/style.css";
        styleTag.media = "all";
        document.getElementsByTagName('head')[0].appendChild(styleTag);
    }

    function injectChat() {
        // create the wrapper
        var root = document.createElement('div');
        root.id = 'intergramRoot';
        document.getElementsByTagName('body')[0].appendChild(root);

        // create the inner div
        var div = document.createElement('div');
        div.id = 'intergramTitle';
        div.onclick = openClick;
        root.appendChild(div);

        div.innerHTML = "Click to chat with us!"
    }

})();<commit_msg>hide iframe on close instead of deleting it<commit_after>
(function () {

    var intergramChatIframe = null;

    injectCSS();
    if (window.attachEvent) {
        window.attachEvent('onload', injectChat);
    } else {
        window.addEventListener('load', injectChat, false);
    }

    function openClick() {
        if (!window.intergramId) {
            console.error("To use Intergram you have to set an intergramId ");
            return;
        }

        document.querySelector('#intergramTitle').innerHTML = 'Intergram';
        document.querySelector('#intergramTitle').onclick = closeClick;

        if (!intergramChatIframe) {
            // init the chat Iframe for the first time
            document.querySelector('#intergramRoot').insertAdjacentHTML('beforeend',
                '<iframe src=\'https:\/\/idoco.github.io/intergram/chat.html#' + window.intergramId +
                '\' width=\'300\' height=\'350\' frameborder=\'0\' id=\'intergramIframe\' ><\/iframe>');
            intergramChatIframe = document.querySelector('#intergramIframe');
        } else {
            intergramChatIframe.style.display = 'block';
        }
    }

    function closeClick() {
        document.querySelector('#intergramTitle').innerHTML = "Click to chat with us!";
        document.querySelector('#intergramTitle').onclick = openClick;

        intergramChatIframe.style.display = 'none';
    }

    function injectCSS() {
        // add a style tag to the head
        var styleTag = document.createElement("link");
        styleTag.rel = "stylesheet";
        styleTag.type = "text/css";
        styleTag.href = "https://idoco.github.io/intergram/embed/style.css";
        styleTag.media = "all";
        document.getElementsByTagName('head')[0].appendChild(styleTag);
    }

    function injectChat() {
        // create the wrapper
        var root = document.createElement('div');
        root.id = 'intergramRoot';
        document.getElementsByTagName('body')[0].appendChild(root);

        // create the inner div
        var div = document.createElement('div');
        div.id = 'intergramTitle';
        div.onclick = openClick;
        root.appendChild(div);

        div.innerHTML = "Click to chat with us!"
    }

})();
{'fraction_non_alphanumeric': 0.13769485120453473, 'fraction_numerical': 0.004251299008030231, 'mean_word_length': 2.529166666666667, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '1625496', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1151, 'n_words': 228}