<commit_before>import "es5-shim";
import "es6-shim";
import ClipboardJS from "clipboard/dist/clipboard";
import hljs from  "highlight.js/lib/core";
import xml from "highlight.js/lib/languages/xml";
import php from "highlight.js/lib/languages/php";
import json from "highlight.js/lib/languages/json";

window.readyHandlers = [];
window.ready = function ready(handler) {
    window.readyHandlers.push(handler);
    handleState();
};

window.handleState = function handleState () {
    if (document.readyState === 'interactive' || document.readyState === "complete") {
        while(window.readyHandlers.length > 0) {
            (window.readyHandlers.shift())();
        }
    }
};

document.onreadystatechange = window.handleState;

ready(function () {
    // Language selector
    var languageSelector = document.getElementById("language-selector");
    languageSelector.onchange = function() {
        var languageForm = document.getElementById("language-form");
        languageForm.submit();
        return true;
    };

    // Side menu
    var menuLink = document.getElementById("menuLink");
    menuLink.onclick = function(e) {
        e.preventDefault();

        var layout = document.getElementById("layout");
        if (layout.className.match(/(?:^|\s)active(?!\S)/)) {
            layout.className = layout.className.replace(/(?:^|\s)active(?!\S)/g , '');
        } else {
            layout.className += " active";
        }

        var foot = document.getElementById("foot");
        if (foot.className.match(/(?:^|\s)active(?!\S)/)) {
            foot.className = foot.className.replace(/(?:^|\s)active(?!\S)/g , '');
        } else {
            foot.className += " active";
        }

        if (menuLink.className.match(/(?:^|\s)active(?!\S)/)) {
            menuLink.className = menuLink.className.replace(/(?:^|\s)active(?!\S)/g , '');
        } else {
            menuLink.className += " active";
        }
    };
});


$(document).ready(function () {
    // expander boxes
    $('.expandable > .expander').on('click', function (e) {
        e.preventDefault();
        let target = $(e.currentTarget);
        target.parents('.expandable').toggleClass('expanded');
        target.blur();
    });

    // syntax highlight
    hljs.registerLanguage('xml', xml);
    hljs.registerLanguage('php', php);
    hljs.registerLanguage('json', json);
    $('.code-box-content.xml, .code-box-content.php, .code-box-content.json').each(function (i, block) {
        hljs.highlightBlock(block)
    });

    // clipboard<commit_msg>Migrate to native JS<commit_after>import "es5-shim";
import "es6-shim";
import ClipboardJS from "clipboard/dist/clipboard";
import hljs from  "highlight.js/lib/core";
import xml from "highlight.js/lib/languages/xml";
import php from "highlight.js/lib/languages/php";
import json from "highlight.js/lib/languages/json";

window.readyHandlers = [];
window.ready = function ready(handler) {
    window.readyHandlers.push(handler);
    handleState();
};

window.handleState = function handleState () {
    if (document.readyState === 'interactive' || document.readyState === "complete") {
        while(window.readyHandlers.length > 0) {
            (window.readyHandlers.shift())();
        }
    }
};

document.onreadystatechange = window.handleState;

ready(function () {
    // Language selector
    var languageSelector = document.getElementById("language-selector");
    languageSelector.onchange = function() {
        let languageForm = document.getElementById("language-form");
        languageForm.submit();
        return true;
    };


    // Side menu
    var menuLink = document.getElementById("menuLink");
    menuLink.onclick = function(e) {
        e.preventDefault();

        let layout = document.getElementById("layout");
        if (layout.className.match(/(?:^|\s)active(?!\S)/)) {
            layout.className = layout.className.replace(/(?:^|\s)active(?!\S)/g , '');
        } else {
            layout.className += " active";
        }

        let foot = document.getElementById("foot");
        if (foot.className.match(/(?:^|\s)active(?!\S)/)) {
            foot.className = foot.className.replace(/(?:^|\s)active(?!\S)/g , '');
        } else {
            foot.className += " active";
        }

        if (menuLink.className.match(/(?:^|\s)active(?!\S)/)) {
            menuLink.className = menuLink.className.replace(/(?:^|\s)active(?!\S)/g , '');
        } else {
            menuLink.className += " active";
        }
    };


    // Expander boxes
    var expandable = document.querySelectorAll('.expandable > .expander');
    expandable.forEach(function (currentValue, index, arr) {
        currentValue.onclick = function(e) {
            e.preventDefault();
            var parent = e.currentTarget.parentNode;

                if (parent.className.match(/(?:^|\s)expanded(?!\S)/)) {
                    parent.className = parent.className.replace(/(?:^|\s)expanded(?!\S)/g , '');
                } else {
                    parent.className += " expanded";
                }
                e.currentTarget.blur();
        }
    });


    // Syntax highlight
    hljs.registerLanguage('xml', xml);
    hljs.registerLanguage('php', php);
    hljs.registerLanguage('json', json);

    var codeBoxes = document.querySelectorAll('.code-box-content.xml, .code-box-content.php, .code-box-content.json');
    codeBoxes.forEach(function (currentValue, index, arr) {
        hljs.highlightElement(currentValue);
    });


    // Clipboard
{'fraction_non_alphanumeric': 0.1715686274509804, 'fraction_numerical': 0.0010893246187363835, 'mean_word_length': 2.629117259552042, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '4354983', 'n_tokens_mistral': 1633, 'n_tokens_neox': 1577, 'n_words': 257}