// ==UserScript== // @name coze gpt full? // @namespace https://bbs.tampermonkey.net.cn/ // @version 0.1.3 // @description try to take over the world! // @author tfsn20 // @match https://www.coze.com/space/*/bot/* // ==/UserScript== (function () { 'use strict'; function createButton(fontColor = '(235, 101, 0, 1)', backColor = '(228, 229, 229, 0.5)') { var button = document.createElement('button'); button.innerHTML = 'Full?'; button.style.cssText = `position: fixed; top: 5px; left: 50%; transform: translateX(-50%); padding: 5px 5px; background-color: rgba${backColor}; color: rgba${fontColor}; border: none; border-radius: 10px; cursor: pointer; z-index: 9999; font-family: "Times New Roman", Times, serif; font-size: 16px; `; document.body.appendChild(button); return button } let button = createButton(); let flag = true; let first = true; let scale = '1fr 1fr'; button.addEventListener('click', function () { if (first) { function gcd(a, b) { return b === 0 ? a : gcd(b, a % b); } function pixelsToFraction(input) { // 提取像素值 const pixelValues = input.match(/\d+/g).map(Number); // 计算两个值的最大公约数 const greatestCommonDivisor = gcd(pixelValues[0], pixelValues[1]); // 将像素值转换成最简比例 const frValues = pixelValues.map(value => value / greatestCommonDivisor); // 创建表示 fr 单位的字符串 const frString = frValues.map(value => value.toString() + 'fr').join(' '); return frString; } scale = pixelsToFraction(window.getComputedStyle(document.querySelector("div.sidesheet-container")).getPropertyValue('grid-template-columns')) console.log(scale); first = false } if (flag) { document.querySelector("div.sidesheet-container").style.cssText = "display: grid; grid-template-columns: 0fr 1fr;"; document.querySelector("div:nth-child(2) > div > div > div > div > div").style.cssText = 'display: none;'; document.querySelector("div.sidesheet-container> div:nth-child(2)> div>div:nth-child(1)").style.cssText = 'display: none;'; } else { document.querySelector("div.sidesheet-container").style.cssText = `display: grid; grid-template-columns: ${scale};`; document.querySelector("div:nth-child(2) > div > div > div > div > div").style.cssText = 'display: flex;'; document.querySelector("div.sidesheet-container> div:nth-child(2)> div>div:nth-child(1)").style.cssText = 'display: flex;'; } flag = !flag; }); // Your code here... })();