<commit_before>/*
    kernel.css v0.5.0
    MIT License
    github.com/ionogy/kernel.css
*/

var kernel = kernel || {};

(function(app) {
    'use strict';

    var getElementIndex = function(element) {
        var index = 0;

        while ((element = element.previousElementSibling)) {
            index++;
        }

        return index;
    };

    if (window.Element && !Element.prototype.closest) {
        Element.prototype.closest = function(s) {
            var matches = (this.document || this.ownerDocument).querySelectorAll(s),
                i,
                el = this;

            do {
                i = matches.length;
                while (--i >= 0 && matches.item(i) !== el) {};
            } while ((i < 0) && (el = el.parentElement));

            return el;
        };
    }

    app.closeNotice = function(e) {
        e.currentTarget.closest('.ion-notice').remove();
    };

    /**
     * Toogle header navigation.
     **/

    app.toggleNav = function(e) {
        var header = e.currentTarget.closest('.ion-header');

        if (header.classList.toggle('ion-toggled')) {
            var navMobile = document.createElement('nav');
            navMobile.innerHTML = header.querySelector('.ion-nav').innerHTML;
            navMobile.className = 'ion-header-mobile ion-fade-in';
            navMobile.style['margin-top'] = header.offsetHeight + 'px';

            header.appendChild(navMobile);

            function onMouseUp(e) {
                if (
                    e.target != navMobile &&
                    e.target != header.querySelector('.nav-toggle') &&
                    e.target != header.querySelector('.nav-toggle i')
                ) {
                    navMobile.remove();
                    header.classList.remove('ion-toggled');
                }
            }

            window.addEventListener('mouseup', onMouseUp);
        } else {
            header.querySelector('.ion-header-mobile').remove();
        }
    };

    var sidebar = document.querySelector('.ion-sidebar');
    var sidebarIsToggled = false;

    /**
    * Toggle the sidebar.
    **/

    app.toggleSidebar = function() {
        if (sidebarIsToggled) {
            sidebar.style.width = '60px';
        } else {
            sidebar.style.width = '220px';
        }

        sidebarIsToggled = !sidebarIsToggled;
    };

    app.tabs = function(tab) {
        app.initTabs(document.querySelectorAll(tab));
    };

    app.initTabs = function(tabs) {
        tabs.forEach(function(tab) {
            var tabNavigation = tab.querySelectorAll('ul:first-child li');
            var tabContent = tab.querySelectorAll('.ion-tab');

            tabNavigation.forEach(function(element) {
                element.onclick = function(event) {
                    tabContent.forEach(function(el) {
                        el.classList.remove('ion-tab-selected');
                    });

                    tabContent[getElementIndex(event.currentTarget)].classList.add('ion-tab-selected');

                    tabContent.forEach(function(el) {
                        if (el.classList.contains('ion-tab-selected')) {
                            el.style.display = 'block';<commit_msg>Refactor sidebar logic<commit_after>/*
    kernel.css v0.5.0
    MIT License
    github.com/ionogy/kernel.css
*/

var kernel = kernel || {};

(function(app) {
    'use strict';

    var getElementIndex = function(element) {
        var index = 0;

        while ((element = element.previousElementSibling)) {
            index++;
        }

        return index;
    };

    if (window.Element && !Element.prototype.closest) {
        Element.prototype.closest = function(s) {
            var matches = (this.document || this.ownerDocument).querySelectorAll(s),
                i,
                el = this;

            do {
                i = matches.length;
                while (--i >= 0 && matches.item(i) !== el) {};
            } while ((i < 0) && (el = el.parentElement));

            return el;
        };
    }

    app.closeNotice = function(e) {
        e.currentTarget.closest('.ion-notice').remove();
    };

    /**
     * Toogle header navigation.
     **/

    app.toggleNav = function(e) {
        var header = e.currentTarget.closest('.ion-header');

        if (header.classList.toggle('ion-toggled')) {
            var navMobile = document.createElement('nav');
            navMobile.innerHTML = header.querySelector('.ion-nav').innerHTML;
            navMobile.className = 'ion-header-mobile ion-fade-in';
            navMobile.style['margin-top'] = header.offsetHeight + 'px';

            header.appendChild(navMobile);

            function onMouseUp(e) {
                if (
                    e.target != navMobile &&
                    e.target != header.querySelector('.nav-toggle') &&
                    e.target != header.querySelector('.nav-toggle i')
                ) {
                    navMobile.remove();
                    header.classList.remove('ion-toggled');
                }
            }

            window.addEventListener('mouseup', onMouseUp);
        } else {
            header.querySelector('.ion-header-mobile').remove();
        }
    };

    /**
     * Toggle the sidebar.
     **/

    app.toggleSidebar = function(e) {
        var sidebar = e.currentTarget.closest(".ion-sidebar");

        if (sidebar.classList.toggle("ion-active")) {
            sidebar.style.width = '60px';
        } else {
            sidebar.style.width = '220px';
        }
    };

    app.tabs = function(tab) {
        app.initTabs(document.querySelectorAll(tab));
    };

    app.initTabs = function(tabs) {
        tabs.forEach(function(tab) {
            var tabNavigation = tab.querySelectorAll('ul:first-child li');
            var tabContent = tab.querySelectorAll('.ion-tab');

            tabNavigation.forEach(function(element) {
                element.onclick = function(event) {
                    tabContent.forEach(function(el) {
                        el.classList.remove('ion-tab-selected');
                    });

                    tabContent[getElementIndex(event.currentTarget)].classList.add('ion-tab-selected');

                    tabContent.forEach(function(el) {
                        if (el.classList.contains('ion-tab-selected')) {
                            el.style.display = 'block';
{'fraction_non_alphanumeric': 0.13602133668026356, 'fraction_numerical': 0.0034515218073423283, 'mean_word_length': 1.6310359059017747, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '169764', 'n_tokens_mistral': 1770, 'n_tokens_neox': 1685, 'n_words': 268}