GitHub Collapse Project Columns

makes project columns collapsible

As of 06.11.2019. See ბოლო ვერსია.

// ==UserScript==
// @name         GitHub Collapse Project Columns
// @namespace    https://github.com/mestiez
// @version      1.1
// @description  makes project columns collapsible
// @author       mestiez
// @match        https://github.com/*/*/projects/*
// @grant        none
// @license MIT
// ==/UserScript==

var button = '<button type="button" class="float-right js-details-target btn-octicon p-1 tooltipped tooltipped-w hide-sm column-menu-item" aria-label="Collapse" aria-expanded="false"><svg class="octicon octicon-plus" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M6 2L0 8l6 6V2z"></path></svg></button>';

(function () {
    "use strict";

    const column = document.getElementsByClassName("project-column");
    for (let i = 0; i < column.length; i++) {
        const element = column[i].children[0].children[0];
        column[i].addEventListener("click", ()=>{
            column[i].style = "";
        });
        element.innerHTML += (button);
        element.lastElementChild.addEventListener("click", (e) => {
            event.stopImmediatePropagation();
            column[i].style = "max-width: 40px !important;display: table !important;min-width: 40px !important;white-space: nowrap !important;";});
    }
})();