Greasy Fork is available in English.

feishu content toggle

content toggle

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         feishu content toggle
// @namespace    http://tampermonkey.net/
// @version      24oct30-2027
// @description  content toggle
// @author       onionycs
// @license      MIT
// @match        *://*.feishu.cn/*
// @match        *://*.larkoffice.com/*
// @require      http://code.jquery.com/jquery-3.x-git.min.js
// @icon         https://www.google.com/s2/favicons?sz=64&domain=feishu.cn
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    /* globals jQuery, $, waitForKeyElements */

    // Your code here...
    // 监听键盘按下事件
    document.addEventListener('keydown', function(event) {
        // 检查按下的键是否是数字0(注意:这里不区分大小写,但数字键通常没有大小写)
        if (event.key === '['||event.key === '【') {
            let viewportWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
            let elem =$('.docx-width-mode')[0];
            document.getElementsByClassName("catalogue__pin-wrapper")[0].click();
            //false目录为开
            setTimeout(function(){
                console.error("调整窗口");
                if($('.catalogue__pin-wrapper').attr('data-pin')=='false'){
                    console.error("居中文字");
                    let a1=viewportWidth*0.6;
                    let a2=viewportWidth*0.3;
                    let a3=viewportWidth*0.1;
                    //document.getElementsByClassName("editor")[0].style.width=a1+"px";
                    //document.getElementsByClassName("editor")[0].style.maxWidth=a1+"px";
                    //document.getElementsByClassName("editor")[0].style.marginLeft=a2+"px";
                    //document.getElementsByClassName("editor")[0].style.marginRight=a3+"px";
                    //elem.style.maxWidth = a2 + 'px';
                     //$('.catalogue__item-title').css({
                     //    'overflow': 'visible'
                     //});
                } else {
                    //console.error("文字居左");
                    //let a1=viewportWidth*0.8;
                    //let a2=viewportWidth*0.3;
                    //let a3=viewportWidth*0.1;
                    //document.getElementsByClassName("editor")[0].style.width=a1+"px";
                    //document.getElementsByClassName("editor")[0].style.maxWidth=a1+"px";
                    //document.getElementsByClassName("editor")[0].style.marginLeft=a3+"px";
                }
            },300);
        }
        //move to collapse content
        //if (event.key === ']'||event.key === '】') {
        //    document.getElementsByClassName('doc-comment-v2-close-btn')[0].click();
        //}
    });
})();