<commit_before>define(['text!../views/infoContent.html', 'utils', 'jquery'], function(html, utils, $) {
    'use strict';

    var _appendContent = function(elem, link) {
            elem.innerHTML = '<object type="text/html" data="' + link + '" ></object>';
            return elem;
        },
        _infoContent = function(posts) {
            console.log(posts);
            var container = document.getElementById('infoContent');

            if (!utils._isUnd(posts) && !utils._isUnd(html)) {
                container.innerHTML = html;

                var miniPanel = document.getElementById('infoMiniPanel');

                if (!utils._isUnd(miniPanel)) {
                    var title = document.createElement('h5'),
                        link = document.createElement('a'),
                        postsContainer = document.createElement('div'),
                        pContainer = document.getElementById('infoContentPanel');

                    title.innerHTML = posts.title;
                    utils._setAttr(link, 'href', posts.link + '.html');
                    link.innerHTML = posts.link;
                    postsContainer.className = 'postMenu';

                    if (!utils._isUnd(posts.entries) && posts.entries.length > 0) {
                        var i = 0,
                            entries = posts.entries.length;
                        for (i; i < entries; i++) {
                            var subDiv = document.createElement('div'),
                                subLink = document.createElement('a'),
                                subText = document.createElement('p'),
                                author = document.createElement('p');

                            utils._setAttr(subLink, 'href', '#');
                            utils._setAttr(subLink, 'data', posts.entries[i].link);

                            subLink.className = 'infoSubMenuLink';
                            subLink.innerHTML = posts.entries[i].title;
                            subText.innerHTML = posts.entries[i].publishedDate;
                            author.innerHTML = posts.entries[i].author;

                            utils._appendArr(subDiv, [subLink, subText, author]);
                            postsContainer.appendChild(subDiv);

                            if (miniPanel.childNodes.length > 0) {
                                var j = 0,
                                    minLength = miniPanel.childNodes.length,
                                    firstNode = null;
                                for (j; j < minLength; j++) {
                                    if (typeof miniPanel.childNodes[j] === 'object' && miniPanel.childNodes[j].tagName === 'DIV') {
                                        firstNode = miniPanel.childNodes[j].childNodes[0].childNodes[0].getAttribute('data');
                                    }
                                }
                                _appendContent(pContainer, firstNode);
                            }
                        }

                        if (!utils._isUnd(document.getElementsByClassName('infoSubMenuLink'))) {
                            $('.infoSubMenuLink').click(function(ev) {
                                $('#infoContentPanel').empty();

                                var panel = miniPanel.childNodes[3].childNodes,
                                    link = ev.currentTarget.attributes.data.value,
                                    i = 0,
                                    panelLength = panel.length;

                                for (i; i < panelLength; i++) {
                                    var links = panel[i].childNodes[0];
                                    if ($(links).hasClass('now')) {
                                        $(links).removeClass('now');
                                    }
                                }

                                $(this).addClass('selected');
                                $(this).addClass('now');
                                _appendContent(pContainer, link);
                            });
                        }
                    }

                    utils._appendArr(miniPanel, [title, link, postsContainer]);
                }
            }
        };

    return {
        infoContent: _infoContent
    };
});<commit_msg>Improve infoContent.js<commit_after>define(['text!../views/infoContent.html', 'utils', 'jquery'], function(html, utils, $) {
    'use strict';

    var _infoContent = function(posts) {
        console.log(posts);
        var container = document.getElementById('infoContent');

        if (!utils._isUnd(posts) && !utils._isUnd(html)) {
            container.innerHTML = html;

            var miniPanel = document.getElementById('infoMiniPanel');

            if (!utils._isUnd(miniPanel)) {
                var title = document.createElement('h5'),
                    link = document.createElement('a'),
                    postsContainer = document.createElement('div'),
                    pContainer = document.getElementById('infoContentPanel');

                title.innerHTML = posts.title;
                utils._setAttr(link, 'href', posts.link + '.html');
                link.innerHTML = posts.link;
                postsContainer.className = 'postMenu';

                if (!utils._isUnd(posts.entries) && posts.entries.length > 0) {
                    var i = 0,
                        entries = posts.entries.length;
                    for (i; i < entries; i++) {
                        var subDiv = document.createElement('div'),
                            subLink = document.createElement('a'),
                            subText = document.createElement('p'),
                            author = document.createElement('p');

                        utils._setAttr(subLink, 'href', '#');
                        utils._setAttr(subLink, 'data', posts.entries[i].link);

                        subLink.className = 'infoSubMenuLink';
                        subLink.innerHTML = posts.entries[i].title;
                        subText.innerHTML = posts.entries[i].publishedDate;
                        author.innerHTML = posts.entries[i].author;

                        utils._appendArr(subDiv, [subLink, subText, author]);
                        postsContainer.appendChild(subDiv);

                        if (miniPanel.childNodes.length > 0) {
                            var j = 0,
                                minLength = miniPanel.childNodes.length,
                                firstNode = null;
                            for (j; j < minLength; j++) {
                                if (typeof miniPanel.childNodes[j] === 'object' && miniPanel.childNodes[j].tagName === 'DIV') {
                                    firstNode = miniPanel.childNodes[j].childNodes[0].childNodes[0].getAttribute('data');
                                }
                            }
                            utils._appendContent(pContainer, firstNode);
                        }
                    }

                    if (!utils._isUnd(document.getElementsByClassName('infoSubMenuLink'))) {
                        $('.infoSubMenuLink').click(function(ev) {
                            $('#infoContentPanel').empty();

                            var panel = miniPanel.childNodes[3].childNodes,
                                link = ev.currentTarget.attributes.data.value,
                                i = 0,
                                panelLength = panel.length;

                            for (i; i < panelLength; i++) {
                                var links = panel[i].childNodes[0];
                                if ($(links).hasClass('now')) {
                                    $(links).removeClass('now');
                                }
                            }

                            $(this).addClass('selected');
                            $(this).addClass('now');
                            utils._appendContent(pContainer, link);
                        });
                    }
                }

                utils._appendArr(miniPanel, [title, link, postsContainer]);
            }
        }
    };

    return {
        infoContent: _infoContent
    };
});
{'fraction_non_alphanumeric': 0.11187462326702834, 'fraction_numerical': 0.0024110910186859553, 'mean_word_length': 1.0865191146881288, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '609199', 'n_tokens_mistral': 1889, 'n_tokens_neox': 1756, 'n_words': 300}