GitHub hide sidebar

Hides the sidebar on GitHub tickets to use all horizontal space.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         GitHub hide sidebar
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Hides the sidebar on GitHub tickets to use all horizontal space.
// @author       PK Cakeout
// @match        https://github.com/*
// @grant        none
// ==/UserScript==

(function() {
    document.addEventListener("keydown", (event) => {
        function parent(x) {
            return x && x.parentElement;
        }

        if (!(event.key.toLowerCase() === "s" && event.ctrlKey && event.shiftKey)) {
            return;
        }

        event.preventDefault();
        let sidebar = parent(document.getElementById("partial-discussion-sidebar"));
        sidebar = sidebar ||
            parent(document.querySelector(".flex-shrink-0.col-12.col-md-3 > .BorderGrid.BorderGrid--spacious")) ||
            parent(parent(document.querySelector(".flex-shrink-0.col-12.col-md-3 > div > .discussion-sidebar-item.sidebar-assignee.js-discussion-sidebar-item")));

        if (!sidebar) {
            console.log("Tampermonkey script: Sidebar not found");
            return;
        }
        const mainbar = sidebar.parentElement.children[0];

        // Remove col-md-9, hide sidebar with display=none
        const oldStyle = sidebar.getAttribute("style") || "";
        if (oldStyle.indexOf("display:") < 0) {
            sidebar.setAttribute("style", "display: none;");
            mainbar.setAttribute("class", mainbar.attributes.class.value.replaceAll("col-md-9", ""));
        } else {
            sidebar.setAttribute("style", "");
            mainbar.setAttribute("class", mainbar.attributes.class.value + " col-md-9");
        }
    });
})();