Greasy Fork is available in English.

coze窗口调整

用于调整coze窗口大小

// ==UserScript==
// @name         coze窗口调整
// @namespace    http://tampermonkey.net/
// @version      3.3
// @description  用于调整coze窗口大小
// @author       pps
// @match        https://www.coze.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=coze.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    let ctrlPressed = false;
    let selectCount = 0;
    const checkInterval = setInterval(function changeWin() {
        selectCount++;
        if (selectCount > 30) {clearInterval(checkInterval);return}
        if(document.querySelector('.sidesheet-container') && selectCount <= 30){
            handle();
            clearInterval(checkInterval);
        }
    }, 2000); // 每秒检查一次,可以根据需求调整时间间隔
    const handle = () => {
        let mainSize = (Number(prompt('调整窗口百分比!ctrl + →弹窗','60'))/ 10) * 4;
        let otherSize = 40 - mainSize;
        document.querySelector('.sidesheet-container').style.gridTemplateColumns=`${otherSize}fr ${mainSize}fr`;
    }
    document.addEventListener('keydown', function(event) {
        if (event.key === 'Control') {
            ctrlPressed = true;
        } else if (event.key === 'ArrowRight' && ctrlPressed) {
            handle()
            ctrlPressed = false;
        } else {
            ctrlPressed = false;
        }
    });
    console.log('窗口调整完成')
    console.log('213寝室大吉')
    // Your code here...
})();