<commit_before>// if we're at the translation page, when pasting the translation content,
// automatically extract the content instead of having to press the
// button as opposed to the way it was before
if (window.location.href.search('translated_posts') !== -1) {
    let publication = Cookie.get('publication') && JSON.parse(Cookie.get('publication'));

    let language = document.querySelector('.translated-post-form__language-code-field');
    let translator = document.querySelector('.translated-post-form__language-code-field');

    // selects the correct language for this publication
    let selectLanguageOption = function (languageName) {
        let optionIndex;

        [].filter.call(language.options, function (item) {
            if (item.innerText == languageName) {
                item.setAttribute('selected', 'selected');
            }
        });
    };

    // since we cannot access any JavaScript from the tab/page, we can only
    // work with the DOM as it was a simple DOM without any custom JS
    // added to it. Thus, we can only display some 
    let showTranslator = function (translatorName) {
        let input = document.createElement('input');
        let label = document.createElement('label');

        input.value = translatorName;
        input.setAttribute('class', 'chrExtInput');
        input.setAttribute('id', 'chrExtInput');

        label.setAttribute('for', 'chrExtInput');
        label.setAttribute('class', 'chrExtLabel');
        label.innerText = 'Translator';

        bar.appendChild(label);
        bar.appendChild(input);<commit_msg>added `copy translator` button<commit_after>// if we're at the translation page, when pasting the translation content,
// automatically extract the content instead of having to press the
// button as opposed to the way it was before
if (window.location.href.search('translated_posts') !== -1) {
    let publication = Cookie.get('publication') && JSON.parse(Cookie.get('publication'));

    let language = document.querySelector('.translated-post-form__language-code-field');
    let translator = document.querySelector('.translated-post-form__language-code-field');

    // selects the correct language for this publication
    let selectLanguageOption = function (languageName) {
        let optionIndex;

        [].filter.call(language.options, function (item) {
            if (item.innerText == languageName) {
                item.setAttribute('selected', 'selected');
            }
        });
    };

    // since we cannot access any JavaScript from the tab/page, we can only
    // work with the DOM as it was a simple DOM without any custom JS
    // added to it. Thus, we can only display some 
    let showTranslator = function (translatorName) {
        let input = document.createElement('input');
        let btn = document.createElement('button');

        input.value = translatorName;
        input.setAttribute('class', 'chrExtInput');
        input.setAttribute('id', 'chrExtInput');

        btn.innerHTML = 'Copy Translator';
        btn.setAttribute('class', 'chrExtButton');

        // event delegation so the element is added with the event and we
        // can press it to copy the content of the input. It is necessary
        // to pass the callback directly to the click event so it can be
        // bound to the element
        document.querySelector('body').addEventListener("click", function () {
            input.select();
            document.execCommand('copy');
        });

        bar.appendChild(input);
        bar.appendChild(btn);
{'fraction_non_alphanumeric': 0.11139098796529527, 'fraction_numerical': 0.000559753708368318, 'mean_word_length': 2.9060109289617486, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3364142', 'n_tokens_mistral': 892, 'n_tokens_neox': 867, 'n_words': 297}