// ==UserScript== // @name AI Chat Message Row Max-Width // @namespace http://tampermonkey.net/ // @version 0.11 // @description Adjust Content Max-Width // @author shawn-wxn // @match https://claude.ai/* // @match https://chat.deepseek.com/* // @match https://poe.com/* // @match https://*.geeksmonkey.com/* // @match https://*.perplexity.ai/* // @icon https://www.google.com/s2/favicons?sz=64&domain=claude.ai // @grant GM_addStyle // @grant GM_log // @license GPL-2.0-only // @downloadURL https://update.greasyfork.icu/scripts/470711/AI%20Chat%20Message%20Row%20Max-Width.user.js // @updateURL https://update.greasyfork.icu/scripts/470711/AI%20Chat%20Message%20Row%20Max-Width.meta.js // ==/UserScript== (function () { // 获取当前的 URL var currentURL = window.location.href; // 根据当前 URL 进行 if-else 逻辑判断 if (currentURL.includes("poe.com")) { var inputFooter = document.querySelector("div[class^='ChatPageMainFooter_footerInner__']"); var inputFooterClass = null; for (var className of inputFooter.classList){ if (className.indexOf('ChatPageMainFooter_footerInner__') !== -1) { inputFooterClass = className; break; } } if (!inputFooterClass) { GM_log("ERROR: not found inputFooterClass."); } var chatPageMainDiv = document.querySelector("div[class^='InfiniteScroll_container__']"); var chatPageMainDivClass = null; for (className of chatPageMainDiv.classList){ if (className.indexOf('InfiniteScroll_container__') !== -1) { chatPageMainDivClass = className; break; } } if (!chatPageMainDivClass) { GM_log("ERROR: not found chatPageMainDivClass."); } // var humanMessageDiv = document.querySelector("div[class^='Message_humanMessageBubble__']"); // var humanMessageDivClass = null; // for (className of humanMessageDiv.classList){ // if (className.indexOf('Message_humanMessageBubble__') !== -1) { // humanMessageDivClass = className; // break; // } // } // if (!humanMessageDivClass) { // GM_log("ERROR: not found humanMessageDivClass."); // } // var botMessageDiv = document.querySelector("div[class^='Message_botMessageBubble__']"); // var botMessageDivClass = null; // for (className of botMessageDiv.classList){ // if (className.indexOf('Message_botMessageBubble__') !== -1) { // botMessageDivClass = className; // break; // } // } // if (!botMessageDivClass) { // GM_log("ERROR: not found botMessageDivClass."); // } GM_addStyle(` .${inputFooterClass} { --desktop-reading-column-max-width: ${Math.floor(window.innerWidth * 0.048)}rem; } .${chatPageMainDivClass} { --desktop-reading-column-max-width: ${Math.floor(window.innerWidth * 0.048)}rem; }` ) // .${humanMessageDivClass} { // max-width: ${Math.floor(window.innerWidth * 0.078)}ch; // } // .${botMessageDivClass} { // max-width: ${Math.floor(window.innerWidth * 0.078)}ch; // } } else if (currentURL.includes("claude.ai")) { // 创建一个