<commit_before>// ==UserScript==
// @name         GitHub Project Column Collapser
// @namespace    LoffeSoft
// @version      0.9
// @description  Collapses Columns in GitHub project view. Based on a bookmarklet written on a napkin by <NAME>.
// @author       <NAME>
// @match        https://github.*.io/*
// @match        https://github.com/*
// @grant        none
// ==/UserScript==

function toggleHideChild(element) {
    'use strict';
    element.style.display = element.style.display === 'none' ? '' : 'none';
}

function toggleHideUi(column, colHead, colNameLabel) {
    'use strict';
    toggleHideChild(column.querySelector('.project-column'));
    Array.from(colHead.children).filter(e => e.tagName != 'H4').forEach(e => toggleHideChild(e));
    toggleHideChild(colNameLabel.querySelector('.counter'));
}

function collapseColumn(column) {
    'use strict';
    const colHead = column.querySelector('.project-column-header');
    const colNameLabel = colHead.querySelector('h4');

    toggleHideUi(column, colHead, colNameLabel);

    const colHeadStyle = window.getComputedStyle(colHead);
    const colStyle = window.getComputedStyle(column);

    colNameLabel.style.writingMode = 'vertical-rl';
    colHead.style.cssText = 'border-bottom: 1px solid rgb(229, 229, 229) !important'; // HACK: override !important higher up
    colHead.style.borderRadius = '3px 3px 3px 3px';
    colHead.style.width = '3em';
    colHead.style.minHeight = '100%';
    column.style.width = '4em';

    column.dataset.collapsed = 'collapsed';
}

function unCollapseColumn(column) {
    'use strict';
    const colHead = column.querySelector('.project-column-header');
    const colNameLabel = colHead.querySelector('h4');

    toggleHideUi(column, colHead, colNameLabel);

    colNameLabel.style.writingMode = '';
    colHead.style.cssText = '';
    column.style.width = '';

    column.dataset.collapsed = '';
}

function toggleCollapseColumn(column) {
    'use strict';
    if (column.dataset.collapsed) {
        unCollapseColumn(column);
    } else {
        collapseColumn(column);
    }
}

(function() {
    'use strict';
    Array.from(document.querySelectorAll('.js-project-column'))
        .forEach(
        column => {
            const colHead = column.querySelector('.project-column-header');
            const colNameLabel = colHead.querySelector('h4');
            colHead.addEventListener('click', function (event) {
                if (event.target === this) {
                    toggleCollapseColumn(column);
                }
            });

            colNameLabel.addEventListener('click', (event) => toggleCollapseColumn(column));
        });
})();
<commit_msg>Fix include pattern for github.<company>.io<commit_after>// ==UserScript==
// @name         GitHub Project Column Collapser
// @namespace    LoffeSoft
// @version      0.9
// @description  Collapses Columns in GitHub project view. Based on a bookmarklet written on a napkin by <NAME>.
// @author       <NAME>
// @include      https://github.*.io/*
// @match        https://github.com/*
// @grant        none
// ==/UserScript==

function toggleHideChild(element) {
    'use strict';
    element.style.display = element.style.display === 'none' ? '' : 'none';
}

function toggleHideUi(column, colHead, colNameLabel) {
    'use strict';
    toggleHideChild(column.querySelector('.project-column'));
    Array.from(colHead.children).filter(e => e.tagName != 'H4').forEach(e => toggleHideChild(e));
    toggleHideChild(colNameLabel.querySelector('.counter'));
}

function collapseColumn(column) {
    'use strict';
    const colHead = column.querySelector('.project-column-header');
    const colNameLabel = colHead.querySelector('h4');

    toggleHideUi(column, colHead, colNameLabel);

    const colHeadStyle = window.getComputedStyle(colHead);
    const colStyle = window.getComputedStyle(column);

    colNameLabel.style.writingMode = 'vertical-rl';
    colHead.style.cssText = 'border-bottom: 1px solid rgb(229, 229, 229) !important'; // HACK: override !important higher up
    colHead.style.borderRadius = '3px 3px 3px 3px';
    colHead.style.width = '3em';
    colHead.style.minHeight = '100%';
    column.style.width = '4em';

    column.dataset.collapsed = 'collapsed';
}

function unCollapseColumn(column) {
    'use strict';
    const colHead = column.querySelector('.project-column-header');
    const colNameLabel = colHead.querySelector('h4');

    toggleHideUi(column, colHead, colNameLabel);

    colNameLabel.style.writingMode = '';
    colHead.style.cssText = '';
    column.style.width = '';

    column.dataset.collapsed = '';
}

function toggleCollapseColumn(column) {
    'use strict';
    if (column.dataset.collapsed) {
        unCollapseColumn(column);
    } else {
        collapseColumn(column);
    }
}

(function() {
    'use strict';
    Array.from(document.querySelectorAll('.js-project-column'))
        .forEach(
        column => {
            const colHead = column.querySelector('.project-column-header');
            const colNameLabel = colHead.querySelector('h4');
            colHead.addEventListener('click', function (event) {
                if (event.target === this) {
                    toggleCollapseColumn(column);
                }
            });

            colNameLabel.addEventListener('click', (event) => toggleCollapseColumn(column));
        });
})();

{'fraction_non_alphanumeric': 0.14423791821561338, 'fraction_numerical': 0.00929368029739777, 'mean_word_length': 3.0550113036925395, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 16, 'https://': 4, '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': '4655147', 'n_tokens_mistral': 1596, 'n_tokens_neox': 1552, 'n_words': 308}