No toolbars for slack lists (Toggleable), aka Fullscreen Lists

Hides toolbars for any given Slack List, toggleable with Command + . Useful when combined with Chrome's ability to turn any webpage into an App.

当前为 2024-08-05 提交的版本,查看 最新版本

// ==UserScript==
// @name         No toolbars for slack lists (Toggleable), aka Fullscreen Lists
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  Hides toolbars for any given Slack List, toggleable with Command + . Useful when combined with Chrome's ability to turn any webpage into an App.
// @author       Tim Kersten
// @match        https://app.slack.com/client/*/lists
// @grant        GM_addStyle
// @homepageURL  https://gist.github.com/io41/7ff3dfa815dd7566237234f7b699a529
// ==/UserScript==

(function() {
    'use strict';

    // Custom CSS styles to override page styles
    const customCSS = `
        .p-ia4_client.p-ia4_client--narrow-feature-on .p-client_workspace_wrapper:not(.p-client_workspace_wrapper--with-split-view) {
            grid-template-columns: 0 auto !important;
        }
        .p-client_workspace__layout {
          grid-template-columns: 0 auto !important;
        }
        .p-ia4_client--narrow-feature-on .p-tab_rail {
            width: 0 !important;
        }
        .p-ia4_client .p-ia4_top_nav {
            height: 0 !important;
        }
    `;

    // Create a style element
    const styleElement = document.createElement('style');
    styleElement.id = 'slackListToolbarToggleStyle';
    styleElement.textContent = customCSS;

    // Function to toggle the style
    function toggleStyle() {
        if (styleElement.parentNode) {
            styleElement.parentNode.removeChild(styleElement);
        } else {
            document.head.appendChild(styleElement);
        }
    }

    // Event listener for the key combination
    document.addEventListener('keydown', function(event) {
        // Check if the pressed key is '.' and the Command key is held down
        if (event.key === '.' && event.metaKey) {
            event.preventDefault(); // Prevent the default action
            toggleStyle();
        }
    });

    // Initially add the style
    document.head.appendChild(styleElement);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址